diff --git a/Tanshu.Accounts.PointOfSale/MainForm.cs b/Tanshu.Accounts.PointOfSale/MainForm.cs
index 53977d8..e594b8f 100644
--- a/Tanshu.Accounts.PointOfSale/MainForm.cs
+++ b/Tanshu.Accounts.PointOfSale/MainForm.cs
@@ -179,7 +179,15 @@ namespace Tanshu.Accounts.PointOfSale
btnDiscountReport.Visible = Session.IsAllowed(RoleConstants.VOID_OR_REPRINTED_BILL_REPORT);
btnChangePassword.Visible = Session.IsAuthenticated;
- btnManagement.Visible = false;
+#if (DEBUG)
+ btnMgtBeer.Visible = true;
+ btnMgtFood.Visible = true;
+ btnMgtLiq.Visible = true;
+#else
+ btnMgtBeer.Visible = false;
+ btnMgtFood.Visible = false;
+ btnMgtLiq.Visible = false;
+#endif
}
private void btnGroupRoles_Click(object sender, EventArgs e)
@@ -264,12 +272,6 @@ namespace Tanshu.Accounts.PointOfSale
frm.ShowDialog();
}
- private void btnManagement_Click(object sender, EventArgs e)
- {
- using (var frm = new QuantityForm())
- frm.ShowDialog();
- }
-
private void btnDiscountReport_Click(object sender, EventArgs e)
{
using (var frm = new DiscountReportForm())
@@ -277,6 +279,22 @@ namespace Tanshu.Accounts.PointOfSale
}
+ private void btnMgtBeer_Click(object sender, EventArgs e)
+ {
+ using (var frm = new MoveForm())
+ frm.ShowDialog();
+ }
+ private void btnMgtFood_Click(object sender, EventArgs e)
+ {
+ using (var frm = new FoodForm())
+ frm.ShowDialog();
+ }
+
+ private void btnMgtLiq_Click(object sender, EventArgs e)
+ {
+ using (var frm = new AmountForm())
+ frm.ShowDialog();
+ }
}
}
\ No newline at end of file
diff --git a/Tanshu.Accounts.PointOfSale/MainForm.designer.cs b/Tanshu.Accounts.PointOfSale/MainForm.designer.cs
index fe179f9..2ff442c 100644
--- a/Tanshu.Accounts.PointOfSale/MainForm.designer.cs
+++ b/Tanshu.Accounts.PointOfSale/MainForm.designer.cs
@@ -49,15 +49,18 @@
this.btnDiscountReport = new System.Windows.Forms.Button();
this.btnChangePassword = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
- this.btnManagement = new System.Windows.Forms.Button();
+ this.btnMgtBeer = new System.Windows.Forms.Button();
+ this.btnMgtFood = new System.Windows.Forms.Button();
+ this.btnMgtLiq = new System.Windows.Forms.Button();
this.flowLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// btnLogin
//
- this.btnLogin.Location = new System.Drawing.Point(3, 3);
+ this.btnLogin.Location = new System.Drawing.Point(4, 4);
+ this.btnLogin.Margin = new System.Windows.Forms.Padding(4);
this.btnLogin.Name = "btnLogin";
- this.btnLogin.Size = new System.Drawing.Size(150, 100);
+ this.btnLogin.Size = new System.Drawing.Size(200, 123);
this.btnLogin.TabIndex = 1;
this.btnLogin.Text = "&Login";
this.btnLogin.UseVisualStyleBackColor = true;
@@ -65,9 +68,10 @@
//
// btnSale
//
- this.btnSale.Location = new System.Drawing.Point(315, 3);
+ this.btnSale.Location = new System.Drawing.Point(420, 4);
+ this.btnSale.Margin = new System.Windows.Forms.Padding(4);
this.btnSale.Name = "btnSale";
- this.btnSale.Size = new System.Drawing.Size(150, 100);
+ this.btnSale.Size = new System.Drawing.Size(200, 123);
this.btnSale.TabIndex = 3;
this.btnSale.Text = "&Sale";
this.btnSale.UseVisualStyleBackColor = true;
@@ -95,18 +99,22 @@
this.flowLayoutPanel1.Controls.Add(this.btnDiscountReport);
this.flowLayoutPanel1.Controls.Add(this.btnChangePassword);
this.flowLayoutPanel1.Controls.Add(this.btnExit);
- this.flowLayoutPanel1.Controls.Add(this.btnManagement);
+ this.flowLayoutPanel1.Controls.Add(this.btnMgtBeer);
+ this.flowLayoutPanel1.Controls.Add(this.btnMgtFood);
+ this.flowLayoutPanel1.Controls.Add(this.btnMgtLiq);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
+ this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(4);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
- this.flowLayoutPanel1.Size = new System.Drawing.Size(792, 537);
+ this.flowLayoutPanel1.Size = new System.Drawing.Size(1056, 661);
this.flowLayoutPanel1.TabIndex = 0;
//
// btnSwipeLogin
//
- this.btnSwipeLogin.Location = new System.Drawing.Point(159, 3);
+ this.btnSwipeLogin.Location = new System.Drawing.Point(212, 4);
+ this.btnSwipeLogin.Margin = new System.Windows.Forms.Padding(4);
this.btnSwipeLogin.Name = "btnSwipeLogin";
- this.btnSwipeLogin.Size = new System.Drawing.Size(150, 100);
+ this.btnSwipeLogin.Size = new System.Drawing.Size(200, 123);
this.btnSwipeLogin.TabIndex = 2;
this.btnSwipeLogin.Text = "Swipe Login";
this.btnSwipeLogin.UseVisualStyleBackColor = true;
@@ -114,9 +122,10 @@
//
// btnCustomer
//
- this.btnCustomer.Location = new System.Drawing.Point(471, 3);
+ this.btnCustomer.Location = new System.Drawing.Point(628, 4);
+ this.btnCustomer.Margin = new System.Windows.Forms.Padding(4);
this.btnCustomer.Name = "btnCustomer";
- this.btnCustomer.Size = new System.Drawing.Size(150, 100);
+ this.btnCustomer.Size = new System.Drawing.Size(200, 123);
this.btnCustomer.TabIndex = 4;
this.btnCustomer.Text = "Customers";
this.btnCustomer.UseVisualStyleBackColor = true;
@@ -124,9 +133,10 @@
//
// btnProduct
//
- this.btnProduct.Location = new System.Drawing.Point(627, 3);
+ this.btnProduct.Location = new System.Drawing.Point(836, 4);
+ this.btnProduct.Margin = new System.Windows.Forms.Padding(4);
this.btnProduct.Name = "btnProduct";
- this.btnProduct.Size = new System.Drawing.Size(150, 100);
+ this.btnProduct.Size = new System.Drawing.Size(200, 123);
this.btnProduct.TabIndex = 5;
this.btnProduct.Text = "Products";
this.btnProduct.UseVisualStyleBackColor = true;
@@ -134,9 +144,10 @@
//
// btnProductGroup
//
- this.btnProductGroup.Location = new System.Drawing.Point(3, 109);
+ this.btnProductGroup.Location = new System.Drawing.Point(4, 135);
+ this.btnProductGroup.Margin = new System.Windows.Forms.Padding(4);
this.btnProductGroup.Name = "btnProductGroup";
- this.btnProductGroup.Size = new System.Drawing.Size(150, 100);
+ this.btnProductGroup.Size = new System.Drawing.Size(200, 123);
this.btnProductGroup.TabIndex = 6;
this.btnProductGroup.Text = "Product Groups";
this.btnProductGroup.UseVisualStyleBackColor = true;
@@ -144,9 +155,10 @@
//
// btnOpenBill
//
- this.btnOpenBill.Location = new System.Drawing.Point(159, 109);
+ this.btnOpenBill.Location = new System.Drawing.Point(212, 135);
+ this.btnOpenBill.Margin = new System.Windows.Forms.Padding(4);
this.btnOpenBill.Name = "btnOpenBill";
- this.btnOpenBill.Size = new System.Drawing.Size(150, 100);
+ this.btnOpenBill.Size = new System.Drawing.Size(200, 123);
this.btnOpenBill.TabIndex = 7;
this.btnOpenBill.Text = "Open Bill";
this.btnOpenBill.UseVisualStyleBackColor = true;
@@ -154,9 +166,10 @@
//
// btnAdvanceReceive
//
- this.btnAdvanceReceive.Location = new System.Drawing.Point(315, 109);
+ this.btnAdvanceReceive.Location = new System.Drawing.Point(420, 135);
+ this.btnAdvanceReceive.Margin = new System.Windows.Forms.Padding(4);
this.btnAdvanceReceive.Name = "btnAdvanceReceive";
- this.btnAdvanceReceive.Size = new System.Drawing.Size(150, 100);
+ this.btnAdvanceReceive.Size = new System.Drawing.Size(200, 123);
this.btnAdvanceReceive.TabIndex = 8;
this.btnAdvanceReceive.Text = "Receive Advance";
this.btnAdvanceReceive.UseVisualStyleBackColor = true;
@@ -164,9 +177,10 @@
//
// btnAdvanceAdjust
//
- this.btnAdvanceAdjust.Location = new System.Drawing.Point(471, 109);
+ this.btnAdvanceAdjust.Location = new System.Drawing.Point(628, 135);
+ this.btnAdvanceAdjust.Margin = new System.Windows.Forms.Padding(4);
this.btnAdvanceAdjust.Name = "btnAdvanceAdjust";
- this.btnAdvanceAdjust.Size = new System.Drawing.Size(150, 100);
+ this.btnAdvanceAdjust.Size = new System.Drawing.Size(200, 123);
this.btnAdvanceAdjust.TabIndex = 9;
this.btnAdvanceAdjust.Text = "Adjust Advance";
this.btnAdvanceAdjust.UseVisualStyleBackColor = true;
@@ -174,9 +188,10 @@
//
// btnCreateUser
//
- this.btnCreateUser.Location = new System.Drawing.Point(627, 109);
+ this.btnCreateUser.Location = new System.Drawing.Point(836, 135);
+ this.btnCreateUser.Margin = new System.Windows.Forms.Padding(4);
this.btnCreateUser.Name = "btnCreateUser";
- this.btnCreateUser.Size = new System.Drawing.Size(150, 100);
+ this.btnCreateUser.Size = new System.Drawing.Size(200, 123);
this.btnCreateUser.TabIndex = 10;
this.btnCreateUser.Text = "Create User";
this.btnCreateUser.UseVisualStyleBackColor = true;
@@ -184,9 +199,10 @@
//
// btnUserRoles
//
- this.btnUserRoles.Location = new System.Drawing.Point(3, 215);
+ this.btnUserRoles.Location = new System.Drawing.Point(4, 266);
+ this.btnUserRoles.Margin = new System.Windows.Forms.Padding(4);
this.btnUserRoles.Name = "btnUserRoles";
- this.btnUserRoles.Size = new System.Drawing.Size(150, 100);
+ this.btnUserRoles.Size = new System.Drawing.Size(200, 123);
this.btnUserRoles.TabIndex = 11;
this.btnUserRoles.Text = "Manage User Roles";
this.btnUserRoles.UseVisualStyleBackColor = true;
@@ -194,9 +210,10 @@
//
// btnGroupRoles
//
- this.btnGroupRoles.Location = new System.Drawing.Point(159, 215);
+ this.btnGroupRoles.Location = new System.Drawing.Point(212, 266);
+ this.btnGroupRoles.Margin = new System.Windows.Forms.Padding(4);
this.btnGroupRoles.Name = "btnGroupRoles";
- this.btnGroupRoles.Size = new System.Drawing.Size(150, 100);
+ this.btnGroupRoles.Size = new System.Drawing.Size(200, 123);
this.btnGroupRoles.TabIndex = 12;
this.btnGroupRoles.Text = "Manage Group Roles";
this.btnGroupRoles.UseVisualStyleBackColor = true;
@@ -204,9 +221,10 @@
//
// btnCashierCheckout
//
- this.btnCashierCheckout.Location = new System.Drawing.Point(315, 215);
+ this.btnCashierCheckout.Location = new System.Drawing.Point(420, 266);
+ this.btnCashierCheckout.Margin = new System.Windows.Forms.Padding(4);
this.btnCashierCheckout.Name = "btnCashierCheckout";
- this.btnCashierCheckout.Size = new System.Drawing.Size(150, 100);
+ this.btnCashierCheckout.Size = new System.Drawing.Size(200, 123);
this.btnCashierCheckout.TabIndex = 13;
this.btnCashierCheckout.Text = "Cashier Checkout";
this.btnCashierCheckout.UseVisualStyleBackColor = true;
@@ -214,9 +232,10 @@
//
// btnSaleAnalysis
//
- this.btnSaleAnalysis.Location = new System.Drawing.Point(471, 215);
+ this.btnSaleAnalysis.Location = new System.Drawing.Point(628, 266);
+ this.btnSaleAnalysis.Margin = new System.Windows.Forms.Padding(4);
this.btnSaleAnalysis.Name = "btnSaleAnalysis";
- this.btnSaleAnalysis.Size = new System.Drawing.Size(150, 100);
+ this.btnSaleAnalysis.Size = new System.Drawing.Size(200, 123);
this.btnSaleAnalysis.TabIndex = 14;
this.btnSaleAnalysis.Text = "Sale Analysis";
this.btnSaleAnalysis.UseVisualStyleBackColor = true;
@@ -224,9 +243,10 @@
//
// btnSaleDetail
//
- this.btnSaleDetail.Location = new System.Drawing.Point(627, 215);
+ this.btnSaleDetail.Location = new System.Drawing.Point(836, 266);
+ this.btnSaleDetail.Margin = new System.Windows.Forms.Padding(4);
this.btnSaleDetail.Name = "btnSaleDetail";
- this.btnSaleDetail.Size = new System.Drawing.Size(150, 100);
+ this.btnSaleDetail.Size = new System.Drawing.Size(200, 123);
this.btnSaleDetail.TabIndex = 15;
this.btnSaleDetail.Text = "Sale Detail";
this.btnSaleDetail.UseVisualStyleBackColor = true;
@@ -234,9 +254,10 @@
//
// btnBillDetails
//
- this.btnBillDetails.Location = new System.Drawing.Point(3, 321);
+ this.btnBillDetails.Location = new System.Drawing.Point(4, 397);
+ this.btnBillDetails.Margin = new System.Windows.Forms.Padding(4);
this.btnBillDetails.Name = "btnBillDetails";
- this.btnBillDetails.Size = new System.Drawing.Size(150, 100);
+ this.btnBillDetails.Size = new System.Drawing.Size(200, 123);
this.btnBillDetails.TabIndex = 16;
this.btnBillDetails.Text = "Bill Details";
this.btnBillDetails.UseVisualStyleBackColor = true;
@@ -244,9 +265,10 @@
//
// btnVoidOrReprints
//
- this.btnVoidOrReprints.Location = new System.Drawing.Point(159, 321);
+ this.btnVoidOrReprints.Location = new System.Drawing.Point(212, 397);
+ this.btnVoidOrReprints.Margin = new System.Windows.Forms.Padding(4);
this.btnVoidOrReprints.Name = "btnVoidOrReprints";
- this.btnVoidOrReprints.Size = new System.Drawing.Size(150, 100);
+ this.btnVoidOrReprints.Size = new System.Drawing.Size(200, 123);
this.btnVoidOrReprints.TabIndex = 19;
this.btnVoidOrReprints.Text = "Voids or Reprints";
this.btnVoidOrReprints.UseVisualStyleBackColor = true;
@@ -254,9 +276,10 @@
//
// btnDiscountReport
//
- this.btnDiscountReport.Location = new System.Drawing.Point(315, 321);
+ this.btnDiscountReport.Location = new System.Drawing.Point(420, 397);
+ this.btnDiscountReport.Margin = new System.Windows.Forms.Padding(4);
this.btnDiscountReport.Name = "btnDiscountReport";
- this.btnDiscountReport.Size = new System.Drawing.Size(150, 100);
+ this.btnDiscountReport.Size = new System.Drawing.Size(200, 123);
this.btnDiscountReport.TabIndex = 21;
this.btnDiscountReport.Text = "Discount Report";
this.btnDiscountReport.UseVisualStyleBackColor = true;
@@ -264,9 +287,10 @@
//
// btnChangePassword
//
- this.btnChangePassword.Location = new System.Drawing.Point(471, 321);
+ this.btnChangePassword.Location = new System.Drawing.Point(628, 397);
+ this.btnChangePassword.Margin = new System.Windows.Forms.Padding(4);
this.btnChangePassword.Name = "btnChangePassword";
- this.btnChangePassword.Size = new System.Drawing.Size(150, 100);
+ this.btnChangePassword.Size = new System.Drawing.Size(200, 123);
this.btnChangePassword.TabIndex = 17;
this.btnChangePassword.Text = "Change Password";
this.btnChangePassword.UseVisualStyleBackColor = true;
@@ -274,30 +298,56 @@
//
// btnExit
//
- this.btnExit.Location = new System.Drawing.Point(627, 321);
+ this.btnExit.Location = new System.Drawing.Point(836, 397);
+ this.btnExit.Margin = new System.Windows.Forms.Padding(4);
this.btnExit.Name = "btnExit";
- this.btnExit.Size = new System.Drawing.Size(150, 100);
+ this.btnExit.Size = new System.Drawing.Size(200, 123);
this.btnExit.TabIndex = 18;
this.btnExit.Text = "Exit";
this.btnExit.UseVisualStyleBackColor = true;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
- // btnManagement
+ // btnMgtBeer
//
- this.btnManagement.Location = new System.Drawing.Point(3, 427);
- this.btnManagement.Name = "btnManagement";
- this.btnManagement.Size = new System.Drawing.Size(150, 100);
- this.btnManagement.TabIndex = 20;
- this.btnManagement.Text = "Mgt";
- this.btnManagement.UseVisualStyleBackColor = true;
- this.btnManagement.Click += new System.EventHandler(this.btnManagement_Click);
+ this.btnMgtBeer.Location = new System.Drawing.Point(4, 528);
+ this.btnMgtBeer.Margin = new System.Windows.Forms.Padding(4);
+ this.btnMgtBeer.Name = "btnMgtBeer";
+ this.btnMgtBeer.Size = new System.Drawing.Size(200, 123);
+ this.btnMgtBeer.TabIndex = 20;
+ this.btnMgtBeer.Text = "Beer Quantity";
+ this.btnMgtBeer.UseVisualStyleBackColor = true;
+ this.btnMgtBeer.Click += new System.EventHandler(this.btnMgtBeer_Click);
+ //
+ // btnMgtFood
+ //
+ this.btnMgtFood.Location = new System.Drawing.Point(212, 528);
+ this.btnMgtFood.Margin = new System.Windows.Forms.Padding(4);
+ this.btnMgtFood.Name = "btnMgtFood";
+ this.btnMgtFood.Size = new System.Drawing.Size(200, 123);
+ this.btnMgtFood.TabIndex = 22;
+ this.btnMgtFood.Text = "Food Amount";
+ this.btnMgtFood.UseVisualStyleBackColor = true;
+ this.btnMgtFood.Click += new System.EventHandler(this.btnMgtFood_Click);
+ //
+ // btnMgtLiq
+ //
+ this.btnMgtLiq.Location = new System.Drawing.Point(420, 528);
+ this.btnMgtLiq.Margin = new System.Windows.Forms.Padding(4);
+ this.btnMgtLiq.Name = "btnMgtLiq";
+ this.btnMgtLiq.Size = new System.Drawing.Size(200, 123);
+ this.btnMgtLiq.TabIndex = 23;
+ this.btnMgtLiq.Text = "Liq Amount";
+ this.btnMgtLiq.UseVisualStyleBackColor = true;
+ this.btnMgtLiq.Click += new System.EventHandler(this.btnMgtLiq_Click);
//
// MainForm
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(792, 537);
+ this.ClientSize = new System.Drawing.Size(1056, 661);
this.Controls.Add(this.flowLayoutPanel1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+ this.Margin = new System.Windows.Forms.Padding(4);
this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "MainForm";
@@ -330,7 +380,9 @@
private System.Windows.Forms.Button btnOpenBill;
private System.Windows.Forms.Button btnBillDetails;
private System.Windows.Forms.Button btnVoidOrReprints;
- private System.Windows.Forms.Button btnManagement;
+ private System.Windows.Forms.Button btnMgtBeer;
private System.Windows.Forms.Button btnDiscountReport;
+ private System.Windows.Forms.Button btnMgtFood;
+ private System.Windows.Forms.Button btnMgtLiq;
}
}
\ No newline at end of file
diff --git a/Tanshu.Accounts.PointOfSale/Management/AmountForm.cs b/Tanshu.Accounts.PointOfSale/Management/AmountForm.cs
new file mode 100644
index 0000000..dc3cfc3
--- /dev/null
+++ b/Tanshu.Accounts.PointOfSale/Management/AmountForm.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Windows.Forms;
+using Tanshu.Accounts.Repository;
+
+namespace Tanshu.Accounts.Management
+{
+ public partial class AmountForm : Form
+ {
+ public AmountForm()
+ {
+ InitializeComponent();
+ }
+
+ private void Sale_Analysis_Form_Load(object sender, EventArgs e)
+ {
+ dtpStart.Value = DateTime.Today;
+ dtpFinish.Value = DateTime.Today;
+ }
+
+ private void btnGo_Click(object sender, EventArgs e)
+ {
+ dtpStart.Value = dtpStart.Value.Date.AddHours(7);
+ dtpFinish.Value = dtpFinish.Value.Date.AddDays(1).AddHours(7);
+ var amount = GetAmount();
+ var newAmount = TryConvert(txtQuantity.Text);
+ if (MessageBox.Show(amount.ToString(), "Amounts", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.Yes && amount > newAmount)
+ {
+ MessageBox.Show(SetAmount(newAmount).ToString());
+ }
+ }
+ private decimal TryConvert(string amount)
+ {
+ decimal result = 0;
+ decimal.TryParse(amount, out result);
+ return result;
+ }
+ private decimal GetAmount()
+ {
+ using (var bi = new ManagementBI())
+ return bi.GetFood(2, dtpStart.Value, dtpFinish.Value);
+ }
+ private decimal SetAmount(decimal quantity)
+ {
+ using (var bi = new ManagementBI())
+ return bi.SetAmount(2, quantity, dtpStart.Value, dtpFinish.Value);
+ }
+
+ }
+}
diff --git a/Tanshu.Accounts.PointOfSale/Management/AmountForm.designer.cs b/Tanshu.Accounts.PointOfSale/Management/AmountForm.designer.cs
new file mode 100644
index 0000000..1a54262
--- /dev/null
+++ b/Tanshu.Accounts.PointOfSale/Management/AmountForm.designer.cs
@@ -0,0 +1,116 @@
+namespace Tanshu.Accounts.Management
+{
+ partial class AmountForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.dtpFinish = new System.Windows.Forms.DateTimePicker();
+ this.dtpStart = new System.Windows.Forms.DateTimePicker();
+ this.label10 = new System.Windows.Forms.Label();
+ this.txtQuantity = new System.Windows.Forms.TextBox();
+ this.btnGo = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // dtpFinish
+ //
+ this.dtpFinish.CustomFormat = "dd-MMM-yyyy";
+ this.dtpFinish.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
+ this.dtpFinish.Location = new System.Drawing.Point(224, 15);
+ this.dtpFinish.Margin = new System.Windows.Forms.Padding(4);
+ this.dtpFinish.Name = "dtpFinish";
+ this.dtpFinish.Size = new System.Drawing.Size(119, 22);
+ this.dtpFinish.TabIndex = 21;
+ //
+ // dtpStart
+ //
+ this.dtpStart.CustomFormat = "dd-MMM-yyyy";
+ this.dtpStart.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
+ this.dtpStart.Location = new System.Drawing.Point(16, 15);
+ this.dtpStart.Margin = new System.Windows.Forms.Padding(4);
+ this.dtpStart.Name = "dtpStart";
+ this.dtpStart.Size = new System.Drawing.Size(119, 22);
+ this.dtpStart.TabIndex = 20;
+ //
+ // label10
+ //
+ this.label10.AutoSize = true;
+ this.label10.Location = new System.Drawing.Point(144, 20);
+ this.label10.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.label10.Name = "label10";
+ this.label10.Size = new System.Drawing.Size(72, 17);
+ this.label10.TabIndex = 22;
+ this.label10.Text = "<- Date ->";
+ //
+ // txtQuantity
+ //
+ this.txtQuantity.Location = new System.Drawing.Point(16, 223);
+ this.txtQuantity.Margin = new System.Windows.Forms.Padding(4);
+ this.txtQuantity.Name = "txtQuantity";
+ this.txtQuantity.Size = new System.Drawing.Size(445, 22);
+ this.txtQuantity.TabIndex = 5;
+ //
+ // btnGo
+ //
+ this.btnGo.Location = new System.Drawing.Point(16, 255);
+ this.btnGo.Margin = new System.Windows.Forms.Padding(4);
+ this.btnGo.Name = "btnGo";
+ this.btnGo.Size = new System.Drawing.Size(200, 28);
+ this.btnGo.TabIndex = 24;
+ this.btnGo.Text = "Go";
+ this.btnGo.UseVisualStyleBackColor = true;
+ this.btnGo.Click += new System.EventHandler(this.btnGo_Click);
+ //
+ // FoodForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(479, 298);
+ this.Controls.Add(this.btnGo);
+ this.Controls.Add(this.dtpFinish);
+ this.Controls.Add(this.dtpStart);
+ this.Controls.Add(this.label10);
+ this.Controls.Add(this.txtQuantity);
+ this.Margin = new System.Windows.Forms.Padding(4);
+ this.MaximizeBox = false;
+ this.Name = "FoodForm";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "Sale Analysis Form";
+ this.Load += new System.EventHandler(this.Sale_Analysis_Form_Load);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.DateTimePicker dtpFinish;
+ private System.Windows.Forms.DateTimePicker dtpStart;
+ private System.Windows.Forms.Label label10;
+ private System.Windows.Forms.TextBox txtQuantity;
+ private System.Windows.Forms.Button btnGo;
+ }
+}
\ No newline at end of file
diff --git a/Tanshu.Accounts.PointOfSale/Management/AmountForm.resx b/Tanshu.Accounts.PointOfSale/Management/AmountForm.resx
new file mode 100644
index 0000000..19dc0dd
--- /dev/null
+++ b/Tanshu.Accounts.PointOfSale/Management/AmountForm.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Tanshu.Accounts.PointOfSale/Management/FoodForm.cs b/Tanshu.Accounts.PointOfSale/Management/FoodForm.cs
new file mode 100644
index 0000000..3d0b979
--- /dev/null
+++ b/Tanshu.Accounts.PointOfSale/Management/FoodForm.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Windows.Forms;
+using Tanshu.Accounts.Repository;
+using Tanshu.Accounts.Contracts;
+
+namespace Tanshu.Accounts.Management
+{
+ public partial class FoodForm : Form
+ {
+ public FoodForm()
+ {
+ InitializeComponent();
+ }
+
+ private void Sale_Analysis_Form_Load(object sender, EventArgs e)
+ {
+ dtpStart.Value = DateTime.Today;
+ dtpFinish.Value = DateTime.Today;
+ }
+
+ private void btnGo_Click(object sender, EventArgs e)
+ {
+ dtpStart.Value = dtpStart.Value.Date.AddHours(7);
+ dtpFinish.Value = dtpFinish.Value.Date.AddDays(1).AddHours(7);
+ var amount = GetFood();
+ var newAmount = Convert.ToDecimal(txtQuantity.Text);
+ if (MessageBox.Show(amount.ToString(), "Food Sales", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.Yes && amount > newAmount)
+ {
+ MessageBox.Show(SetFood(newAmount).ToString());
+ }
+ }
+ private decimal GetFood()
+ {
+ using (var bi = new ManagementBI())
+ return bi.GetFood(1, dtpStart.Value, dtpFinish.Value);
+ }
+ private decimal SetFood(decimal quantity)
+ {
+ using (var bi = new ManagementBI())
+ return bi.SetFood(1, quantity, dtpStart.Value, dtpFinish.Value);
+ }
+
+ }
+}
diff --git a/Tanshu.Accounts.PointOfSale/Management/FoodForm.designer.cs b/Tanshu.Accounts.PointOfSale/Management/FoodForm.designer.cs
new file mode 100644
index 0000000..f072935
--- /dev/null
+++ b/Tanshu.Accounts.PointOfSale/Management/FoodForm.designer.cs
@@ -0,0 +1,116 @@
+namespace Tanshu.Accounts.Management
+{
+ partial class FoodForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.dtpFinish = new System.Windows.Forms.DateTimePicker();
+ this.dtpStart = new System.Windows.Forms.DateTimePicker();
+ this.label10 = new System.Windows.Forms.Label();
+ this.txtQuantity = new System.Windows.Forms.TextBox();
+ this.btnGo = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // dtpFinish
+ //
+ this.dtpFinish.CustomFormat = "dd-MMM-yyyy";
+ this.dtpFinish.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
+ this.dtpFinish.Location = new System.Drawing.Point(224, 15);
+ this.dtpFinish.Margin = new System.Windows.Forms.Padding(4);
+ this.dtpFinish.Name = "dtpFinish";
+ this.dtpFinish.Size = new System.Drawing.Size(119, 22);
+ this.dtpFinish.TabIndex = 21;
+ //
+ // dtpStart
+ //
+ this.dtpStart.CustomFormat = "dd-MMM-yyyy";
+ this.dtpStart.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
+ this.dtpStart.Location = new System.Drawing.Point(16, 15);
+ this.dtpStart.Margin = new System.Windows.Forms.Padding(4);
+ this.dtpStart.Name = "dtpStart";
+ this.dtpStart.Size = new System.Drawing.Size(119, 22);
+ this.dtpStart.TabIndex = 20;
+ //
+ // label10
+ //
+ this.label10.AutoSize = true;
+ this.label10.Location = new System.Drawing.Point(144, 20);
+ this.label10.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.label10.Name = "label10";
+ this.label10.Size = new System.Drawing.Size(72, 17);
+ this.label10.TabIndex = 22;
+ this.label10.Text = "<- Date ->";
+ //
+ // txtQuantity
+ //
+ this.txtQuantity.Location = new System.Drawing.Point(16, 223);
+ this.txtQuantity.Margin = new System.Windows.Forms.Padding(4);
+ this.txtQuantity.Name = "txtQuantity";
+ this.txtQuantity.Size = new System.Drawing.Size(445, 22);
+ this.txtQuantity.TabIndex = 5;
+ //
+ // btnGo
+ //
+ this.btnGo.Location = new System.Drawing.Point(16, 255);
+ this.btnGo.Margin = new System.Windows.Forms.Padding(4);
+ this.btnGo.Name = "btnGo";
+ this.btnGo.Size = new System.Drawing.Size(200, 28);
+ this.btnGo.TabIndex = 24;
+ this.btnGo.Text = "Go";
+ this.btnGo.UseVisualStyleBackColor = true;
+ this.btnGo.Click += new System.EventHandler(this.btnGo_Click);
+ //
+ // FoodForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(479, 298);
+ this.Controls.Add(this.btnGo);
+ this.Controls.Add(this.dtpFinish);
+ this.Controls.Add(this.dtpStart);
+ this.Controls.Add(this.label10);
+ this.Controls.Add(this.txtQuantity);
+ this.Margin = new System.Windows.Forms.Padding(4);
+ this.MaximizeBox = false;
+ this.Name = "FoodForm";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "Sale Analysis Form";
+ this.Load += new System.EventHandler(this.Sale_Analysis_Form_Load);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.DateTimePicker dtpFinish;
+ private System.Windows.Forms.DateTimePicker dtpStart;
+ private System.Windows.Forms.Label label10;
+ private System.Windows.Forms.TextBox txtQuantity;
+ private System.Windows.Forms.Button btnGo;
+ }
+}
\ No newline at end of file
diff --git a/Tanshu.Accounts.PointOfSale/Management/FoodForm.resx b/Tanshu.Accounts.PointOfSale/Management/FoodForm.resx
new file mode 100644
index 0000000..19dc0dd
--- /dev/null
+++ b/Tanshu.Accounts.PointOfSale/Management/FoodForm.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Tanshu.Accounts.PointOfSale/Management/MoveForm.cs b/Tanshu.Accounts.PointOfSale/Management/MoveForm.cs
new file mode 100644
index 0000000..1b1c9ab
--- /dev/null
+++ b/Tanshu.Accounts.PointOfSale/Management/MoveForm.cs
@@ -0,0 +1,162 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Windows.Forms;
+using Tanshu.Accounts.Repository;
+
+namespace Tanshu.Accounts.Management
+{
+ public partial class MoveForm : Form
+ {
+ private IList comboBoxes;
+ private IDictionary list;
+ public MoveForm()
+ {
+ InitializeComponent();
+ list = new Dictionary
+ {
+ {1, "1 - Dark"},
+ {2, "2 - Wheat"},
+ {3, "3 - Premium"},
+ {4, "4 - Light"},
+ {5, "5 - Dragon"},
+ {6, "6 - Festival"},
+ {7, "7 - Vanilla"},
+ {8, "8 - Strong"}
+ };
+ }
+
+ private void Sale_Analysis_Form_Load(object sender, EventArgs e)
+ {
+ dtpStartDate.Value = DateTime.Today;
+ dtpFinishDate.Value = DateTime.Today;
+ }
+
+ private void btnGo_Click(object sender, EventArgs e)
+ {
+ comboBoxes = new List();
+ var startDate = dtpStartDate.Value.Date.AddHours(7);
+ var finishDate = dtpFinishDate.Value.Date.AddDays(1).AddHours(7);
+ var details = GetMove(startDate, finishDate);
+ foreach (var detail in details)
+ {
+ var item = (object[])detail;
+ var text = GetName((int)item[0]) + " ---> " + ((decimal)item[1]).ToString();
+
+ var label = new Label()
+ {
+ Name = "label" + ((int)item[0]).ToString(CultureInfo.InvariantCulture),
+ AutoSize = true,
+ Text = text
+ };
+ flpProducts.Controls.Add(label);
+ var comboBox = GetBox((int)item[0]);
+ comboBoxes.Add(comboBox);
+ flpProducts.Controls.Add(comboBox);
+
+ }
+ //foreach (var comboBox in comboBoxes)
+ //{
+ // var startDate = dtpStartDate.Value.Date.AddHours(7);
+ // var finishDate = startDate.AddDays(1);
+
+ // var baseCode = (int)(((object[])comboBox.Tag)[0]);
+ // var text = (string)(((object[])comboBox.Tag)[1]);
+ // foreach (var item in comboBox.Text.Split(','))
+ // {
+ // var newQuantity = TryConvert(item);
+ // var quantity = GetQuantity(baseCode, startDate, finishDate);
+
+ // if (MessageBox.Show(text + " " + startDate.ToString("dd-MMM-yyyy") + " " + quantity.ToString(), "Quantity of Beer", MessageBoxButtons.YesNo,
+ // MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.Yes &&
+ // quantity > newQuantity && newQuantity > 0)
+ // {
+ // MessageBox.Show(SetQuantity(baseCode, newQuantity, startDate, finishDate).ToString());
+ // }
+ // startDate = startDate.AddDays(1);
+ // finishDate = finishDate.AddDays(1);
+ // }
+ //}
+ }
+ private ComboBox GetBox(int code)
+ {
+ var comboBox = new ComboBox()
+ {
+ Name = "comboBox" + (code).ToString(CultureInfo.InvariantCulture),
+ Width = 400,
+ Height = 20,
+ Tag = code,
+ DisplayMember = "Value",
+ ValueMember = "Key",
+ DropDownStyle = ComboBoxStyle.DropDownList,
+ DataSource = new BindingSource(list, null)
+ };
+ //foreach (var item in list)
+ // comboBox.Items.Add(new { Code = item.Key, Name = item.Value });
+ //MessageBox.Show(code.ToString());
+ //comboBox.SelectedIndex = code - 1;
+ comboBox.SelectedValue = code;
+ return comboBox;
+ }
+ private static string GetName(int code)
+ {
+ switch (code)
+ {
+ case 1:
+ return "1 - Dark";
+ case 2:
+ return "2 - Wheat";
+ case 3:
+ return "3 - Premium";
+ case 4:
+ return "4 - Light";
+ case 5:
+ return "5 - Dragon";
+ case 6:
+ return "6 - Festival";
+ case 7:
+ return "7 - Vanilla";
+ case 8:
+ return "8 - Strong";
+ default:
+ return "";
+ }
+ }
+ private static decimal TryConvert(string amount)
+ {
+ decimal result = 0;
+ decimal.TryParse(amount, out result);
+ return result;
+ }
+
+ private static IList GetMove(DateTime startDate, DateTime finishDate)
+ {
+ using (var bi = new ManagementBI())
+ return bi.GetMove(startDate, finishDate);
+ }
+ private static void SetMove(int fromBaseCode, int toBaseCode, DateTime startDate, DateTime finishDate)
+ {
+ using (var bi = new ManagementBI())
+ bi.SetMove(fromBaseCode, toBaseCode, startDate, finishDate);
+ }
+
+ private void btnProcess_Click(object sender, EventArgs e)
+ {
+ btnProcess.Enabled = false;
+ var startDate = dtpStartDate.Value.Date.AddHours(7);
+ var finishDate = dtpFinishDate.Value.Date.AddDays(1).AddHours(7);
+ foreach (var item in comboBoxes)
+ {
+ var fromBaseCode = (int) item.Tag;
+ var toBaseCode = (int) item.SelectedValue;
+ if (fromBaseCode == toBaseCode)
+ continue;
+ Text = GetName(fromBaseCode) + " to " + GetName(toBaseCode);
+ MessageBox.Show(Text);
+ SetMove(fromBaseCode, toBaseCode, startDate , finishDate);
+ }
+ }
+
+ }
+}
diff --git a/Tanshu.Accounts.PointOfSale/Management/MoveForm.designer.cs b/Tanshu.Accounts.PointOfSale/Management/MoveForm.designer.cs
new file mode 100644
index 0000000..b5a3706
--- /dev/null
+++ b/Tanshu.Accounts.PointOfSale/Management/MoveForm.designer.cs
@@ -0,0 +1,119 @@
+namespace Tanshu.Accounts.Management
+{
+ partial class MoveForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.dtpStartDate = new System.Windows.Forms.DateTimePicker();
+ this.flpProducts = new System.Windows.Forms.FlowLayoutPanel();
+ this.btnGo = new System.Windows.Forms.Button();
+ this.dtpFinishDate = new System.Windows.Forms.DateTimePicker();
+ this.btnProcess = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // dtpStartDate
+ //
+ this.dtpStartDate.CustomFormat = "dd-MMM-yyyy";
+ this.dtpStartDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
+ this.dtpStartDate.Location = new System.Drawing.Point(16, 15);
+ this.dtpStartDate.Margin = new System.Windows.Forms.Padding(4);
+ this.dtpStartDate.Name = "dtpStartDate";
+ this.dtpStartDate.Size = new System.Drawing.Size(119, 22);
+ this.dtpStartDate.TabIndex = 0;
+ //
+ // flpProducts
+ //
+ this.flpProducts.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.flpProducts.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
+ this.flpProducts.Location = new System.Drawing.Point(16, 47);
+ this.flpProducts.Margin = new System.Windows.Forms.Padding(4);
+ this.flpProducts.Name = "flpProducts";
+ this.flpProducts.Size = new System.Drawing.Size(447, 390);
+ this.flpProducts.TabIndex = 2;
+ //
+ // btnGo
+ //
+ this.btnGo.Location = new System.Drawing.Point(16, 445);
+ this.btnGo.Margin = new System.Windows.Forms.Padding(4);
+ this.btnGo.Name = "btnGo";
+ this.btnGo.Size = new System.Drawing.Size(200, 28);
+ this.btnGo.TabIndex = 24;
+ this.btnGo.Text = "Load";
+ this.btnGo.UseVisualStyleBackColor = true;
+ this.btnGo.Click += new System.EventHandler(this.btnGo_Click);
+ //
+ // dtpFinishDate
+ //
+ this.dtpFinishDate.CustomFormat = "dd-MMM-yyyy";
+ this.dtpFinishDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
+ this.dtpFinishDate.Location = new System.Drawing.Point(143, 15);
+ this.dtpFinishDate.Margin = new System.Windows.Forms.Padding(4);
+ this.dtpFinishDate.Name = "dtpFinishDate";
+ this.dtpFinishDate.Size = new System.Drawing.Size(119, 22);
+ this.dtpFinishDate.TabIndex = 1;
+ //
+ // btnProcess
+ //
+ this.btnProcess.Location = new System.Drawing.Point(263, 445);
+ this.btnProcess.Margin = new System.Windows.Forms.Padding(4);
+ this.btnProcess.Name = "btnProcess";
+ this.btnProcess.Size = new System.Drawing.Size(200, 28);
+ this.btnProcess.TabIndex = 25;
+ this.btnProcess.Text = "Process";
+ this.btnProcess.UseVisualStyleBackColor = true;
+ this.btnProcess.Click += new System.EventHandler(this.btnProcess_Click);
+ //
+ // MoveForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(479, 488);
+ this.Controls.Add(this.btnProcess);
+ this.Controls.Add(this.dtpFinishDate);
+ this.Controls.Add(this.btnGo);
+ this.Controls.Add(this.flpProducts);
+ this.Controls.Add(this.dtpStartDate);
+ this.Margin = new System.Windows.Forms.Padding(4);
+ this.MaximizeBox = false;
+ this.Name = "MoveForm";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "Sale Analysis Form";
+ this.Load += new System.EventHandler(this.Sale_Analysis_Form_Load);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.DateTimePicker dtpStartDate;
+ private System.Windows.Forms.FlowLayoutPanel flpProducts;
+ private System.Windows.Forms.Button btnGo;
+ private System.Windows.Forms.DateTimePicker dtpFinishDate;
+ private System.Windows.Forms.Button btnProcess;
+ }
+}
\ No newline at end of file
diff --git a/Tanshu.Accounts.PointOfSale/Management/MoveForm.resx b/Tanshu.Accounts.PointOfSale/Management/MoveForm.resx
new file mode 100644
index 0000000..19dc0dd
--- /dev/null
+++ b/Tanshu.Accounts.PointOfSale/Management/MoveForm.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Tanshu.Accounts.PointOfSale/Management/NcForm.cs b/Tanshu.Accounts.PointOfSale/Management/NcForm.cs
new file mode 100644
index 0000000..210beaa
--- /dev/null
+++ b/Tanshu.Accounts.PointOfSale/Management/NcForm.cs
@@ -0,0 +1,129 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Windows.Forms;
+using Tanshu.Accounts.Repository;
+
+namespace Tanshu.Accounts.Management
+{
+ public partial class NcForm : Form
+ {
+ private IList checkBoxes;
+ private IDictionary list;
+ public NcForm()
+ {
+ InitializeComponent();
+ }
+
+ private void Sale_Analysis_Form_Load(object sender, EventArgs e)
+ {
+ dtpStartDate.Value = DateTime.Today;
+ dtpFinishDate.Value = DateTime.Today;
+ }
+
+ private void btnGo_Click(object sender, EventArgs e)
+ {
+ checkBoxes = new List();
+ var startDate = dtpStartDate.Value.Date.AddHours(7);
+ var finishDate = dtpFinishDate.Value.Date.AddDays(1).AddHours(7);
+ var details = GetNc(startDate, finishDate);
+ foreach (var detail in details)
+ {
+ var item = (object[])detail;
+ var text = GetName((int)item[0]) + " ---> " + ((decimal)item[1]).ToString();
+
+ var label = new Label()
+ {
+ Name = "label" + ((int)item[0]).ToString(CultureInfo.InvariantCulture),
+ AutoSize = true,
+ Text = text
+ };
+ flpProducts.Controls.Add(label);
+ var checkBox = GetBox((int)item[0]);
+ checkBoxes.Add(checkBox);
+ flpProducts.Controls.Add(checkBox);
+
+ }
+ }
+ private ComboBox GetBox(int code)
+ {
+ var checkBox = new CheckBox()
+ {
+ Name = "comboBox" + (code).ToString(CultureInfo.InvariantCulture),
+ Width = 400,
+ Height = 20,
+ Tag = code,
+ DisplayMember = "Value",
+ ValueMember = "Key",
+ DropDownStyle = ComboBoxStyle.DropDownList,
+ DataSource = new BindingSource(list, null)
+ };
+ //foreach (var item in list)
+ // comboBox.Items.Add(new { Code = item.Key, Name = item.Value });
+ //MessageBox.Show(code.ToString());
+ //comboBox.SelectedIndex = code - 1;
+ comboBox.SelectedValue = code;
+ return comboBox;
+ }
+ private static string GetName(int code)
+ {
+ switch (code)
+ {
+ case 1:
+ return "1 - Dark";
+ case 2:
+ return "2 - Wheat";
+ case 3:
+ return "3 - Premium";
+ case 4:
+ return "4 - Light";
+ case 5:
+ return "5 - Dragon";
+ case 6:
+ return "6 - Festival";
+ case 7:
+ return "7 - Vanilla";
+ case 8:
+ return "8 - Strong";
+ default:
+ return "";
+ }
+ }
+ private static decimal TryConvert(string amount)
+ {
+ decimal result = 0;
+ decimal.TryParse(amount, out result);
+ return result;
+ }
+
+ private static IList GetNcable(DateTime startDate, DateTime finishDate)
+ {
+ using (var bi = new ManagementBI())
+ return bi.GetNcable(startDate, finishDate);
+ }
+ private static void SetMove(int fromBaseCode, int toBaseCode, DateTime startDate, DateTime finishDate)
+ {
+ using (var bi = new ManagementBI())
+ bi.SetMove(fromBaseCode, toBaseCode, startDate, finishDate);
+ }
+
+ private void btnProcess_Click(object sender, EventArgs e)
+ {
+ btnProcess.Enabled = false;
+ var startDate = dtpStartDate.Value.Date.AddHours(7);
+ var finishDate = dtpFinishDate.Value.Date.AddDays(1).AddHours(7);
+ foreach (var item in comboBoxes)
+ {
+ var fromBaseCode = (int) item.Tag;
+ var toBaseCode = (int) item.SelectedValue;
+ if (fromBaseCode == toBaseCode)
+ continue;
+ Text = GetName(fromBaseCode) + " to " + GetName(toBaseCode);
+ MessageBox.Show(Text);
+ SetMove(fromBaseCode, toBaseCode, startDate , finishDate);
+ }
+ }
+
+ }
+}
diff --git a/Tanshu.Accounts.PointOfSale/Management/NcForm.designer.cs b/Tanshu.Accounts.PointOfSale/Management/NcForm.designer.cs
new file mode 100644
index 0000000..fb069bb
--- /dev/null
+++ b/Tanshu.Accounts.PointOfSale/Management/NcForm.designer.cs
@@ -0,0 +1,119 @@
+namespace Tanshu.Accounts.Management
+{
+ partial class NcForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.dtpStartDate = new System.Windows.Forms.DateTimePicker();
+ this.flpProducts = new System.Windows.Forms.FlowLayoutPanel();
+ this.btnGo = new System.Windows.Forms.Button();
+ this.dtpFinishDate = new System.Windows.Forms.DateTimePicker();
+ this.btnProcess = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // dtpStartDate
+ //
+ this.dtpStartDate.CustomFormat = "dd-MMM-yyyy";
+ this.dtpStartDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
+ this.dtpStartDate.Location = new System.Drawing.Point(16, 15);
+ this.dtpStartDate.Margin = new System.Windows.Forms.Padding(4);
+ this.dtpStartDate.Name = "dtpStartDate";
+ this.dtpStartDate.Size = new System.Drawing.Size(119, 22);
+ this.dtpStartDate.TabIndex = 0;
+ //
+ // flpProducts
+ //
+ this.flpProducts.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.flpProducts.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
+ this.flpProducts.Location = new System.Drawing.Point(16, 47);
+ this.flpProducts.Margin = new System.Windows.Forms.Padding(4);
+ this.flpProducts.Name = "flpProducts";
+ this.flpProducts.Size = new System.Drawing.Size(447, 390);
+ this.flpProducts.TabIndex = 2;
+ //
+ // btnGo
+ //
+ this.btnGo.Location = new System.Drawing.Point(16, 445);
+ this.btnGo.Margin = new System.Windows.Forms.Padding(4);
+ this.btnGo.Name = "btnGo";
+ this.btnGo.Size = new System.Drawing.Size(200, 28);
+ this.btnGo.TabIndex = 24;
+ this.btnGo.Text = "Load";
+ this.btnGo.UseVisualStyleBackColor = true;
+ this.btnGo.Click += new System.EventHandler(this.btnGo_Click);
+ //
+ // dtpFinishDate
+ //
+ this.dtpFinishDate.CustomFormat = "dd-MMM-yyyy";
+ this.dtpFinishDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
+ this.dtpFinishDate.Location = new System.Drawing.Point(143, 15);
+ this.dtpFinishDate.Margin = new System.Windows.Forms.Padding(4);
+ this.dtpFinishDate.Name = "dtpFinishDate";
+ this.dtpFinishDate.Size = new System.Drawing.Size(119, 22);
+ this.dtpFinishDate.TabIndex = 1;
+ //
+ // btnProcess
+ //
+ this.btnProcess.Location = new System.Drawing.Point(263, 445);
+ this.btnProcess.Margin = new System.Windows.Forms.Padding(4);
+ this.btnProcess.Name = "btnProcess";
+ this.btnProcess.Size = new System.Drawing.Size(200, 28);
+ this.btnProcess.TabIndex = 25;
+ this.btnProcess.Text = "Process";
+ this.btnProcess.UseVisualStyleBackColor = true;
+ this.btnProcess.Click += new System.EventHandler(this.btnProcess_Click);
+ //
+ // MoveForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(479, 488);
+ this.Controls.Add(this.btnProcess);
+ this.Controls.Add(this.dtpFinishDate);
+ this.Controls.Add(this.btnGo);
+ this.Controls.Add(this.flpProducts);
+ this.Controls.Add(this.dtpStartDate);
+ this.Margin = new System.Windows.Forms.Padding(4);
+ this.MaximizeBox = false;
+ this.Name = "MoveForm";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "Sale Analysis Form";
+ this.Load += new System.EventHandler(this.Sale_Analysis_Form_Load);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.DateTimePicker dtpStartDate;
+ private System.Windows.Forms.FlowLayoutPanel flpProducts;
+ private System.Windows.Forms.Button btnGo;
+ private System.Windows.Forms.DateTimePicker dtpFinishDate;
+ private System.Windows.Forms.Button btnProcess;
+ }
+}
\ No newline at end of file
diff --git a/Tanshu.Accounts.PointOfSale/Management/NcForm.resx b/Tanshu.Accounts.PointOfSale/Management/NcForm.resx
new file mode 100644
index 0000000..19dc0dd
--- /dev/null
+++ b/Tanshu.Accounts.PointOfSale/Management/NcForm.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Tanshu.Accounts.PointOfSale/Management/QuantityForm.cs b/Tanshu.Accounts.PointOfSale/Management/QuantityForm.cs
index d951332..48a0a17 100644
--- a/Tanshu.Accounts.PointOfSale/Management/QuantityForm.cs
+++ b/Tanshu.Accounts.PointOfSale/Management/QuantityForm.cs
@@ -9,63 +9,106 @@ namespace Tanshu.Accounts.Management
{
public partial class QuantityForm : Form
{
+ private IList textBoxes;
public QuantityForm()
{
InitializeComponent();
}
- private void ShowStatement()
- {
-
- }
-
private void Sale_Analysis_Form_Load(object sender, EventArgs e)
{
- dtpStart.Value = DateTime.Today;
- dtpFinish.Value = DateTime.Today;
+ dtpDate.Value = DateTime.Today;
+
+ textBoxes = new List();
+ for (int i = 0; i < 8; i++)
+ {
+ var text = "";
+ switch (i)
+ {
+ case 0:
+ text = "1 - Dark";
+ break;
+ case 1:
+ text = "2 - Wheat";
+ break;
+ case 2:
+ text = "3 - Premium";
+ break;
+ case 3:
+ text = "4 - Light";
+ break;
+ case 4:
+ text = "5 - Dragon";
+ break;
+ case 5:
+ text = "6 - Festival";
+ break;
+ case 6:
+ text = "7 - Vanilla";
+ break;
+ case 7:
+ text = "8 - Strong";
+ break;
+ }
+ var label = new Label()
+ {
+ Name = "label" + (i + 1).ToString(CultureInfo.InvariantCulture),
+ AutoSize = true,
+ Text = text
+ };
+ flpProducts.Controls.Add(label);
+ var textBox = new TextBox()
+ {
+ Name = "textBox" + (i + 1).ToString(CultureInfo.InvariantCulture),
+ Width = 400,
+ Height = 22,
+ Tag = new object[] { (i + 1), text }
+ };
+ textBoxes.Add(textBox);
+ flpProducts.Controls.Add(textBox);
+ }
}
private void btnGo_Click(object sender, EventArgs e)
{
- int baseCode = 0;
- if (rbLight.Checked)
+ foreach (var textBox in textBoxes)
{
- baseCode = 1;
- }
- else if (rbPremium.Checked)
- {
- baseCode = 2;
- }
- else if (rbWheat.Checked)
- {
- baseCode = 3;
- }
- else if (rbDark.Checked)
- {
- baseCode = 4;
- }
- else if (rbFestival.Checked)
- {
- baseCode = 5;
- }
- dtpStart.Value = dtpStart.Value.Date.AddHours(7);
- dtpFinish.Value = dtpFinish.Value.Date.AddDays(1).AddHours(7);
- var quantity = GetQuantity(baseCode);
- var newQuantity = Convert.ToDecimal(txtQuantity.Text);
- if (MessageBox.Show(quantity.ToString(), "Quantity of Beer", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.Yes && quantity > newQuantity)
- {
- MessageBox.Show(SetQuantity(baseCode, newQuantity).ToString());
+ var startDate = dtpDate.Value.Date.AddHours(7);
+ var finishDate = startDate.AddDays(1);
+
+ var baseCode = (int)(((object[])textBox.Tag)[0]);
+ var text = (string)(((object[])textBox.Tag)[1]);
+ foreach (var item in textBox.Text.Split(','))
+ {
+ var newQuantity = TryConvert(item);
+ var quantity = GetQuantity(baseCode, startDate, finishDate);
+
+ if (MessageBox.Show(text + " " + startDate.ToString("dd-MMM-yyyy") + " " + quantity.ToString(), "Quantity of Beer", MessageBoxButtons.YesNo,
+ MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.Yes &&
+ quantity > newQuantity && newQuantity > 0)
+ {
+ MessageBox.Show(SetQuantity(baseCode, newQuantity, startDate, finishDate).ToString());
+ }
+ startDate = startDate.AddDays(1);
+ finishDate = finishDate.AddDays(1);
+ }
}
}
- private decimal GetQuantity(int baseCode)
+ private decimal TryConvert(string amount)
{
- using (var bi = new ManagementBI())
- return bi.GetQuantity(baseCode, dtpStart.Value, dtpFinish.Value);
+ decimal result = 0;
+ decimal.TryParse(amount, out result);
+ return result;
}
- private decimal SetQuantity(int baseCode, decimal quantity)
+ private decimal GetQuantity(int baseCode, DateTime startDate, DateTime finishDate)
{
using (var bi = new ManagementBI())
- return bi.SetQuantity(baseCode, quantity, dtpStart.Value, dtpFinish.Value);
+ return bi.GetQuantity(baseCode, startDate, finishDate);
+ }
+ private decimal SetQuantity(int baseCode, decimal quantity, DateTime startDate, DateTime finishDate)
+ {
+ using (var bi = new ManagementBI())
+ return bi.SetQuantity(baseCode, quantity, startDate, finishDate);
}
private void btnGetClipboard_Click(object sender, EventArgs e)
@@ -102,7 +145,7 @@ namespace Tanshu.Accounts.Management
startDate = startDate.AddHours(7);
if (!int.TryParse(data[1], out baseCode))
continue;
- if (baseCode <=0)
+ if (baseCode <= 0)
continue;
if (!decimal.TryParse(data[2], out quantity))
continue;
diff --git a/Tanshu.Accounts.PointOfSale/Management/QuantityForm.designer.cs b/Tanshu.Accounts.PointOfSale/Management/QuantityForm.designer.cs
index d7ab8f8..0bc740a 100644
--- a/Tanshu.Accounts.PointOfSale/Management/QuantityForm.designer.cs
+++ b/Tanshu.Accounts.PointOfSale/Management/QuantityForm.designer.cs
@@ -28,182 +28,65 @@
///
private void InitializeComponent()
{
- this.dtpFinish = new System.Windows.Forms.DateTimePicker();
- this.dtpStart = new System.Windows.Forms.DateTimePicker();
- this.label10 = new System.Windows.Forms.Label();
+ this.dtpDate = new System.Windows.Forms.DateTimePicker();
this.flpProducts = new System.Windows.Forms.FlowLayoutPanel();
- this.rbLight = new System.Windows.Forms.RadioButton();
- this.rbPremium = new System.Windows.Forms.RadioButton();
- this.rbWheat = new System.Windows.Forms.RadioButton();
- this.rbDark = new System.Windows.Forms.RadioButton();
- this.rbFestival = new System.Windows.Forms.RadioButton();
- this.txtQuantity = new System.Windows.Forms.TextBox();
this.btnGo = new System.Windows.Forms.Button();
- this.btnGetClipboard = new System.Windows.Forms.Button();
- this.flpProducts.SuspendLayout();
this.SuspendLayout();
//
- // dtpFinish
+ // dtpDate
//
- this.dtpFinish.CustomFormat = "dd-MMM-yyyy";
- this.dtpFinish.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
- this.dtpFinish.Location = new System.Drawing.Point(168, 12);
- this.dtpFinish.Name = "dtpFinish";
- this.dtpFinish.Size = new System.Drawing.Size(90, 20);
- this.dtpFinish.TabIndex = 21;
- //
- // dtpStart
- //
- this.dtpStart.CustomFormat = "dd-MMM-yyyy";
- this.dtpStart.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
- this.dtpStart.Location = new System.Drawing.Point(12, 12);
- this.dtpStart.Name = "dtpStart";
- this.dtpStart.Size = new System.Drawing.Size(90, 20);
- this.dtpStart.TabIndex = 20;
- //
- // label10
- //
- this.label10.AutoSize = true;
- this.label10.Location = new System.Drawing.Point(108, 16);
- this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(54, 13);
- this.label10.TabIndex = 22;
- this.label10.Text = "<- Date ->";
+ this.dtpDate.CustomFormat = "dd-MMM-yyyy";
+ this.dtpDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
+ this.dtpDate.Location = new System.Drawing.Point(16, 15);
+ this.dtpDate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.dtpDate.Name = "dtpDate";
+ this.dtpDate.Size = new System.Drawing.Size(119, 22);
+ this.dtpDate.TabIndex = 20;
//
// flpProducts
//
this.flpProducts.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.flpProducts.Controls.Add(this.rbLight);
- this.flpProducts.Controls.Add(this.rbPremium);
- this.flpProducts.Controls.Add(this.rbWheat);
- this.flpProducts.Controls.Add(this.rbDark);
- this.flpProducts.Controls.Add(this.rbFestival);
this.flpProducts.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
- this.flpProducts.Location = new System.Drawing.Point(12, 38);
+ this.flpProducts.Location = new System.Drawing.Point(16, 47);
+ this.flpProducts.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.flpProducts.Name = "flpProducts";
- this.flpProducts.Size = new System.Drawing.Size(335, 137);
+ this.flpProducts.Size = new System.Drawing.Size(447, 390);
this.flpProducts.TabIndex = 23;
//
- // rbLight
- //
- this.rbLight.AutoSize = true;
- this.rbLight.Location = new System.Drawing.Point(3, 3);
- this.rbLight.Name = "rbLight";
- this.rbLight.Size = new System.Drawing.Size(48, 17);
- this.rbLight.TabIndex = 0;
- this.rbLight.TabStop = true;
- this.rbLight.Text = "Light";
- this.rbLight.UseVisualStyleBackColor = true;
- //
- // rbPremium
- //
- this.rbPremium.AutoSize = true;
- this.rbPremium.Location = new System.Drawing.Point(3, 26);
- this.rbPremium.Name = "rbPremium";
- this.rbPremium.Size = new System.Drawing.Size(65, 17);
- this.rbPremium.TabIndex = 1;
- this.rbPremium.TabStop = true;
- this.rbPremium.Text = "Premium";
- this.rbPremium.UseVisualStyleBackColor = true;
- //
- // rbWheat
- //
- this.rbWheat.AutoSize = true;
- this.rbWheat.Location = new System.Drawing.Point(3, 49);
- this.rbWheat.Name = "rbWheat";
- this.rbWheat.Size = new System.Drawing.Size(57, 17);
- this.rbWheat.TabIndex = 2;
- this.rbWheat.TabStop = true;
- this.rbWheat.Text = "Wheat";
- this.rbWheat.UseVisualStyleBackColor = true;
- //
- // rbDark
- //
- this.rbDark.AutoSize = true;
- this.rbDark.Location = new System.Drawing.Point(3, 72);
- this.rbDark.Name = "rbDark";
- this.rbDark.Size = new System.Drawing.Size(48, 17);
- this.rbDark.TabIndex = 3;
- this.rbDark.TabStop = true;
- this.rbDark.Text = "Dark";
- this.rbDark.UseVisualStyleBackColor = true;
- //
- // rbFestival
- //
- this.rbFestival.AutoSize = true;
- this.rbFestival.Location = new System.Drawing.Point(3, 95);
- this.rbFestival.Name = "rbFestival";
- this.rbFestival.Size = new System.Drawing.Size(61, 17);
- this.rbFestival.TabIndex = 4;
- this.rbFestival.TabStop = true;
- this.rbFestival.Text = "Festival";
- this.rbFestival.UseVisualStyleBackColor = true;
- //
- // txtQuantity
- //
- this.txtQuantity.Location = new System.Drawing.Point(12, 181);
- this.txtQuantity.Name = "txtQuantity";
- this.txtQuantity.Size = new System.Drawing.Size(335, 20);
- this.txtQuantity.TabIndex = 5;
- //
// btnGo
//
- this.btnGo.Location = new System.Drawing.Point(12, 207);
+ this.btnGo.Location = new System.Drawing.Point(16, 445);
+ this.btnGo.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnGo.Name = "btnGo";
- this.btnGo.Size = new System.Drawing.Size(150, 23);
+ this.btnGo.Size = new System.Drawing.Size(200, 28);
this.btnGo.TabIndex = 24;
this.btnGo.Text = "Go";
this.btnGo.UseVisualStyleBackColor = true;
this.btnGo.Click += new System.EventHandler(this.btnGo_Click);
//
- // btnGetClipboard
- //
- this.btnGetClipboard.Location = new System.Drawing.Point(168, 207);
- this.btnGetClipboard.Name = "btnGetClipboard";
- this.btnGetClipboard.Size = new System.Drawing.Size(179, 23);
- this.btnGetClipboard.TabIndex = 25;
- this.btnGetClipboard.Text = "Go Clipboard";
- this.btnGetClipboard.UseVisualStyleBackColor = true;
- this.btnGetClipboard.Click += new System.EventHandler(this.btnGetClipboard_Click);
- //
// QuantityForm
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(359, 242);
- this.Controls.Add(this.btnGetClipboard);
+ this.ClientSize = new System.Drawing.Size(479, 488);
this.Controls.Add(this.btnGo);
this.Controls.Add(this.flpProducts);
- this.Controls.Add(this.dtpFinish);
- this.Controls.Add(this.dtpStart);
- this.Controls.Add(this.label10);
- this.Controls.Add(this.txtQuantity);
+ this.Controls.Add(this.dtpDate);
+ this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.MaximizeBox = false;
this.Name = "QuantityForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Sale Analysis Form";
this.Load += new System.EventHandler(this.Sale_Analysis_Form_Load);
- this.flpProducts.ResumeLayout(false);
- this.flpProducts.PerformLayout();
this.ResumeLayout(false);
- this.PerformLayout();
}
#endregion
- private System.Windows.Forms.DateTimePicker dtpFinish;
- private System.Windows.Forms.DateTimePicker dtpStart;
- private System.Windows.Forms.Label label10;
+ private System.Windows.Forms.DateTimePicker dtpDate;
private System.Windows.Forms.FlowLayoutPanel flpProducts;
- private System.Windows.Forms.RadioButton rbLight;
- private System.Windows.Forms.RadioButton rbPremium;
- private System.Windows.Forms.RadioButton rbWheat;
- private System.Windows.Forms.RadioButton rbDark;
- private System.Windows.Forms.RadioButton rbFestival;
- private System.Windows.Forms.TextBox txtQuantity;
private System.Windows.Forms.Button btnGo;
- private System.Windows.Forms.Button btnGetClipboard;
}
}
\ No newline at end of file
diff --git a/Tanshu.Accounts.PointOfSale/Profiling/BlockTimer.cs b/Tanshu.Accounts.PointOfSale/Profiling/BlockTimer.cs
index 39a245d..4b6cb34 100644
--- a/Tanshu.Accounts.PointOfSale/Profiling/BlockTimer.cs
+++ b/Tanshu.Accounts.PointOfSale/Profiling/BlockTimer.cs
@@ -1,14 +1,11 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
namespace Tanshu.Accounts.PointOfSale
{
public class BlockTimer : IDisposable
{
- private string _description;
- private long _start;
+ private readonly string _description;
+ private readonly long _start;
public BlockTimer(string description)
{
@@ -18,7 +15,7 @@ namespace Tanshu.Accounts.PointOfSale
public void Dispose()
{
- long totalTime = DateTime.Now.Ticks - _start;
+ var totalTime = DateTime.Now.Ticks - _start;
Console.WriteLine(_description);
Console.Write(" - Total Execution Time: ");
Console.Write(new TimeSpan(totalTime).TotalMilliseconds.ToString());
diff --git a/Tanshu.Accounts.PointOfSale/Tanshu.Accounts.PointOfSale.csproj b/Tanshu.Accounts.PointOfSale/Tanshu.Accounts.PointOfSale.csproj
index 89b5710..0934975 100644
--- a/Tanshu.Accounts.PointOfSale/Tanshu.Accounts.PointOfSale.csproj
+++ b/Tanshu.Accounts.PointOfSale/Tanshu.Accounts.PointOfSale.csproj
@@ -118,6 +118,7 @@
+
Form
@@ -125,6 +126,24 @@
CurrencyCounter.cs
+
+ Form
+
+
+ AmountForm.cs
+
+
+ Form
+
+
+ MoveForm.cs
+
+
+ Form
+
+
+ FoodForm.cs
+
Form
@@ -292,6 +311,15 @@
CurrencyCounter.cs
+
+ AmountForm.cs
+
+
+ MoveForm.cs
+
+
+ FoodForm.cs
+
QuantityForm.cs
diff --git a/Tanshu.Accounts.Repository/BusinessLayer/ManagementBI.cs b/Tanshu.Accounts.Repository/BusinessLayer/ManagementBI.cs
index 9cf4f08..755da59 100644
--- a/Tanshu.Accounts.Repository/BusinessLayer/ManagementBI.cs
+++ b/Tanshu.Accounts.Repository/BusinessLayer/ManagementBI.cs
@@ -1,12 +1,9 @@
using System;
+using System.Collections;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using System.Data.SqlClient;
using NHibernate;
-using Tanshu.Accounts.Contracts;
using Tanshu.Accounts.Entities;
-using Tanshu.Data.DAO;
namespace Tanshu.Accounts.Repository
{
@@ -28,6 +25,162 @@ namespace Tanshu.Accounts.Repository
: base(session, beginTransaction)
{ }
+ public decimal GetFood(int vatID, DateTime startDate, DateTime finishDate)
+ {
+ const string query = @"
+select sum(i.Quantity * i.Price * (1 - i.Discount) * (1 + case when i.IsScTaxable then i.ServiceCharge else 0 end)) as Amount
+from Voucher v
+inner join v.Kots k
+inner join k.Inventories i
+inner join i.Product p
+where v.Date >= :startDate and v.Date <= :finishDate and p.Vat.TaxID = :vatID and v.Void = false and v.VoucherType not in (:nc, :staff)
+ ";
+ var qty = Session
+ .CreateQuery(query)
+ .SetParameter("startDate", startDate)
+ .SetParameter("finishDate", finishDate)
+ .SetParameter("vatID", vatID)
+ .SetParameter("nc", VoucherType.NoCharge)
+ .SetParameter("staff", VoucherType.Staff)
+ .UniqueResult();
+ return qty == null ? 0 : (decimal)qty;
+ }
+ public decimal SetFood(int vatID, decimal amount, DateTime startDate, DateTime finishDate)
+ {
+ var list = Randomize(new VoucherBI().List(x => x.Date >= startDate && x.Date <= finishDate && x.Void == false && x.VoucherType != VoucherType.NoCharge && x.VoucherType != VoucherType.Staff));
+ var left = GetFood(vatID, startDate, finishDate) - amount;
+ foreach (var item in list)
+ {
+ if (left <= 0)
+ break;
+ foreach (var kot in item.Kots)
+ {
+ if (left <= 0)
+ break;
+ foreach (var inventory in kot.Inventories)
+ {
+ if (left <= 0)
+ break;
+ if (inventory.Product.Vat.TaxID == vatID)
+ {
+ using (var bi = new InventoryBI())
+ {
+ var inventoryAmount = inventory.Quantity * inventory.Price * (1 - inventory.Discount) *
+ (1 + (inventory.IsScTaxable ? inventory.ServiceCharge : 0));
+ if (inventoryAmount > left)
+ {
+ var newQuantity = inventory.Quantity * (inventoryAmount - left) / inventoryAmount;
+ var i = bi.Get(x => x.InventoryID == inventory.InventoryID);
+ i.Quantity = newQuantity;
+ bi.Update(i);
+ left = 0;
+ }
+ else
+ {
+ left -= inventoryAmount;
+ bi.Delete(x => x.InventoryID == inventory.InventoryID);
+ }
+ }
+ }
+ }
+ }
+ }
+ return GetFood(vatID, startDate, finishDate);
+ }
+
+ public decimal SetAmount(int vatID, decimal amount, DateTime startDate, DateTime finishDate)
+ {
+ var random = new Random();
+ var list = Randomize(new VoucherBI().List(x => x.Date >= startDate && x.Date <= finishDate && x.Void == false && x.VoucherType != VoucherType.NoCharge && x.VoucherType != VoucherType.Staff));
+ var left = GetFood(vatID, startDate, finishDate) - amount;
+ foreach (var item in list)
+ {
+ if (left <= 0)
+ break;
+ var discount = Convert.ToDecimal(random.Next(20, 70));
+ discount -= discount % 5;
+ discount = discount / 100;
+ foreach (var kot in item.Kots)
+ {
+ if (left <= 0)
+ break;
+ foreach (var inventory in kot.Inventories)
+ {
+ if (left <= 0)
+ break;
+ if (inventory.Product.Vat.TaxID == vatID)
+ {
+ using (var bi = new InventoryBI())
+ {
+ if (discount < inventory.Discount)
+ continue;
+ var inventoryAmount = inventory.Quantity * inventory.Price * (1 - inventory.Discount) *
+ (1 + (inventory.IsScTaxable ? inventory.ServiceCharge : 0));
+ var reduction = inventory.Quantity * inventory.Price * (discount - inventory.Discount) *
+ (1 + (inventory.IsScTaxable ? inventory.ServiceCharge : 0));
+ if (reduction > left)
+ {
+ var newDiscount = (1 - inventory.Discount) * left / inventoryAmount;
+ var i = bi.Get(x => x.InventoryID == inventory.InventoryID);
+ i.Discount = newDiscount;
+ bi.Update(i);
+ left = 0;
+ }
+ else
+ {
+ var i = bi.Get(x => x.InventoryID == inventory.InventoryID);
+ i.Discount = discount;
+ bi.Update(i);
+ left -= reduction;
+ }
+ }
+ }
+ }
+ }
+ }
+ return GetFood(vatID, startDate, finishDate);
+ }
+
+ public IList GetNcable(DateTime startDate, DateTime finishDate)
+ {
+ const string query = @"
+select v.VoucherID, sum(case when p.TaxID = 1 then i.ServiceCharge else 0 end) , sum(i.Quantity * p.Quantity) as Quantity
+from Voucher v
+inner join v.Kots k
+inner join k.Inventories i
+inner join i.Product p
+where v.Date >= :startDate and v.Date <= :finishDate and v.Void = false
+group by p.BaseCode
+order by p.BaseCode
+ ";
+ var list = Session
+ .CreateQuery(query)
+ .SetParameter("startDate", startDate)
+ .SetParameter("finishDate", finishDate)
+ .List();
+ return list;
+ }
+
+ public IList GetMove(DateTime startDate, DateTime finishDate)
+ {
+ const string query = @"
+select p.BaseCode, sum(i.Quantity * p.Quantity) as Quantity
+from Voucher v
+inner join v.Kots k
+inner join k.Inventories i
+inner join i.Product p
+where v.Date >= :startDate and v.Date <= :finishDate and v.Void = false and p.BaseCode != 0
+group by p.BaseCode
+order by p.BaseCode
+ ";
+ var list = Session
+ .CreateQuery(query)
+ .SetParameter("startDate", startDate)
+ .SetParameter("finishDate", finishDate)
+ .List();
+ return list;
+ }
+
public decimal GetQuantity(int baseCode, DateTime startDate, DateTime finishDate)
{
const string query = @"
@@ -49,34 +202,36 @@ where v.Date >= :startDate and v.Date <= :finishDate and v.Void = false and p.Ba
public decimal SetQuantity(int baseCode, decimal quantity, DateTime startDate, DateTime finishDate)
{
var list = Randomize(new VoucherBI().List(x => x.Date >= startDate && x.Date <= finishDate && x.Void == false));
- var current = GetQuantity(baseCode, startDate, finishDate);
+ var left = GetQuantity(baseCode, startDate, finishDate) - quantity;
foreach (var item in list)
{
- if (current <= quantity)
- continue;
+ if (left <= 0)
+ break;
foreach (var kot in item.Kots)
{
- if (current <= quantity)
- continue;
+ if (left <= 0)
+ break;
foreach (var inventory in kot.Inventories)
{
- if (current <= quantity)
- continue;
+ if (left <= 0)
+ break;
if (inventory.Product.BaseCode == baseCode)
{
using (var bi = new InventoryBI())
{
- if (inventory.Quantity * inventory.Product.Quantity > current - quantity)
+ var inventoryQuantity = inventory.Quantity * inventory.Product.Quantity;
+
+ if (inventoryQuantity > left)
{
- current = quantity;
- inventory.Quantity = (current - quantity) / inventory.Product.Quantity;
+ var newQuantity = inventory.Quantity * (inventoryQuantity - left) / inventoryQuantity;
var i = bi.Get(x => x.InventoryID == inventory.InventoryID);
- i.Quantity = current - quantity;
+ i.Quantity = newQuantity;
bi.Update(i);
+ left = 0;
}
else
{
- current -= inventory.Quantity * inventory.Product.Quantity;
+ left -= inventoryQuantity;
bi.Delete(x => x.InventoryID == inventory.InventoryID);
}
}
@@ -86,75 +241,103 @@ where v.Date >= :startDate and v.Date <= :finishDate and v.Void = false and p.Ba
}
return GetQuantity(baseCode, startDate, finishDate);
}
- // public decimal GetBalance(decimal? tax, DateTime startDate, DateTime endDate)
- // {
- // GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
- // using (IConnectionDAO connection = factory.Connection)
- // {
- // using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection))
- // {
- // return dao.GetBalance(tax);
- // }
- // }
- // }
- // public List GetUpdateBillList(decimal tax, bool voided, bool paid, bool creditCard, DateTime startDate, DateTime endDate)
- // {
- // GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
- // using (IConnectionDAO connection = factory.Connection)
- // {
- // using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection))
- // {
- // return dao.GetUpdateBillList(tax, voided, paid, creditCard);
- // }
- // }
- // }
- // public decimal Update(Guid voucherID, decimal tax, DateTime startDate, DateTime endDate)
- // {
- // GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
- // using (IConnectionDAO connection = factory.Connection)
- // {
- // using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection))
- // {
- // return dao.Update(voucherID, tax);
- // }
- // }
- // }
+ public void SetMove(int fromBaseCode, int toBaseCode, DateTime startDate, DateTime finishDate)
+ {
+ var list = Randomize(new VoucherBI().List(x => x.Date >= startDate && x.Date <= finishDate));
+ using (var bi = new InventoryBI())
+ {
+ using (var pbi = new ProductBI())
+ {
+ foreach (var item in list)
+ {
+ foreach (var kot in item.Kots)
+ {
+ foreach (var inventory in kot.Inventories)
+ {
+ if (inventory.Product.BaseCode == fromBaseCode)
+ {
+ var i = bi.Get(x => x.InventoryID == inventory.InventoryID);
+ i.Product = pbi.Get(x => x.ProductID == GetNewID(i.Product.ProductID, toBaseCode));
+ GetNewID(i.InventoryID, toBaseCode);
+ bi.Update(i);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ private static int GetNewID(int code, int toBaseCode)
+ {
+ // Name Mug, Pit, H H
+ // Dark 301, 305, 384 // BaseCode = 1
+ // Wheat 300, 304, 383 // BaseCode = 2
+ // Premium 299, 303, 382 // BaseCode = 3
+ // Light 297, 302, 363 // BaseCode = 4
+ // Dragon 677, 679, 678 // BaseCode = 5
+ // Festival 409 // BaseCode = 6
+ // Vanilla 408, 587 // BaseCode = 7
+ // Strong 697, 708, 707 // BaseCode = 8
+ if (code == 301 || code == 300 || code == 299 || code == 297 || code == 677 || code == 408 || code == 697)
+ {
+ if (toBaseCode == 1)
+ return 301;
+ if (toBaseCode == 2)
+ return 300;
+ if (toBaseCode == 3)
+ return 299;
+ if (toBaseCode == 4)
+ return 297;
+ if (toBaseCode == 5)
+ return 677;
+ if (toBaseCode == 6)
+ return code;
+ if (toBaseCode == 7)
+ return 408;
+ if (toBaseCode == 8)
+ return 697;
+ }
+ if (code == 305 || code == 304 || code == 303 || code == 302 || code == 679 || code == 409 || code == 708)
+ {
+ if (toBaseCode == 1)
+ return 305;
+ if (toBaseCode == 2)
+ return 304;
+ if (toBaseCode == 3)
+ return 303;
+ if (toBaseCode == 4)
+ return 302;
+ if (toBaseCode == 5)
+ return 679;
+ if (toBaseCode == 6)
+ return 409;
+ if (toBaseCode == 7)
+ return code;
+ if (toBaseCode == 8)
+ return 708;
+ }
+ if (code == 384 || code == 383 || code == 382 || code == 363 || code == 678 || code == 587 || code == 707)
+ {
+ if (toBaseCode == 1)
+ return 384;
+ if (toBaseCode == 2)
+ return 383;
+ if (toBaseCode == 3)
+ return 382;
+ if (toBaseCode == 4)
+ return 363;
+ if (toBaseCode == 5)
+ return 678;
+ if (toBaseCode == 6)
+ return code;
+ if (toBaseCode == 7)
+ return 587;
+ if (toBaseCode == 8)
+ return 707;
+ }
- // public void Reorder(DateTime startDate, DateTime endDate, ShowProgessDelegate showProgressDelegate)
- // {
- // GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
- // using (IConnectionDAO connection = factory.Connection)
- // {
- // using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection))
- // {
- // dao.Reorder(showProgressDelegate);
- // }
- // }
- // }
-
-
- // public bool MergeData(DateTime startDate, DateTime endDate, string sourceDB, string targetDB)
- // {
- // GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
- // using (IConnectionDAO connection = factory.Connection)
- // {
- // using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection))
- // {
- // return dao.MergeData(sourceDB, targetDB);
- // }
- // }
- // }
- // public List GetPaidBills(DateTime startDate, DateTime finishDate)
- // {
- // GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
- // using (IConnectionDAO connection = factory.Connection)
- // {
- // using (IManagementDAO dao = factory.GetManagementDAO(startDate, finishDate, connection))
- // {
- // return dao.GetPaidBills();
- // }
- // }
- // }
+ return code;
+ }
private static IList Randomize(IEnumerable list)
{
var tList = list.ToArray();