diff --git a/Tanshu.Accounts.BI/ManagementBI.cs b/Tanshu.Accounts.BI/ManagementBI.cs index 596f040..fdc9dfb 100644 --- a/Tanshu.Accounts.BI/ManagementBI.cs +++ b/Tanshu.Accounts.BI/ManagementBI.cs @@ -21,14 +21,14 @@ namespace Tanshu.Accounts.BI } } } - public List GetUpdateBillList(decimal tax, bool voided, bool paid, bool creditCard, DateTime startDate, DateTime endDate) + public List GetUpdateBillList(decimal tax, DateTime startDate, DateTime endDate) { var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); using (var connection = factory.Connection) { using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection)) { - return dao.GetUpdateBillList(tax, voided, paid, creditCard); + return dao.GetUpdateBillList(tax); } } } diff --git a/Tanshu.Accounts.BI/SaleVoucherBI.cs b/Tanshu.Accounts.BI/SaleVoucherBI.cs index e77bad5..6729665 100644 --- a/Tanshu.Accounts.BI/SaleVoucherBI.cs +++ b/Tanshu.Accounts.BI/SaleVoucherBI.cs @@ -1,9 +1,7 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; using Tanshu.Accounts.Contracts; using Tanshu.Accounts.DAOFactory; -using Tanshu.Data.DAO; namespace Tanshu.Accounts.BI { @@ -140,6 +138,22 @@ namespace Tanshu.Accounts.BI } } } + public bool GetSaleVoucher(string billID, ref SaleVoucherBO voucherSale, ref List iList) + { + var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); + using (var connection = factory.Connection) + { + using (var svdao = factory.GetSaleVoucherDAO(connection)) + { + using (var idao = factory.GetInventoryDAO(connection)) + { + voucherSale = svdao.GetVoucherSale(billID); + iList = idao.GetInventories(voucherSale.VoucherID); + return true; + } + } + } + } public List GetPendingBills(PendingType list, int floor) { diff --git a/Tanshu.Accounts.Contracts/DAOFactory/ManagementDAO.cs b/Tanshu.Accounts.Contracts/DAOFactory/ManagementDAO.cs index d2bfdc1..80ea231 100644 --- a/Tanshu.Accounts.Contracts/DAOFactory/ManagementDAO.cs +++ b/Tanshu.Accounts.Contracts/DAOFactory/ManagementDAO.cs @@ -7,7 +7,7 @@ namespace Tanshu.Accounts.DAOFactory public interface IManagementDAO : IDisposable { decimal GetBalance(decimal? tax); - List GetUpdateBillList(decimal tax, bool voided, bool paid, bool creditCard); + List GetUpdateBillList(decimal tax); decimal Update(Guid voucherID, decimal tax); List GetPaidBills(); diff --git a/Tanshu.Accounts.Contracts/DAOFactory/SaleVoucherDAO.cs b/Tanshu.Accounts.Contracts/DAOFactory/SaleVoucherDAO.cs index ba6ab90..af96bdd 100644 --- a/Tanshu.Accounts.Contracts/DAOFactory/SaleVoucherDAO.cs +++ b/Tanshu.Accounts.Contracts/DAOFactory/SaleVoucherDAO.cs @@ -11,5 +11,6 @@ namespace Tanshu.Accounts.DAOFactory void SetAlarm(Guid voucherID, DateTime? alarmTime); void VoidBill(Guid voucherID, string reason); SaleVoucherBO GetVoucherSale(Guid voucherID); + SaleVoucherBO GetVoucherSale(string billID); } } diff --git a/Tanshu.Accounts.PointOfSale/Sales/SalesForm.Designer.cs b/Tanshu.Accounts.PointOfSale/Sales/SalesForm.Designer.cs index 44eeb67..667da2a 100644 --- a/Tanshu.Accounts.PointOfSale/Sales/SalesForm.Designer.cs +++ b/Tanshu.Accounts.PointOfSale/Sales/SalesForm.Designer.cs @@ -126,9 +126,10 @@ // this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(795, 517); + this.label7.Location = new System.Drawing.Point(1060, 636); + this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(49, 13); + this.label7.Size = new System.Drawing.Size(63, 17); this.label7.TabIndex = 112; this.label7.Text = "Discount"; this.label7.TextAlign = System.Drawing.ContentAlignment.TopRight; @@ -136,10 +137,11 @@ // txtDiscount // this.txtDiscount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.txtDiscount.Location = new System.Drawing.Point(850, 514); + this.txtDiscount.Location = new System.Drawing.Point(1133, 633); + this.txtDiscount.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtDiscount.Name = "txtDiscount"; this.txtDiscount.ReadOnly = true; - this.txtDiscount.Size = new System.Drawing.Size(120, 20); + this.txtDiscount.Size = new System.Drawing.Size(159, 22); this.txtDiscount.TabIndex = 113; this.txtDiscount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; // @@ -148,9 +150,10 @@ this.Label12.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.Label12.AutoSize = true; this.Label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label12.Location = new System.Drawing.Point(808, 569); + this.Label12.Location = new System.Drawing.Point(1077, 700); + this.Label12.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.Label12.Name = "Label12"; - this.Label12.Size = new System.Drawing.Size(36, 13); + this.Label12.Size = new System.Drawing.Size(45, 17); this.Label12.TabIndex = 116; this.Label12.Text = "Total"; this.Label12.TextAlign = System.Drawing.ContentAlignment.TopRight; @@ -158,10 +161,11 @@ // txtGrossAmount // this.txtGrossAmount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.txtGrossAmount.Location = new System.Drawing.Point(850, 540); + this.txtGrossAmount.Location = new System.Drawing.Point(1133, 665); + this.txtGrossAmount.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtGrossAmount.Name = "txtGrossAmount"; this.txtGrossAmount.ReadOnly = true; - this.txtGrossAmount.Size = new System.Drawing.Size(120, 20); + this.txtGrossAmount.Size = new System.Drawing.Size(159, 22); this.txtGrossAmount.TabIndex = 109; this.txtGrossAmount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; // @@ -171,10 +175,11 @@ this.txtAmount.BackColor = System.Drawing.Color.Black; this.txtAmount.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txtAmount.ForeColor = System.Drawing.Color.Transparent; - this.txtAmount.Location = new System.Drawing.Point(850, 566); + this.txtAmount.Location = new System.Drawing.Point(1133, 697); + this.txtAmount.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtAmount.Name = "txtAmount"; this.txtAmount.ReadOnly = true; - this.txtAmount.Size = new System.Drawing.Size(120, 22); + this.txtAmount.Size = new System.Drawing.Size(159, 26); this.txtAmount.TabIndex = 107; this.txtAmount.Text = "0.00"; this.txtAmount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; @@ -183,9 +188,10 @@ // this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(800, 543); + this.label6.Location = new System.Drawing.Point(1067, 668); + this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(46, 13); + this.label6.Size = new System.Drawing.Size(60, 17); this.label6.TabIndex = 108; this.label6.Text = "Subtotal"; this.label6.TextAlign = System.Drawing.ContentAlignment.TopRight; @@ -194,28 +200,31 @@ // this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(808, 488); + this.label5.Location = new System.Drawing.Point(1077, 601); + this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(36, 13); + this.label5.Size = new System.Drawing.Size(46, 17); this.label5.TabIndex = 110; this.label5.Text = "Taxes"; this.label5.TextAlign = System.Drawing.ContentAlignment.TopRight; // // txtNarration // - this.txtNarration.Location = new System.Drawing.Point(12, 482); + this.txtNarration.Location = new System.Drawing.Point(16, 593); + this.txtNarration.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtNarration.Multiline = true; this.txtNarration.Name = "txtNarration"; - this.txtNarration.Size = new System.Drawing.Size(216, 106); + this.txtNarration.Size = new System.Drawing.Size(287, 130); this.txtNarration.TabIndex = 4; // // txtGrossTax // this.txtGrossTax.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.txtGrossTax.Location = new System.Drawing.Point(850, 488); + this.txtGrossTax.Location = new System.Drawing.Point(1133, 601); + this.txtGrossTax.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtGrossTax.Name = "txtGrossTax"; this.txtGrossTax.ReadOnly = true; - this.txtGrossTax.Size = new System.Drawing.Size(120, 20); + this.txtGrossTax.Size = new System.Drawing.Size(159, 22); this.txtGrossTax.TabIndex = 111; this.txtGrossTax.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; // @@ -237,13 +246,14 @@ this.additionalDataGridViewTextBoxColumn}); this.dgvProducts.DataSource = this.bindingSource; this.dgvProducts.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; - this.dgvProducts.Location = new System.Drawing.Point(12, 90); + this.dgvProducts.Location = new System.Drawing.Point(16, 111); + this.dgvProducts.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.dgvProducts.MultiSelect = false; this.dgvProducts.Name = "dgvProducts"; this.dgvProducts.RowHeadersVisible = false; this.dgvProducts.RowTemplate.Height = 19; this.dgvProducts.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dgvProducts.Size = new System.Drawing.Size(471, 386); + this.dgvProducts.Size = new System.Drawing.Size(628, 475); this.dgvProducts.TabIndex = 0; this.dgvProducts.VirtualMode = true; this.dgvProducts.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dgvProducts_CellFormatting); @@ -323,15 +333,17 @@ this.pnlBilling.Controls.Add(this.label7); this.pnlBilling.Dock = System.Windows.Forms.DockStyle.Fill; this.pnlBilling.Location = new System.Drawing.Point(0, 0); + this.pnlBilling.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.pnlBilling.Name = "pnlBilling"; - this.pnlBilling.Size = new System.Drawing.Size(982, 662); + this.pnlBilling.Size = new System.Drawing.Size(1309, 815); this.pnlBilling.TabIndex = 121; // // btnAdvance // - this.btnAdvance.Location = new System.Drawing.Point(341, 543); + this.btnAdvance.Location = new System.Drawing.Point(455, 668); + this.btnAdvance.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnAdvance.Name = "btnAdvance"; - this.btnAdvance.Size = new System.Drawing.Size(101, 45); + this.btnAdvance.Size = new System.Drawing.Size(135, 55); this.btnAdvance.TabIndex = 152; this.btnAdvance.Text = "Advance - F10"; this.btnAdvance.UseVisualStyleBackColor = true; @@ -341,18 +353,20 @@ // this.btnResetCustomer.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnResetCustomer.ForeColor = System.Drawing.Color.Red; - this.btnResetCustomer.Location = new System.Drawing.Point(489, 54); + this.btnResetCustomer.Location = new System.Drawing.Point(652, 66); + this.btnResetCustomer.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnResetCustomer.Name = "btnResetCustomer"; - this.btnResetCustomer.Size = new System.Drawing.Size(36, 34); + this.btnResetCustomer.Size = new System.Drawing.Size(48, 42); this.btnResetCustomer.TabIndex = 151; this.btnResetCustomer.UseVisualStyleBackColor = true; this.btnResetCustomer.Click += new System.EventHandler(this.btnResetCustomer_Click); // // btnWaiter // - this.btnWaiter.Location = new System.Drawing.Point(341, 482); + this.btnWaiter.Location = new System.Drawing.Point(455, 593); + this.btnWaiter.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnWaiter.Name = "btnWaiter"; - this.btnWaiter.Size = new System.Drawing.Size(101, 55); + this.btnWaiter.Size = new System.Drawing.Size(135, 68); this.btnWaiter.TabIndex = 150; this.btnWaiter.Text = "Select Waiter - F5"; this.btnWaiter.UseVisualStyleBackColor = true; @@ -360,16 +374,18 @@ // // txtCode // - this.txtCode.Location = new System.Drawing.Point(531, 54); + this.txtCode.Location = new System.Drawing.Point(708, 66); + this.txtCode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtCode.Name = "txtCode"; - this.txtCode.Size = new System.Drawing.Size(439, 20); + this.txtCode.Size = new System.Drawing.Size(584, 22); this.txtCode.TabIndex = 149; // // btnClear // - this.btnClear.Location = new System.Drawing.Point(234, 482); + this.btnClear.Location = new System.Drawing.Point(312, 593); + this.btnClear.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnClear.Name = "btnClear"; - this.btnClear.Size = new System.Drawing.Size(101, 106); + this.btnClear.Size = new System.Drawing.Size(135, 130); this.btnClear.TabIndex = 148; this.btnClear.Text = "Clear - Esc"; this.btnClear.UseVisualStyleBackColor = true; @@ -377,9 +393,10 @@ // // btnRate // - this.btnRate.Location = new System.Drawing.Point(663, 566); + this.btnRate.Location = new System.Drawing.Point(884, 697); + this.btnRate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnRate.Name = "btnRate"; - this.btnRate.Size = new System.Drawing.Size(104, 23); + this.btnRate.Size = new System.Drawing.Size(139, 28); this.btnRate.TabIndex = 146; this.btnRate.Text = "&Rate"; this.btnRate.UseVisualStyleBackColor = true; @@ -387,9 +404,10 @@ // // btnPrintKot // - this.btnPrintKot.Location = new System.Drawing.Point(555, 482); + this.btnPrintKot.Location = new System.Drawing.Point(740, 593); + this.btnPrintKot.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnPrintKot.Name = "btnPrintKot"; - this.btnPrintKot.Size = new System.Drawing.Size(102, 106); + this.btnPrintKot.Size = new System.Drawing.Size(136, 130); this.btnPrintKot.TabIndex = 145; this.btnPrintKot.Text = "Print KOT - F12"; this.btnPrintKot.UseVisualStyleBackColor = true; @@ -397,9 +415,10 @@ // // btnPrintBill // - this.btnPrintBill.Location = new System.Drawing.Point(448, 482); + this.btnPrintBill.Location = new System.Drawing.Point(597, 593); + this.btnPrintBill.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnPrintBill.Name = "btnPrintBill"; - this.btnPrintBill.Size = new System.Drawing.Size(101, 106); + this.btnPrintBill.Size = new System.Drawing.Size(135, 130); this.btnPrintBill.TabIndex = 144; this.btnPrintBill.Text = "Print Bill - F11"; this.btnPrintBill.UseVisualStyleBackColor = true; @@ -407,9 +426,10 @@ // // btnVoid // - this.btnVoid.Location = new System.Drawing.Point(663, 485); + this.btnVoid.Location = new System.Drawing.Point(884, 597); + this.btnVoid.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnVoid.Name = "btnVoid"; - this.btnVoid.Size = new System.Drawing.Size(104, 23); + this.btnVoid.Size = new System.Drawing.Size(139, 28); this.btnVoid.TabIndex = 143; this.btnVoid.Text = "Cancel Current Bill"; this.btnVoid.UseVisualStyleBackColor = true; @@ -417,9 +437,10 @@ // // btnDiscount // - this.btnDiscount.Location = new System.Drawing.Point(663, 514); + this.btnDiscount.Location = new System.Drawing.Point(884, 633); + this.btnDiscount.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnDiscount.Name = "btnDiscount"; - this.btnDiscount.Size = new System.Drawing.Size(104, 23); + this.btnDiscount.Size = new System.Drawing.Size(139, 28); this.btnDiscount.TabIndex = 142; this.btnDiscount.Text = "Discount - F3"; this.btnDiscount.UseVisualStyleBackColor = true; @@ -427,9 +448,10 @@ // // btnQuantity // - this.btnQuantity.Location = new System.Drawing.Point(663, 537); + this.btnQuantity.Location = new System.Drawing.Point(884, 661); + this.btnQuantity.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnQuantity.Name = "btnQuantity"; - this.btnQuantity.Size = new System.Drawing.Size(104, 23); + this.btnQuantity.Size = new System.Drawing.Size(139, 28); this.btnQuantity.TabIndex = 141; this.btnQuantity.Text = "Quantity - F2"; this.btnQuantity.UseVisualStyleBackColor = true; @@ -437,130 +459,145 @@ // // txtTableID // - this.txtTableID.Location = new System.Drawing.Point(390, 28); + this.txtTableID.Location = new System.Drawing.Point(520, 34); + this.txtTableID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtTableID.Name = "txtTableID"; this.txtTableID.ReadOnly = true; - this.txtTableID.Size = new System.Drawing.Size(93, 20); + this.txtTableID.Size = new System.Drawing.Size(123, 22); this.txtTableID.TabIndex = 140; // // label11 // this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(387, 12); + this.label11.Location = new System.Drawing.Point(516, 15); + this.label11.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(34, 13); + this.label11.Size = new System.Drawing.Size(44, 17); this.label11.TabIndex = 139; this.label11.Text = "Table"; // // label10 // this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(804, 12); + this.label10.Location = new System.Drawing.Point(1072, 15); + this.label10.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(73, 13); + this.label10.Size = new System.Drawing.Size(97, 17); this.label10.TabIndex = 138; this.label10.Text = "Last Edit User"; // // txtUserID // - this.txtUserID.Location = new System.Drawing.Point(807, 28); + this.txtUserID.Location = new System.Drawing.Point(1076, 34); + this.txtUserID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtUserID.Name = "txtUserID"; this.txtUserID.ReadOnly = true; - this.txtUserID.Size = new System.Drawing.Size(163, 20); + this.txtUserID.Size = new System.Drawing.Size(216, 22); this.txtUserID.TabIndex = 137; // // label9 // this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(259, 12); + this.label9.Location = new System.Drawing.Point(345, 15); + this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(72, 13); + this.label9.Size = new System.Drawing.Size(94, 17); this.label9.TabIndex = 136; this.label9.Text = "Booking Time"; // // label8 // this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(486, 12); + this.label8.Location = new System.Drawing.Point(648, 15); + this.label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(84, 13); + this.label8.Size = new System.Drawing.Size(113, 17); this.label8.TabIndex = 135; this.label8.Text = "Bill Printing Time"; // // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(645, 12); + this.label4.Location = new System.Drawing.Point(860, 15); + this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(74, 13); + this.label4.Size = new System.Drawing.Size(98, 17); this.label4.TabIndex = 134; this.label4.Text = "Last Edit Time"; // // txtDate // - this.txtDate.Location = new System.Drawing.Point(489, 28); + this.txtDate.Location = new System.Drawing.Point(652, 34); + this.txtDate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtDate.Name = "txtDate"; this.txtDate.ReadOnly = true; - this.txtDate.Size = new System.Drawing.Size(153, 20); + this.txtDate.Size = new System.Drawing.Size(203, 22); this.txtDate.TabIndex = 133; // // txtLastEditDate // - this.txtLastEditDate.Location = new System.Drawing.Point(648, 28); + this.txtLastEditDate.Location = new System.Drawing.Point(864, 34); + this.txtLastEditDate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtLastEditDate.Name = "txtLastEditDate"; this.txtLastEditDate.ReadOnly = true; - this.txtLastEditDate.Size = new System.Drawing.Size(153, 20); + this.txtLastEditDate.Size = new System.Drawing.Size(203, 22); this.txtLastEditDate.TabIndex = 132; // // txtCreationDate // - this.txtCreationDate.Location = new System.Drawing.Point(262, 28); + this.txtCreationDate.Location = new System.Drawing.Point(349, 34); + this.txtCreationDate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtCreationDate.Name = "txtCreationDate"; this.txtCreationDate.ReadOnly = true; - this.txtCreationDate.Size = new System.Drawing.Size(122, 20); + this.txtCreationDate.Size = new System.Drawing.Size(161, 22); this.txtCreationDate.TabIndex = 131; // // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(124, 12); + this.label3.Location = new System.Drawing.Point(165, 15); + this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(69, 13); + this.label3.Size = new System.Drawing.Size(91, 17); this.label3.TabIndex = 130; this.label3.Text = "KOT Number"; // // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(9, 12); + this.label2.Location = new System.Drawing.Point(12, 15); + this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(60, 13); + this.label2.Size = new System.Drawing.Size(80, 17); this.label2.TabIndex = 129; this.label2.Text = "Bill Number"; // // txtBillID // - this.txtBillID.Location = new System.Drawing.Point(12, 28); + this.txtBillID.Location = new System.Drawing.Point(16, 34); + this.txtBillID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtBillID.Name = "txtBillID"; this.txtBillID.ReadOnly = true; - this.txtBillID.Size = new System.Drawing.Size(109, 20); + this.txtBillID.Size = new System.Drawing.Size(144, 22); this.txtBillID.TabIndex = 128; // // txtKotID // - this.txtKotID.Location = new System.Drawing.Point(127, 28); + this.txtKotID.Location = new System.Drawing.Point(169, 34); + this.txtKotID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtKotID.Name = "txtKotID"; this.txtKotID.ReadOnly = true; - this.txtKotID.Size = new System.Drawing.Size(129, 20); + this.txtKotID.Size = new System.Drawing.Size(171, 22); this.txtKotID.TabIndex = 127; // // btnCustomer // this.btnCustomer.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnCustomer.ForeColor = System.Drawing.Color.Red; - this.btnCustomer.Location = new System.Drawing.Point(12, 54); + this.btnCustomer.Location = new System.Drawing.Point(16, 66); + this.btnCustomer.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnCustomer.Name = "btnCustomer"; - this.btnCustomer.Size = new System.Drawing.Size(471, 34); + this.btnCustomer.Size = new System.Drawing.Size(628, 42); this.btnCustomer.TabIndex = 126; this.btnCustomer.UseVisualStyleBackColor = true; this.btnCustomer.Click += new System.EventHandler(this.btnCustomer_Click); @@ -584,15 +621,17 @@ this.pnlWaiting.Controls.Add(this.lblUser); this.pnlWaiting.Dock = System.Windows.Forms.DockStyle.Fill; this.pnlWaiting.Location = new System.Drawing.Point(0, 0); + this.pnlWaiting.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.pnlWaiting.Name = "pnlWaiting"; - this.pnlWaiting.Size = new System.Drawing.Size(982, 662); + this.pnlWaiting.Size = new System.Drawing.Size(1309, 815); this.pnlWaiting.TabIndex = 121; // // btnPaidStaff // - this.btnPaidStaff.Location = new System.Drawing.Point(850, 527); + this.btnPaidStaff.Location = new System.Drawing.Point(1133, 649); + this.btnPaidStaff.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnPaidStaff.Name = "btnPaidStaff"; - this.btnPaidStaff.Size = new System.Drawing.Size(120, 58); + this.btnPaidStaff.Size = new System.Drawing.Size(160, 71); this.btnPaidStaff.TabIndex = 138; this.btnPaidStaff.Text = "Paid Staff"; this.btnPaidStaff.UseVisualStyleBackColor = true; @@ -600,9 +639,10 @@ // // btnPaidCredit // - this.btnPaidCredit.Location = new System.Drawing.Point(850, 591); + this.btnPaidCredit.Location = new System.Drawing.Point(1133, 727); + this.btnPaidCredit.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnPaidCredit.Name = "btnPaidCredit"; - this.btnPaidCredit.Size = new System.Drawing.Size(120, 53); + this.btnPaidCredit.Size = new System.Drawing.Size(160, 65); this.btnPaidCredit.TabIndex = 137; this.btnPaidCredit.Text = "Paid Credit"; this.btnPaidCredit.UseVisualStyleBackColor = true; @@ -635,12 +675,13 @@ this.printedDataGridViewCheckBoxColumn, this.alarmTimeDataGridViewTextBoxColumn}); this.dgvPending.DataSource = this.bsPending; - this.dgvPending.Location = new System.Drawing.Point(12, 40); + this.dgvPending.Location = new System.Drawing.Point(16, 49); + this.dgvPending.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.dgvPending.MultiSelect = false; this.dgvPending.Name = "dgvPending"; this.dgvPending.RowHeadersVisible = false; this.dgvPending.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dgvPending.Size = new System.Drawing.Size(696, 487); + this.dgvPending.Size = new System.Drawing.Size(928, 599); this.dgvPending.TabIndex = 0; this.dgvPending.VirtualMode = true; this.dgvPending.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvPending_CellDoubleClick); @@ -652,91 +693,89 @@ // this.selectDataGridViewCheckBoxColumn.HeaderText = "Select"; this.selectDataGridViewCheckBoxColumn.Name = "selectDataGridViewCheckBoxColumn"; - this.selectDataGridViewCheckBoxColumn.Width = 43; + this.selectDataGridViewCheckBoxColumn.Width = 53; // // billNoDataGridViewTextBoxColumn // this.billNoDataGridViewTextBoxColumn.DataPropertyName = "BillNo"; this.billNoDataGridViewTextBoxColumn.HeaderText = "BillNo"; this.billNoDataGridViewTextBoxColumn.Name = "billNoDataGridViewTextBoxColumn"; - this.billNoDataGridViewTextBoxColumn.Width = 59; + this.billNoDataGridViewTextBoxColumn.Width = 69; // // kotDataGridViewTextBoxColumn // this.kotDataGridViewTextBoxColumn.DataPropertyName = "Kot"; this.kotDataGridViewTextBoxColumn.HeaderText = "Kot"; this.kotDataGridViewTextBoxColumn.Name = "kotDataGridViewTextBoxColumn"; - this.kotDataGridViewTextBoxColumn.Width = 48; + this.kotDataGridViewTextBoxColumn.Width = 54; // // TableID // this.TableID.DataPropertyName = "TableID"; this.TableID.HeaderText = "TableID"; this.TableID.Name = "TableID"; - this.TableID.Width = 70; + this.TableID.Width = 82; // // amountDataGridViewTextBoxColumn // this.amountDataGridViewTextBoxColumn.DataPropertyName = "Amount"; this.amountDataGridViewTextBoxColumn.HeaderText = "Amount"; this.amountDataGridViewTextBoxColumn.Name = "amountDataGridViewTextBoxColumn"; - this.amountDataGridViewTextBoxColumn.Width = 68; + this.amountDataGridViewTextBoxColumn.Width = 81; // // importantDataGridViewCheckBoxColumn // this.importantDataGridViewCheckBoxColumn.DataPropertyName = "Important"; this.importantDataGridViewCheckBoxColumn.HeaderText = "Important"; this.importantDataGridViewCheckBoxColumn.Name = "importantDataGridViewCheckBoxColumn"; - this.importantDataGridViewCheckBoxColumn.Width = 57; + this.importantDataGridViewCheckBoxColumn.Width = 73; // // alarmDataGridViewCheckBoxColumn // this.alarmDataGridViewCheckBoxColumn.DataPropertyName = "Alarm"; this.alarmDataGridViewCheckBoxColumn.HeaderText = "Alarm"; this.alarmDataGridViewCheckBoxColumn.Name = "alarmDataGridViewCheckBoxColumn"; - this.alarmDataGridViewCheckBoxColumn.Width = 39; + this.alarmDataGridViewCheckBoxColumn.Width = 50; // // bookingTimeDataGridViewTextBoxColumn // this.bookingTimeDataGridViewTextBoxColumn.DataPropertyName = "BookingTime"; this.bookingTimeDataGridViewTextBoxColumn.HeaderText = "BookingTime"; this.bookingTimeDataGridViewTextBoxColumn.Name = "bookingTimeDataGridViewTextBoxColumn"; - this.bookingTimeDataGridViewTextBoxColumn.Width = 94; + this.bookingTimeDataGridViewTextBoxColumn.Width = 115; // // lastEditedDataGridViewTextBoxColumn // this.lastEditedDataGridViewTextBoxColumn.DataPropertyName = "LastEdited"; this.lastEditedDataGridViewTextBoxColumn.HeaderText = "LastEdited"; this.lastEditedDataGridViewTextBoxColumn.Name = "lastEditedDataGridViewTextBoxColumn"; - this.lastEditedDataGridViewTextBoxColumn.Width = 82; // // waiterDataGridViewTextBoxColumn // this.waiterDataGridViewTextBoxColumn.DataPropertyName = "Waiter"; this.waiterDataGridViewTextBoxColumn.HeaderText = "Waiter"; this.waiterDataGridViewTextBoxColumn.Name = "waiterDataGridViewTextBoxColumn"; - this.waiterDataGridViewTextBoxColumn.Width = 63; + this.waiterDataGridViewTextBoxColumn.Width = 74; // // cashierDataGridViewTextBoxColumn // this.cashierDataGridViewTextBoxColumn.DataPropertyName = "Cashier"; this.cashierDataGridViewTextBoxColumn.HeaderText = "Cashier"; this.cashierDataGridViewTextBoxColumn.Name = "cashierDataGridViewTextBoxColumn"; - this.cashierDataGridViewTextBoxColumn.Width = 67; + this.cashierDataGridViewTextBoxColumn.Width = 81; // // printedDataGridViewCheckBoxColumn // this.printedDataGridViewCheckBoxColumn.DataPropertyName = "Printed"; this.printedDataGridViewCheckBoxColumn.HeaderText = "Printed"; this.printedDataGridViewCheckBoxColumn.Name = "printedDataGridViewCheckBoxColumn"; - this.printedDataGridViewCheckBoxColumn.Width = 46; + this.printedDataGridViewCheckBoxColumn.Width = 59; // // alarmTimeDataGridViewTextBoxColumn // this.alarmTimeDataGridViewTextBoxColumn.DataPropertyName = "AlarmTime"; this.alarmTimeDataGridViewTextBoxColumn.HeaderText = "AlarmTime"; this.alarmTimeDataGridViewTextBoxColumn.Name = "alarmTimeDataGridViewTextBoxColumn"; - this.alarmTimeDataGridViewTextBoxColumn.Width = 81; // // bsPending // @@ -744,9 +783,10 @@ // // btnAlarm // - this.btnAlarm.Location = new System.Drawing.Point(850, 393); + this.btnAlarm.Location = new System.Drawing.Point(1133, 484); + this.btnAlarm.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnAlarm.Name = "btnAlarm"; - this.btnAlarm.Size = new System.Drawing.Size(120, 64); + this.btnAlarm.Size = new System.Drawing.Size(160, 79); this.btnAlarm.TabIndex = 136; this.btnAlarm.Text = "Alarm"; this.btnAlarm.UseVisualStyleBackColor = true; @@ -757,18 +797,20 @@ this.chkRefresh.AutoSize = true; this.chkRefresh.Checked = true; this.chkRefresh.CheckState = System.Windows.Forms.CheckState.Checked; - this.chkRefresh.Location = new System.Drawing.Point(714, 40); + this.chkRefresh.Location = new System.Drawing.Point(952, 49); + this.chkRefresh.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.chkRefresh.Name = "chkRefresh"; - this.chkRefresh.Size = new System.Drawing.Size(121, 17); + this.chkRefresh.Size = new System.Drawing.Size(160, 21); this.chkRefresh.TabIndex = 134; this.chkRefresh.Text = "Keep refreshing Bills"; this.chkRefresh.UseVisualStyleBackColor = true; // // btnRefresh // - this.btnRefresh.Location = new System.Drawing.Point(9, 527); + this.btnRefresh.Location = new System.Drawing.Point(12, 649); + this.btnRefresh.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnRefresh.Name = "btnRefresh"; - this.btnRefresh.Size = new System.Drawing.Size(129, 117); + this.btnRefresh.Size = new System.Drawing.Size(172, 144); this.btnRefresh.TabIndex = 133; this.btnRefresh.Text = "Refresh - F5"; this.btnRefresh.UseVisualStyleBackColor = true; @@ -776,9 +818,10 @@ // // btnPaidCC // - this.btnPaidCC.Location = new System.Drawing.Point(850, 466); + this.btnPaidCC.Location = new System.Drawing.Point(1133, 574); + this.btnPaidCC.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnPaidCC.Name = "btnPaidCC"; - this.btnPaidCC.Size = new System.Drawing.Size(120, 55); + this.btnPaidCC.Size = new System.Drawing.Size(160, 68); this.btnPaidCC.TabIndex = 6; this.btnPaidCC.Text = "Paid By CC"; this.btnPaidCC.UseVisualStyleBackColor = true; @@ -786,9 +829,10 @@ // // btnPaidCash // - this.btnPaidCash.Location = new System.Drawing.Point(714, 527); + this.btnPaidCash.Location = new System.Drawing.Point(952, 649); + this.btnPaidCash.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnPaidCash.Name = "btnPaidCash"; - this.btnPaidCash.Size = new System.Drawing.Size(130, 117); + this.btnPaidCash.Size = new System.Drawing.Size(173, 144); this.btnPaidCash.TabIndex = 5; this.btnPaidCash.Text = "Paid"; this.btnPaidCash.UseVisualStyleBackColor = true; @@ -796,9 +840,10 @@ // // btnBillList // - this.btnBillList.Location = new System.Drawing.Point(714, 393); + this.btnBillList.Location = new System.Drawing.Point(952, 484); + this.btnBillList.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnBillList.Name = "btnBillList"; - this.btnBillList.Size = new System.Drawing.Size(130, 128); + this.btnBillList.Size = new System.Drawing.Size(173, 158); this.btnBillList.TabIndex = 4; this.btnBillList.Text = "List Of Bills to Cancel"; this.btnBillList.UseVisualStyleBackColor = true; @@ -806,9 +851,10 @@ // // btnSelectBill // - this.btnSelectBill.Location = new System.Drawing.Point(714, 239); + this.btnSelectBill.Location = new System.Drawing.Point(952, 294); + this.btnSelectBill.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnSelectBill.Name = "btnSelectBill"; - this.btnSelectBill.Size = new System.Drawing.Size(256, 148); + this.btnSelectBill.Size = new System.Drawing.Size(341, 182); this.btnSelectBill.TabIndex = 3; this.btnSelectBill.Text = "Select Bill"; this.btnSelectBill.UseVisualStyleBackColor = true; @@ -816,9 +862,10 @@ // // btnStartBill // - this.btnStartBill.Location = new System.Drawing.Point(714, 63); + this.btnStartBill.Location = new System.Drawing.Point(952, 78); + this.btnStartBill.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnStartBill.Name = "btnStartBill"; - this.btnStartBill.Size = new System.Drawing.Size(256, 170); + this.btnStartBill.Size = new System.Drawing.Size(341, 209); this.btnStartBill.TabIndex = 2; this.btnStartBill.Text = "New Bill - F6"; this.btnStartBill.UseVisualStyleBackColor = true; @@ -830,49 +877,54 @@ this.tcPending.Controls.Add(this.tpWeek); this.tcPending.Controls.Add(this.tpAll); this.tcPending.Controls.Add(this.tpAlarm); - this.tcPending.Location = new System.Drawing.Point(192, 12); + this.tcPending.Location = new System.Drawing.Point(256, 15); + this.tcPending.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tcPending.Name = "tcPending"; this.tcPending.SelectedIndex = 0; - this.tcPending.Size = new System.Drawing.Size(271, 20); + this.tcPending.Size = new System.Drawing.Size(361, 25); this.tcPending.TabIndex = 1; this.tcPending.SelectedIndexChanged += new System.EventHandler(this.tcPending_SelectedIndexChanged); // // tpToday // - this.tpToday.Location = new System.Drawing.Point(4, 22); + this.tpToday.Location = new System.Drawing.Point(4, 25); + this.tpToday.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tpToday.Name = "tpToday"; - this.tpToday.Padding = new System.Windows.Forms.Padding(3); - this.tpToday.Size = new System.Drawing.Size(263, 0); + this.tpToday.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tpToday.Size = new System.Drawing.Size(353, 0); this.tpToday.TabIndex = 1; this.tpToday.Text = "Today"; this.tpToday.UseVisualStyleBackColor = true; // // tpWeek // - this.tpWeek.Location = new System.Drawing.Point(4, 22); + this.tpWeek.Location = new System.Drawing.Point(4, 25); + this.tpWeek.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tpWeek.Name = "tpWeek"; - this.tpWeek.Padding = new System.Windows.Forms.Padding(3); - this.tpWeek.Size = new System.Drawing.Size(263, 0); + this.tpWeek.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tpWeek.Size = new System.Drawing.Size(353, 0); this.tpWeek.TabIndex = 2; this.tpWeek.Text = "Week"; this.tpWeek.UseVisualStyleBackColor = true; // // tpAll // - this.tpAll.Location = new System.Drawing.Point(4, 22); + this.tpAll.Location = new System.Drawing.Point(4, 25); + this.tpAll.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tpAll.Name = "tpAll"; - this.tpAll.Padding = new System.Windows.Forms.Padding(3); - this.tpAll.Size = new System.Drawing.Size(263, 0); + this.tpAll.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tpAll.Size = new System.Drawing.Size(353, 0); this.tpAll.TabIndex = 3; this.tpAll.Text = "All"; this.tpAll.UseVisualStyleBackColor = true; // // tpAlarm // - this.tpAlarm.Location = new System.Drawing.Point(4, 22); + this.tpAlarm.Location = new System.Drawing.Point(4, 25); + this.tpAlarm.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tpAlarm.Name = "tpAlarm"; - this.tpAlarm.Padding = new System.Windows.Forms.Padding(3); - this.tpAlarm.Size = new System.Drawing.Size(263, 0); + this.tpAlarm.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tpAlarm.Size = new System.Drawing.Size(353, 0); this.tpAlarm.TabIndex = 5; this.tpAlarm.Text = "Alarms"; this.tpAlarm.UseVisualStyleBackColor = true; @@ -881,9 +933,10 @@ // this.lblUser.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblUser.ForeColor = System.Drawing.Color.Red; - this.lblUser.Location = new System.Drawing.Point(144, 530); + this.lblUser.Location = new System.Drawing.Point(192, 652); + this.lblUser.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lblUser.Name = "lblUser"; - this.lblUser.Size = new System.Drawing.Size(564, 114); + this.lblUser.Size = new System.Drawing.Size(752, 140); this.lblUser.TabIndex = 135; this.lblUser.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // @@ -893,12 +946,13 @@ // // SalesForm // - 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(982, 662); - this.Controls.Add(this.pnlBilling); + this.ClientSize = new System.Drawing.Size(1309, 815); this.Controls.Add(this.pnlWaiting); + this.Controls.Add(this.pnlBilling); this.KeyPreview = true; + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.MaximizeBox = false; this.Name = "SalesForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; diff --git a/Tanshu.Accounts.PointOfSale/Sales/SalesForm.cs b/Tanshu.Accounts.PointOfSale/Sales/SalesForm.cs index 937c0ef..b73287f 100644 --- a/Tanshu.Accounts.PointOfSale/Sales/SalesForm.cs +++ b/Tanshu.Accounts.PointOfSale/Sales/SalesForm.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Drawing; using System.Globalization; @@ -271,21 +272,19 @@ namespace Tanshu.Accounts.PointOfSale private void btnPrintBill_Click(object sender, EventArgs e) { - Guid? val = Save(true); - if (val.HasValue) - { - PrintBill(val.Value); - ClearBill(); - } + var val = Save(true); + if (!val.HasValue) + return; + PrintBill(val.Value); + ClearBill(); } private void btnPrintKot_Click(object sender, EventArgs e) { - Guid? val = Save(false); - if (val.HasValue) - { - PrintKOT(val.Value); - ClearBill(); - } + var val = Save(false); + if (!val.HasValue) + return; + PrintKOT(val.Value); + ClearBill(); } private void btnCancel_Click(object sender, EventArgs e) { @@ -811,8 +810,23 @@ namespace Tanshu.Accounts.PointOfSale private void btnBillList_Click(object sender, EventArgs e) { - //if (!Thread.CurrentPrincipal.IsInRole("Security/CreateUser")) - // return; + if (!Thread.CurrentPrincipal.IsInRole("Security/CreateUser")) + return; + + var result = InputBox.Show("Bill No", "Bill No", "", InputBox_Validating); + if (result.OK) + { + var saleVoucher = new SaleVoucherBO(); + var list = new List(); + new SaleVoucherBI().GetSaleVoucher(result.Text,ref saleVoucher, ref list); + if (saleVoucher == null) + return; + LoadBill(saleVoucher.VoucherID); + ChangeFormState(SaleFormState.Billing); + } + + + //#region Filters //decimal? minValue = 0, maxValue = 0; //decimal valTemp; diff --git a/Tanshu.Accounts.PointOfSale/Updates/UpdateForm.cs b/Tanshu.Accounts.PointOfSale/Updates/UpdateForm.cs index 3d07ecd..91a0180 100644 --- a/Tanshu.Accounts.PointOfSale/Updates/UpdateForm.cs +++ b/Tanshu.Accounts.PointOfSale/Updates/UpdateForm.cs @@ -83,12 +83,12 @@ namespace Tanshu.Accounts.PointOfSale ShowProgress(0, 0, 0, string.Format("Starting work on {0:00.00%}. Target : {1:#,###}", tax, target)); if (target == 0) return tax; - ManagementBI man = new ManagementBI(); - List list = man.GetUpdateBillList(tax, false, true, false, dtpFrom.Value, dtpTo.Value); - int totalBills = list.Count; - decimal existing = man.GetBalance(tax, dtpFrom.Value, dtpTo.Value); - int i = 0; - decimal work = existing / (existing - target); + var man = new ManagementBI(); + var list = man.GetUpdateBillList(tax, dtpFrom.Value, dtpTo.Value); + var totalBills = list.Count; + var existing = man.GetBalance(tax, dtpFrom.Value, dtpTo.Value); + var i = 0; + var work = existing / (existing - target); while ((existing > target) && (totalBills > 0)) { int runner = Convert.ToInt32(Math.Floor(work * (i + 1) - i)); diff --git a/Tanshu.Accounts.SqlDAO/CheckoutDAO.cs b/Tanshu.Accounts.SqlDAO/CheckoutDAO.cs index cad3ab5..2e40ca5 100644 --- a/Tanshu.Accounts.SqlDAO/CheckoutDAO.cs +++ b/Tanshu.Accounts.SqlDAO/CheckoutDAO.cs @@ -225,18 +225,22 @@ AND s.PaidStatus != @Pending AND s.PaidStatus != @Void info = ""; const string query = @" -SELECT t.Date, s.BillID, c.Name, SUM(i.Amount) AS Amount, SUM(Quantity * Rate * Discount) AS Discount FROM Vouchers t INNER JOIN SaleVoucher s ON t.VoucherID = s.VoucherID -INNER JOIN Inventory i ON t.VoucherID = i.VoucherID +SELECT v.Date, s.BillID, c.Name, SUM(i.Amount) AS Amount, SUM(i.Quantity * i.Rate * i.Discount) AS Discount +FROM Vouchers v INNER JOIN SaleVoucher s ON v.VoucherID = s.VoucherID +INNER JOIN Inventory i ON v.VoucherID = i.VoucherID INNER JOIN Customers c ON s.CustomerID = c.CustomerID -WHERE t.Type = 'S' -AND t.LastEditDate BETWEEN @StartDate AND @FinishDate AND t.UserID = @UserID -AND s.PaidStatus != @Pending AND s.PaidStatus != @Void -GROUP BY t.Date, c.Name, s.BillID, i.Discount -HAVING i.Discount >= .05 +WHERE v.VoucherID IN ( + SELECT v.VoucherID FROM Vouchers v INNER JOIN SaleVoucher s ON v.VoucherID = s.VoucherID + INNER JOIN Inventory i ON v.VoucherID = i.VoucherID + WHERE v.Type = 'S' + AND v.LastEditDate BETWEEN @StartDate AND @FinishDate AND v.UserID = @UserID + AND s.PaidStatus != @Void + AND i.Discount >= .05 +) +GROUP BY v.Date, s.BillID, c.Name "; using (var cmd = new SqlCommand(query)) { - cmd.Parameters.AddWithValue("@Pending", (int)PaidStatus.Pending); cmd.Parameters.AddWithValue("@Void", (int)PaidStatus.Void); cmd.Parameters.AddWithValue("@StartDate", _startDate); cmd.Parameters.AddWithValue("@FinishDate", _finishDate); diff --git a/Tanshu.Accounts.SqlDAO/ManagementDAO.cs b/Tanshu.Accounts.SqlDAO/ManagementDAO.cs index f1fef56..55fcbf9 100644 --- a/Tanshu.Accounts.SqlDAO/ManagementDAO.cs +++ b/Tanshu.Accounts.SqlDAO/ManagementDAO.cs @@ -26,16 +26,16 @@ namespace Tanshu.Accounts.SqlDAO query = @" SELECT ISNULL(SUM(i.Amount), 0) FROM Vouchers t INNER JOIN SaleVoucher s ON t.VoucherID = s.VoucherID INNER JOIN Inventory i ON t.VoucherID = i.VoucherID -WHERE t.Type = 'S' AND t.Date BETWEEN @StartDate AND @FinishDate AND s.Void = 0 +WHERE t.Type = 'S' AND t.Date BETWEEN @StartDate AND @FinishDate AND s.PaidStatus IN (2, 3) AND i.Tax = @Tax "; else query = @" SELECT ISNULL(SUM(i.Amount), 0) FROM Vouchers t INNER JOIN SaleVoucher s ON t.VoucherID = s.VoucherID INNER JOIN Inventory i ON t.VoucherID = i.VoucherID -WHERE t.Type = 'S' AND t.Date BETWEEN @StartDate AND @FinishDate AND s.Void = 0 +WHERE t.Type = 'S' AND t.Date BETWEEN @StartDate AND @FinishDate AND s.PaidStatus IN (2, 3) "; - using (SqlCommand cmd = new SqlCommand(query)) + using (var cmd = new SqlCommand(query)) { cmd.Parameters.AddWithValue("@StartDate", startDate); cmd.Parameters.AddWithValue("@FinishDate", finishDate); @@ -44,26 +44,24 @@ WHERE t.Type = 'S' AND t.Date BETWEEN @StartDate AND @FinishDate AND s.Void = 0 } } - public List GetUpdateBillList(decimal tax, bool voided, bool paid, bool creditCard) + public List GetUpdateBillList(decimal tax) { //Paid = 1, CC = 0, Void = 0 - List list = new List(); - string query = @" -SELECT DISTINCT t.VoucherID -FROM Vouchers t INNER JOIN SaleVoucher s ON t.VoucherID = s.VoucherID -INNER JOIN Inventory i ON t.VoucherID = i.VoucherID -WHERE t.Date BETWEEN @StartDate AND @FinishDate AND t.Type = 'S' -AND s.Void = @Void and s.Paid = @Paid AND s.CreditCard = @CreditCard AND i.Tax = @Tax"; - using (SqlCommand cmd = new SqlCommand(query)) + var list = new List(); + const string query = @" +SELECT DISTINCT v.VoucherID +FROM Vouchers v INNER JOIN SaleVoucher s ON v.VoucherID = s.VoucherID +INNER JOIN Inventory i ON v.VoucherID = i.VoucherID +WHERE v.Date BETWEEN @StartDate AND @FinishDate AND v.Type = 'S' +AND s.PaidStatus = @Cash AND i.Tax = @Tax"; + using (var cmd = new SqlCommand(query)) { cmd.Parameters.AddWithValue("@StartDate", startDate); cmd.Parameters.AddWithValue("@FinishDate", finishDate); cmd.Parameters.AddWithValue("@Tax", tax); - cmd.Parameters.AddWithValue("@Void", voided); - cmd.Parameters.AddWithValue("@Paid", paid); - cmd.Parameters.AddWithValue("CreditCard", creditCard); + cmd.Parameters.AddWithValue("@Cash", PaidStatus.Cash); - using (IDataReader dr = connection.ExecuteReader(cmd)) + using (var dr = connection.ExecuteReader(cmd)) { while (dr.Read()) list.Add(dr.GetGuid(0)); @@ -188,11 +186,11 @@ DELETE FROM Vouchers WHERE VoucherID = @VoucherID;")) using (SqlCommand cmd = new SqlCommand(@" DELETE FROM Inventory WHERE VoucherID IN ( SELECT v.VoucherID FROM SaleVoucher s INNER JOIN Vouchers v ON s.VoucherID = v.VoucherID -WHERE s.Void = 1 AND v.Date BETWEEN @StartDate AND @EndDate) +WHERE s.PaidStatus IN (1, 4, 5, 6) AND v.Date BETWEEN @StartDate AND @EndDate) DELETE FROM SaleVoucher WHERE VoucherID IN ( SELECT v.VoucherID FROM SaleVoucher s INNER JOIN Vouchers v ON s.VoucherID = v.VoucherID -WHERE s.Void = 1 AND v.Date BETWEEN @StartDate AND @EndDate) +WHERE s.PaidStatus IN (1, 4, 5, 6) AND v.Date BETWEEN @StartDate AND @EndDate) DELETE FROM Vouchers WHERE VoucherID NOT IN (SELECT VoucherID FROM SaleVoucher) AND Type = 'S' diff --git a/Tanshu.Accounts.SqlDAO/SaleVoucherDAO.cs b/Tanshu.Accounts.SqlDAO/SaleVoucherDAO.cs index 972810d..112ac58 100644 --- a/Tanshu.Accounts.SqlDAO/SaleVoucherDAO.cs +++ b/Tanshu.Accounts.SqlDAO/SaleVoucherDAO.cs @@ -167,5 +167,11 @@ IF @Printed = 1 AND (SELECT Printed FROM SaleVoucher WHERE VoucherID = @VoucherI cmd.Parameters.AddWithValue("@VoucherID", voucherID); return BusinessObjectDAO.GetBusinessObject(connection.ExecuteReader(cmd)); } + public SaleVoucherBO GetVoucherSale(string billID) + { + var cmd = new SqlCommand("SELECT b.*, ts.Floor, ts.BillID, ts.TableID, ts.WaiterID, ts.CustomerID, ts.AdvanceID, ts.PaidStatus, ts.VoidReason, ts.Printed, ts.Alarm, ts.KotID, ts.timestamp AS SaleTimestamp FROM SaleVoucher ts INNER JOIN Vouchers b ON ts.VoucherID = b.VoucherID WHERE ts.BillID = @billID"); + cmd.Parameters.AddWithValue("@billID", billID); + return BusinessObjectDAO.GetBusinessObject(connection.ExecuteReader(cmd)); + } } } diff --git a/Tanshu.Accounts.SqlDAO/SaleVoucherMixDAO.cs b/Tanshu.Accounts.SqlDAO/SaleVoucherMixDAO.cs index 860ed90..ec25eed 100644 --- a/Tanshu.Accounts.SqlDAO/SaleVoucherMixDAO.cs +++ b/Tanshu.Accounts.SqlDAO/SaleVoucherMixDAO.cs @@ -232,17 +232,17 @@ WHERE p.ProductID = @ProductID cmd.Parameters.AddWithValue("@VoucherID", voucherID); amount = (decimal)connection.ExecuteScalar(cmd); } - Guid? advanceID; + object advanceID; using (var cmd = new SqlCommand("SELECT AdvanceID FROM SaleVoucher WHERE VoucherID = @VoucherID")) { cmd.Parameters.AddWithValue("@VoucherID", voucherID); - advanceID = (Guid?)connection.ExecuteScalar(cmd); + advanceID = connection.ExecuteScalar(cmd); + if (advanceID == DBNull.Value) + return amount; } - if (!advanceID.HasValue) - return amount; using (var cmd = new SqlCommand("SELECT Amount FROM Advances WHERE AdvanceID = @AdvanceID")) { - cmd.Parameters.AddWithValue("@AdvanceID", advanceID.Value); + cmd.Parameters.AddWithValue("@AdvanceID", (Guid)advanceID); return amount - (decimal)connection.ExecuteScalar(cmd); } }