示例#1
0
		public void UpdateTransactionSales(TerminalReportDetails Details)
		{
			try 
			{
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

                string SQL = "CALL procTerminalReportUpdateTransactionSales(@BranchID, @TerminalNo," +
                                    "@NetSales," +
                                    "@GrossSales, " +
                                    "@TotalDiscount, " +
                                    "@SNRDiscount, " +
                                    "@PWDDiscount, " +
                                    "@OtherDiscount, " +
                                    "@TotalCharge, " +
                                    "@DailySales, " +
                                    "@ItemSold, " +
                                    "@QuantitySold, " +
                                    "@GroupSales, " +
                                    "@OldGrandTotal, " +
                                    "@NewGrandTotal, " +
                                    "@VATExempt, " +
                                    "@NonVATableAmount, " +
                                    "@VATableAmount, " +
                                    "@ZeroRatedSales, " +
                                    "@VAT, " +
                                    "@EVATableAmount, " +
                                    "@NonEVATableAmount, " +
                                    "@EVAT, " +
                                    "@LocalTax, " +
                                    "@CashSales, " +
                                    "@ChequeSales, " +
                                    "@CreditCardSales, " +
                                    "@CreditSales, " +
                                    "@CreditPayment, " +
                                    "@CreditPaymentCash, " +
                                    "@CreditPaymentCheque, " +
                                    "@CreditPaymentCreditCard, " +
                                    "@CreditPaymentDebit, " +
                                    "@DebitPayment, " +
                                    "@RewardPointsPayment, " +
                                    "@RewardConvertedPayment, " +
                                    "@CashInDrawer, " +
                                    "@VoidSales, " +
                                    "@RefundSales, " +
                                    "@ItemsDiscount, " +
                                    "@SNRItemsDiscount, " +
                                    "@PWDItemsDiscount, " +
                                    "@OtherItemsDiscount, " +
                                    "@SubTotalDiscount, " +
                                    "@NoOfCashTransactions, " +
                                    "@NoOfChequeTransactions, " +
                                    "@NoOfCreditCardTransactions, " +
                                    "@NoOfCreditTransactions, " +
                                    "@NoOfCombinationPaymentTransactions, " +
                                    "@NoOfCreditPaymentTransactions, " +
                                    "@NoOfDebitPaymentTransactions, " +
                                    "@NoOfClosedTransactions, " +
                                    "@NoOfRefundTransactions, " +
                                    "@NoOfVoidTransactions, " +
                                    "@NoOfRewardPointsPayment, " +
                                    "@NoOfTotalTransactions, " +
                                    "@NoOfDiscountedTransactions, " +
                                    "@NegativeAdjustments, " +
                                    "@NoOfNegativeAdjustmentTransactions, " +
                                    "@NoOfConsignmentTransactions, " +
                                    "@NoOfConsignmentRefundTransactions, " +
                                    "@NoOfWalkInTransactions, " +
                                    "@NoOfWalkInRefundTransactions, " +
                                    "@NoOfOutOfStockTransactions, " +
                                    "@NoOfOutOfStockRefundTransactions, " +
                                    "@PromotionalItems, " +
                                    "@CreditSalesTax);";

				cmd.Parameters.AddWithValue("@BranchID", Details.BranchID);
                cmd.Parameters.AddWithValue("@NetSales", Details.NetSales);
                cmd.Parameters.AddWithValue("@GrossSales", Details.GrossSales);
                cmd.Parameters.AddWithValue("@TotalDiscount", Details.TotalDiscount);
                cmd.Parameters.AddWithValue("@SNRDiscount", Details.SNRDiscount);
                cmd.Parameters.AddWithValue("@PWDDiscount", Details.PWDDiscount);
                cmd.Parameters.AddWithValue("@OtherDiscount", Details.OtherDiscount);
                cmd.Parameters.AddWithValue("@TotalCharge", Details.TotalCharge);
                cmd.Parameters.AddWithValue("@DailySales", Details.DailySales);
                cmd.Parameters.AddWithValue("@ItemSold", Details.ItemSold);
                cmd.Parameters.AddWithValue("@QuantitySold", Details.QuantitySold);
                cmd.Parameters.AddWithValue("@GroupSales", Details.GroupSales);
                cmd.Parameters.AddWithValue("@OldGrandTotal", 0);
                cmd.Parameters.AddWithValue("@NewGrandTotal", Details.GrossSales);
                
                cmd.Parameters.AddWithValue("@VATExempt", Details.VATExempt);
                cmd.Parameters.AddWithValue("@NonVATableAmount", Details.NonVATableAmount);
                cmd.Parameters.AddWithValue("@VATableAmount", Details.VATableAmount);
                cmd.Parameters.AddWithValue("@ZeroRatedSales", Details.ZeroRatedSales);
                cmd.Parameters.AddWithValue("@VAT", Details.VAT);
                cmd.Parameters.AddWithValue("@EVATableAmount", Details.EVATableAmount);
                cmd.Parameters.AddWithValue("@NonEVATableAmount", Details.NonEVATableAmount);
                cmd.Parameters.AddWithValue("@EVAT", Details.EVAT);
                cmd.Parameters.AddWithValue("@LocalTax", Details.LocalTax);
                
                cmd.Parameters.AddWithValue("@CashSales", Details.CashSales);
                cmd.Parameters.AddWithValue("@ChequeSales", Details.ChequeSales);
                cmd.Parameters.AddWithValue("@CreditCardSales", Details.CreditCardSales);
                cmd.Parameters.AddWithValue("@CreditSales", Details.CreditSales);

                cmd.Parameters.AddWithValue("@CreditPayment", Details.CreditPayment);
                cmd.Parameters.AddWithValue("@CreditPaymentCash", Details.CreditPaymentCash);
                cmd.Parameters.AddWithValue("@CreditPaymentCheque", Details.CreditPaymentCheque);
                cmd.Parameters.AddWithValue("@CreditPaymentCreditCard", Details.CreditPaymentCreditCard);
                cmd.Parameters.AddWithValue("@CreditPaymentDebit", Details.CreditPaymentDebit);
                cmd.Parameters.AddWithValue("@DebitPayment", Details.DebitPayment);
                cmd.Parameters.AddWithValue("@RewardPointsPayment", Details.RewardPointsPayment);
                cmd.Parameters.AddWithValue("@RewardConvertedPayment", Details.RewardConvertedPayment);
                // prmCashInDrawer.Value = Details.CashSales; //refer to cash sales
                // Apr 12, 2014 make an override use the cash in drawer due to credit payment
                cmd.Parameters.AddWithValue("@CashInDrawer", Details.CashInDrawer == 0 ? Details.CashSales : Details.CashInDrawer);

                cmd.Parameters.AddWithValue("@VoidSales", Details.VoidSales);
                cmd.Parameters.AddWithValue("@RefundSales", Details.RefundSales);
                cmd.Parameters.AddWithValue("@ItemsDiscount", Details.ItemsDiscount);
                cmd.Parameters.AddWithValue("@SNRItemsDiscount", Details.SNRItemsDiscount);
                cmd.Parameters.AddWithValue("@PWDItemsDiscount", Details.PWDItemsDiscount);
                cmd.Parameters.AddWithValue("@OtherItemsDiscount", Details.OtherItemsDiscount);
                cmd.Parameters.AddWithValue("@SubTotalDiscount", Details.SubTotalDiscount);
                cmd.Parameters.AddWithValue("@NoOfCashTransactions", Details.NoOfCashTransactions);
                cmd.Parameters.AddWithValue("@NoOfChequeTransactions", Details.NoOfChequeTransactions);
                cmd.Parameters.AddWithValue("@NoOfCreditCardTransactions", Details.NoOfCreditCardTransactions);
                cmd.Parameters.AddWithValue("@NoOfCreditTransactions", Details.NoOfCreditTransactions);
                cmd.Parameters.AddWithValue("@NoOfCombinationPaymentTransactions", Details.NoOfCombinationPaymentTransactions);
                cmd.Parameters.AddWithValue("@NoOfCreditPaymentTransactions", Details.NoOfCreditPaymentTransactions);
                cmd.Parameters.AddWithValue("@NoOfDebitPaymentTransactions", Details.NoOfDebitPaymentTransactions);
                cmd.Parameters.AddWithValue("@NoOfClosedTransactions", Details.NoOfClosedTransactions);
                cmd.Parameters.AddWithValue("@NoOfRefundTransactions", Details.NoOfRefundTransactions);
                cmd.Parameters.AddWithValue("@NoOfVoidTransactions", Details.NoOfVoidTransactions);
                cmd.Parameters.AddWithValue("@NoOfRewardPointsPayment", Details.NoOfRewardPointsPayment);
                cmd.Parameters.AddWithValue("@NoOfTotalTransactions", Details.NoOfTotalTransactions);
                cmd.Parameters.AddWithValue("@NoOfDiscountedTransactions", Details.NoOfDiscountedTransactions);
                cmd.Parameters.AddWithValue("@NegativeAdjustments", Details.NegativeAdjustments);
                cmd.Parameters.AddWithValue("@NoOfNegativeAdjustmentTransactions", Details.NoOfNegativeAdjustmentTransactions);
                cmd.Parameters.AddWithValue("@NoOfConsignmentTransactions", Details.NoOfConsignmentTransactions);
                cmd.Parameters.AddWithValue("@NoOfConsignmentRefundTransactions", Details.NoOfConsignmentRefundTransactions);
                cmd.Parameters.AddWithValue("@NoOfWalkInTransactions", Details.NoOfWalkInTransactions);
                cmd.Parameters.AddWithValue("@NoOfWalkInRefundTransactions", Details.NoOfWalkInRefundTransactions);
                cmd.Parameters.AddWithValue("@NoOfOutOfStockTransactions", Details.NoOfOutOfStockTransactions);
                cmd.Parameters.AddWithValue("@NoOfOutOfStockRefundTransactions", Details.NoOfOutOfStockRefundTransactions);
                cmd.Parameters.AddWithValue("@PromotionalItems", Details.PromotionalItems);
                cmd.Parameters.AddWithValue("@CreditSalesTax", Details.CreditSalesTax);
                cmd.Parameters.AddWithValue("@TerminalNo", Details.TerminalNo);

                cmd.CommandText = SQL;
				base.ExecuteNonQuery(cmd);
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
示例#2
0
        public TerminalReportDetails[] SetDetailsList(System.Data.DataTable dt, bool isCurrentZRead = false)
        {
            ArrayList items = new ArrayList();
            
            TerminalReportDetails Details = new TerminalReportDetails(); ;
            TerminalReportDetails[] DetailsList = new TerminalReportDetails[0];

            foreach (System.Data.DataRow dr in dt.Rows)
            {
                Details.BranchID = Int32.Parse(dr["BranchID"].ToString());
                Details.TerminalNo = dr["TerminalNo"].ToString();
                Details.BeginningTransactionNo = dr["BeginningTransactionNo"].ToString();
                Details.EndingTransactionNo = dr["EndingTransactionNo"].ToString();
                Details.BeginningORNo = dr["BeginningORNo"].ToString();
                Details.EndingORNo = dr["EndingORNo"].ToString();
                Details.ZReadCount = Int32.Parse(dr["ZReadCount"].ToString());
                Details.XReadCount = Int32.Parse(dr["XReadCount"].ToString());
                Details.NetSales = decimal.Parse(dr["NetSales"].ToString());
                Details.GrossSales = decimal.Parse(dr["GrossSales"].ToString());
                Details.TotalDiscount = decimal.Parse(dr["TotalDiscount"].ToString());
                Details.SNRDiscount = decimal.Parse(dr["SNRDiscount"].ToString());
                Details.PWDDiscount = decimal.Parse(dr["PWDDiscount"].ToString());
                Details.OtherDiscount = decimal.Parse(dr["OtherDiscount"].ToString());
                Details.TotalCharge = decimal.Parse(dr["TotalCharge"].ToString());
                Details.DailySales = decimal.Parse(dr["DailySales"].ToString());
                Details.ItemSold = decimal.Parse(dr["ItemSold "].ToString());
                Details.QuantitySold = decimal.Parse(dr["QuantitySold"].ToString());
                Details.GroupSales = decimal.Parse(dr["GroupSales"].ToString());
                Details.OldGrandTotal = decimal.Parse(dr["OldGrandTotal"].ToString());
                Details.NewGrandTotal = decimal.Parse(dr["NewGrandTotal"].ToString());
                Details.eSalesOldGrandTotal = decimal.Parse(dr["eSalesOldGrandTotal"].ToString());
                Details.eSalesNewGrandTotal = decimal.Parse(dr["eSalesNewGrandTotal"].ToString());
                Details.VATExempt = decimal.Parse(dr["VATExempt"].ToString());
                Details.NonVATableAmount = decimal.Parse(dr["NonVATableAmount"].ToString());
                Details.VATableAmount = decimal.Parse(dr["VATableAmount"].ToString());
                Details.ZeroRatedSales = decimal.Parse(dr["ZeroRatedSales"].ToString());
                Details.VAT = decimal.Parse(dr["VAT"].ToString());
                Details.EVATableAmount = decimal.Parse(dr["EVATableAmount"].ToString());
                Details.NonEVATableAmount = decimal.Parse(dr["NonEVATableAmount"].ToString());
                Details.EVAT = decimal.Parse(dr["EVAT"].ToString());
                Details.LocalTax = decimal.Parse(dr["LocalTax"].ToString());
                Details.CashSales = decimal.Parse(dr["CashSales"].ToString());
                Details.ChequeSales = decimal.Parse(dr["ChequeSales"].ToString());
                Details.CreditCardSales = decimal.Parse(dr["CreditCardSales"].ToString());
                Details.CreditSales = decimal.Parse(dr["CreditSales"].ToString());
                Details.RefundCash = decimal.Parse(dr["RefundCash"].ToString());
                Details.RefundCheque = decimal.Parse(dr["RefundCheque"].ToString());
                Details.RefundCreditCard = decimal.Parse(dr["RefundCreditCard"].ToString());
                Details.RefundCredit = decimal.Parse(dr["RefundCredit"].ToString());
                Details.RefundDebit = decimal.Parse(dr["RefundDebit"].ToString());
                Details.CreditPayment = decimal.Parse(dr["CreditPayment"].ToString());
                Details.CreditPaymentCash = decimal.Parse(dr["CreditPaymentCash"].ToString());
                Details.CreditPaymentCheque = decimal.Parse(dr["CreditPaymentCheque"].ToString());
                Details.CreditPaymentCreditCard = decimal.Parse(dr["CreditPaymentCreditCard"].ToString());
                Details.CreditPaymentDebit = decimal.Parse(dr["CreditPaymentDebit"].ToString());
                Details.DebitPayment = decimal.Parse(dr["DebitPayment"].ToString());
                Details.RewardPointsPayment = decimal.Parse(dr["RewardPointsPayment"].ToString());
                Details.RewardConvertedPayment = decimal.Parse(dr["RewardConvertedPayment"].ToString());
                Details.CashInDrawer = decimal.Parse(dr["CashInDrawer"].ToString());
                Details.TotalDisburse = decimal.Parse(dr["TotalDisburse"].ToString());
                Details.CashDisburse = decimal.Parse(dr["CashDisburse"].ToString());
                Details.ChequeDisburse = decimal.Parse(dr["ChequeDisburse"].ToString());
                Details.CreditCardDisburse = decimal.Parse(dr["CreditCardDisburse"].ToString());
                Details.TotalWithHold = decimal.Parse(dr["TotalWithHold"].ToString());
                Details.CashWithHold = decimal.Parse(dr["CashWithHold"].ToString());
                Details.ChequeWithHold = decimal.Parse(dr["ChequeWithHold"].ToString());
                Details.CreditCardWithHold = decimal.Parse(dr["CreditCardWithHold"].ToString());
                Details.TotalPaidOut = decimal.Parse(dr["TotalPaidOut"].ToString());
                Details.TotalDeposit = decimal.Parse(dr["TotalDeposit"].ToString());
                Details.CashDeposit = decimal.Parse(dr["CashDeposit"].ToString());
                Details.ChequeDeposit = decimal.Parse(dr["ChequeDeposit"].ToString());
                Details.CreditCardDeposit = decimal.Parse(dr["CreditCardDeposit"].ToString());
                Details.BeginningBalance = decimal.Parse(dr["BeginningBalance"].ToString());
                Details.VoidSales = decimal.Parse(dr["VoidSales"].ToString());
                Details.RefundSales = decimal.Parse(dr["RefundSales"].ToString());
                Details.ItemsDiscount = decimal.Parse(dr["ItemsDiscount"].ToString());
                Details.SNRItemsDiscount = decimal.Parse(dr["SNRItemsDiscount"].ToString());
                Details.PWDItemsDiscount = decimal.Parse(dr["PWDItemsDiscount"].ToString());
                Details.OtherItemsDiscount = decimal.Parse(dr["OtherItemsDiscount"].ToString());
                Details.SubTotalDiscount = decimal.Parse(dr["SubTotalDiscount"].ToString());
                Details.NoOfCashTransactions = Int32.Parse(dr["NoOfCashTransactions"].ToString());
                Details.NoOfChequeTransactions = Int32.Parse(dr["NoOfChequeTransactions"].ToString());
                Details.NoOfCreditCardTransactions = Int32.Parse(dr["NoOfCreditCardTransactions"].ToString());
                Details.NoOfCreditTransactions = Int32.Parse(dr["NoOfCreditTransactions"].ToString());
                Details.NoOfCombinationPaymentTransactions = Int32.Parse(dr["NoOfCombinationPaymentTransactions"].ToString());
                Details.NoOfCreditPaymentTransactions = Int32.Parse(dr["NoOfCreditPaymentTransactions"].ToString());
                Details.NoOfDebitPaymentTransactions = Int32.Parse(dr["NoOfDebitPaymentTransactions"].ToString());
                Details.NoOfClosedTransactions = Int32.Parse(dr["NoOfTotalTransactions"].ToString());
                Details.NoOfRefundTransactions = Int32.Parse(dr["NoOfRefundTransactions"].ToString());
                Details.NoOfVoidTransactions = Int32.Parse(dr["NoOfVoidTransactions"].ToString());
                Details.NoOfRewardPointsPayment = Int32.Parse(dr["NoOfRewardPointsPayment"].ToString());
                Details.NoOfTotalTransactions = Int32.Parse(dr["NoOfTotalTransactions"].ToString());
                Details.DateLastInitialized = DateTime.Parse(dr["DateLastInitialized"].ToString());
                Details.DateLastInitializedToDisplay = DateTime.Parse(dr["DateLastInitializedToDisplay"].ToString());
                Details.NoOfDiscountedTransactions = Int32.Parse(dr["NoOfDiscountedTransactions"].ToString());
                Details.NegativeAdjustments = decimal.Parse(dr["NegativeAdjustments"].ToString());
                Details.NoOfNegativeAdjustmentTransactions = Int32.Parse(dr["NoOfNegativeAdjustmentTransactions"].ToString());
                Details.PromotionalItems = decimal.Parse(dr["PromotionalItems"].ToString());
                Details.CreditSalesTax = decimal.Parse(dr["CreditSalesTax"].ToString());
                Details.BatchCounter = Int32.Parse(dr["BatchCounter"].ToString());
                Details.DebitDeposit = decimal.Parse(dr["DebitDeposit"].ToString());
                Details.NoOfReprintedTransaction = Int32.Parse(dr["NoOfReprintedTransaction"].ToString());
                Details.TotalReprintedTransaction = decimal.Parse(dr["TotalReprintedTransaction"].ToString());
                Details.NoOfConsignmentTransactions = Int32.Parse(dr["NoOfConsignmentTransactions"].ToString());
                Details.NoOfConsignmentRefundTransactions = Int32.Parse(dr["NoOfConsignmentRefundTransactions"].ToString());
                Details.NoOfWalkInTransactions = Int32.Parse(dr["NoOfWalkInTransactions"].ToString());
                Details.NoOfWalkInRefundTransactions = Int32.Parse(dr["NoOfWalkInRefundTransactions"].ToString());
                Details.NoOfOutOfStockTransactions = Int32.Parse(dr["NoOfOutOfStockTransactions"].ToString());
                Details.NoOfOutOfStockRefundTransactions = Int32.Parse(dr["NoOfOutOfStockRefundTransactions"].ToString());
                Details.ConsignmentSales = decimal.Parse(dr["ConsignmentSales"].ToString());
                Details.ConsignmentRefundSales = decimal.Parse(dr["ConsignmentRefundSales"].ToString());
                Details.WalkInSales = decimal.Parse(dr["WalkInSales"].ToString());
                Details.WalkInRefundSales = decimal.Parse(dr["WalkInRefundSales"].ToString());
                Details.OutOfStockSales = decimal.Parse(dr["OutOfStockSales"].ToString());
                Details.OutOfStockRefundSales = decimal.Parse(dr["OutOfStockRefundSales"].ToString());

                TerminalReportHistory clsTerminalReportHistory = new TerminalReportHistory(base.Connection, base.Transaction);
                Details.PREVDateLastInitialized = clsTerminalReportHistory.PREVDateLastInitialized(Details.BranchID, Details.TerminalNo, Details.DateLastInitialized);
                if (isCurrentZRead)
                    Details.NEXTDateLastInitialized = Constants.C_DATE_MIN_VALUE;
                else
                    Details.NEXTDateLastInitialized = clsTerminalReportHistory.NEXTDateLastInitialized(Details.BranchID, Details.TerminalNo, Details.DateLastInitialized);

                // overwrite coz this means that this is new
                if (Details.NEXTDateLastInitialized == Constants.C_DATE_MIN_VALUE) Details.NEXTDateLastInitialized = DateTime.Now;

                items.Add(Details);
            }

            if (items != null)
            {
                DetailsList = new TerminalReportDetails[items.Count];
                items.CopyTo(DetailsList);
            }

            return DetailsList;
        }