<?xml version="1.0" encoding="utf-8" ?>
<c:Screen xmlns:c="BitMobile.Controls" xmlns:s="BitMobile.ValueStack" StyleSheet="Main.css">

	<s:Push Id="scheduledVisits" Value="$GetCommitedScheduledVisits()" />
	<s:Push Id="unscheduledVisits" Value="$GetUnscheduledVisits()" />
	<s:Push Id="visitsTotal" Value="$GetSum($scheduledVisits, $unscheduledVisits)"></s:Push>
	<s:Push Id="plannedVisits" Value="$GetPlannedVisits()"></s:Push>
	<s:Push Id="planVisitsLeft" Value="$GetDifference($plannedVisits, $scheduledVisits)"></s:Push>
	<s:Push Id="outletsCount" Value="$GetOutletsCount()" />
	<s:Push Id="orderSum" Value="$GetOrderSumm()" />
	<s:Push Id="orderQty" Value="$GetOrderQty()"></s:Push>
	<s:Push Id="encashmentSumm" Value="$GetEncashmentSumm()" />
	<s:Push Id="receivablesSumm" Value="$GetReceivablesSumm()" />

	<c:SwipeHorizontalLayout Id="swipe_layout">
		<c:VerticalLayout CssClass="menu">

			<c:DockLayout CssClass="header" OnEvent="Forward" OnClickAction="$CloseMenu()">							
				<c:HorizontalLayout>
					<c:Image CssClass="btn_summary" />
					<c:TextView Text="#summary#" />	
				</c:HorizontalLayout>
			</c:DockLayout>

			<c:DockLayout OnClickAction="$DoAction(Visits)">
				<c:TextView CssClass="menu_text" Text="{$scheduledVisits} | {$plannedVisits}" />
				<c:HorizontalLayout>
					<c:Image CssClass="btn_visits" />
					<c:TextView Text="#visits#" />
				</c:HorizontalLayout>
			</c:DockLayout>
			<c:HorizontalLine />

			<c:DockLayout OnClickAction="$DoAction(Outlets)">
				<c:TextView CssClass="menu_text" Text="$outletsCount" />
				<c:HorizontalLayout>
					<c:Image CssClass="btn_clients" />
					<c:TextView Text="#clients#" />
				</c:HorizontalLayout>
			</c:DockLayout>
			<c:HorizontalLine />

			<c:DockLayout OnClickAction="$DoAction(Order)">
				<c:TextView CssClass="menu_text" Text="{$orderQty} | {$FormatValue($orderSum)}"></c:TextView>
				<c:HorizontalLayout>
					<c:Image CssClass="btn_orders" />
					<c:TextView Text="#orders#"></c:TextView>
				</c:HorizontalLayout>
			</c:DockLayout>
			<c:HorizontalLine />

			<c:DockLayout OnClickAction="$DoAction(Sync)">
				<c:TextView Id="syncTitle" CssClass="menu_text" Text="$GetLastSyncTime()"></c:TextView>
				<c:HorizontalLayout>
					<c:Image CssClass="btn_sync" />
					<c:TextView Text="#sync#" />
				</c:HorizontalLayout>
			</c:DockLayout>
			<c:HorizontalLine />

			<c:DockLayout OnClickAction="$DoAction(About)">
				<c:TextView CssClass="menu_text" Text="ver. 2.5" />
				<c:HorizontalLayout>
					<c:Image CssClass="btn_info" />
					<c:TextView Text="#info#" />
				</c:HorizontalLayout>
			</c:DockLayout>
			<c:HorizontalLine />
			
			<c:DockLayout OnClickAction="$LogoutQuery()">
				<c:HorizontalLayout>
					<c:Image CssClass="btn_logout" />
					<c:TextView Text="#logout#" />
				</c:HorizontalLayout>
			</c:DockLayout>
			<c:HorizontalLine />

		</c:VerticalLayout>
		<c:VerticalLayout>

			<c:DockLayout CssClass="top_navigator">
				<c:DockLayout Id="btnMenu" CssClass="btn_menu" OnClickAction="$Facade.OpenMenu()">
					<c:Image CssClass="menuIcon" />
				</c:DockLayout>
				<c:DockLayout CssClass="btn_space" />
				<c:HorizontalLayout>
					<c:TextView Text="#summary#" />
				</c:HorizontalLayout>
			</c:DockLayout>
			<c:HorizontalLine CssClass="navy" />

			<c:VerticalLayout Id="VLayout" CssClass="blue">


				<c:DockLayout>
					<c:VerticalLayout CssClass="left">
						<c:DockLayout CssClass="caption_big">
							<c:TextView Text="$visitsTotal" />
							<c:TextView Text="#vpVisits#" CssClass="descr" />
							<c:TextView Text="#vpPerformed#" CssClass="descr" />
						</c:DockLayout>

						<c:VerticalLayout CssClass="simple">
							<c:HorizontalLayout>
								<c:TextView Text="#further#" CssClass="descr" />
								<c:TextView Text="$planVisitsLeft" CssClass="mark" />
								<c:TextView Text="#vpVisits#" />
							</c:HorizontalLayout>
							<c:TextView Text="#scheduled#" CssClass="descr" />
						</c:VerticalLayout>
					</c:VerticalLayout>

					<c:VerticalLayout CssClass="right">
						<c:DockLayout CssClass="grid">
							<c:VerticalLayout>
								<c:TextView Text="$scheduledVisits" CssClass="main_row"></c:TextView>
								<c:TextView Text="#planned#" CssClass="description_row" />
								<c:TextView Text="#vpVisits#" CssClass="description_row" />
							</c:VerticalLayout>
						</c:DockLayout>
						<c:HorizontalLine />
						<c:DockLayout CssClass="grid">
							<c:VerticalLayout>
								<c:TextView Text="$unscheduledVisits" CssClass="main_row"></c:TextView>
								<c:TextView Text="#vpUnplanned#" CssClass="description_row" />
								<c:TextView Text="#vpVisits#" CssClass="description_row" />
							</c:VerticalLayout>
						</c:DockLayout>
					</c:VerticalLayout>

				</c:DockLayout>


				<c:DockLayout CssClass="short_panel">
					<c:DockLayout CssClass="grid">
						<c:VerticalLayout>
							<c:TextView Text="{$FormatValue($orderSum)} #currency#" CssClass="main_row"></c:TextView>
							<c:TextView Text="#amountOfOrdersForToday#" CssClass="description_row" />
						</c:VerticalLayout>
					</c:DockLayout>
				</c:DockLayout>

				<s:If Test="$sessionConst.encashEnabled">
					<c:DockLayout>
						<c:DockLayout CssClass="grid">
							<c:VerticalLayout>
								<c:TextView Text="{$FormatValue($encashmentSumm)} #currency#" CssClass="main_row"></c:TextView>
								<c:TextView Text="#programmingCollectionForToday#" CssClass="description_row" />
							</c:VerticalLayout>
						</c:DockLayout>
						<c:HorizontalLine />
						<c:DockLayout CssClass="grid">
							<c:VerticalLayout>
								<c:TextView Text="{$FormatValue($receivablesSumm)} #currency#" CssClass="main_row"></c:TextView>
								<c:TextView Text="#accountsReceivables#" CssClass="description_row" />
							</c:VerticalLayout>
						</c:DockLayout>
					</c:DockLayout>
				</s:If>

			</c:VerticalLayout>

		</c:VerticalLayout>
	</c:SwipeHorizontalLayout>

</c:Screen>