Ejemplo n.º 1
0
        public void PrintCashiersReport(Data.CashierReportDetails Details)
        {
            Cursor.Current = Cursors.WaitCursor;
            //OpenDrawerDelegate opendrawerDel = new OpenDrawerDelegate(OpenDrawer);
            //Invoke(opendrawerDel);
            OpenDrawer();

            try
            {
                decimal TrustFund = 0; //always put this as zero
                
                PrintingPreference oldCONFIG_AutoPrint = mclsTerminalDetails.AutoPrint;
                mclsTerminalDetails.AutoPrint = PrintingPreference.Normal;

                PrintReportHeadersSection(false);

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("Cashier's Report : " + mCashierName, mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);

                msbToPrint.Append("Gross Sales".PadRight(21) + ":" + ((Details.GrossSales + Details.TotalCharge) * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("(-) Service Charge".PadRight(21) + ":" + (Details.TotalCharge * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("".PadRight(21) + ":" + "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22, ' ') + Environment.NewLine);
                msbToPrint.Append("Total Amount".PadRight(21) + ":" + (Details.GrossSales * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append(("(-) " + mclsTerminalDetails.VAT.ToString("##") + "% VAT Exempt").PadRight(21) + ":" + (Details.VATExempt * (mclsTerminalDetails.VAT / 100) * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("(-) Discount".PadRight(21) + ":" + ((Details.SubTotalDiscount + Details.ItemsDiscount) * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("".PadRight(21) + ":" + "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22, ' ') + Environment.NewLine);
                msbToPrint.Append("Net Sales".PadRight(21) + ":" + (Details.NetSales * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("Taxables Breakdown", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("VAT Exempt".PadRight(21) + ":" + (Details.VATExempt * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("VAT Zero Rated".PadRight(21) + ":" + (Details.ZeroRatedSales * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("NonVATable Amount".PadRight(21) + ":" + (Details.NonVATableAmount * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("VATable Amount".PadRight(21) + ":" + (Details.VATableAmount * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("VAT".PadRight(21) + ":" + (Details.VAT * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Local Tax".PadRight(21) + ":" + (Details.LocalTax * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("Total Amount Breakdown", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("Cash Sales".PadRight(21) + ":" + (Details.CashSales * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Cheque Sales".PadRight(21) + ":" + (Details.ChequeSales * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Credit Card Sales".PadRight(21) + ":" + (Details.CreditCardSales * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Credit (Charge)".PadRight(21) + ":" + (Details.CreditSales * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Credit Payment".PadRight(21) + ":" + (Details.CreditPayment * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                msbToPrint.Append("      Cash".PadRight(21) + ":" + (Details.CreditPaymentCash * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("      Cheque".PadRight(21) + ":" + (Details.CreditPaymentCheque * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("      Credit Card".PadRight(21) + ":" + (Details.CreditPaymentCreditCard * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("      Debit".PadRight(21) + ":" + (Details.CreditPaymentDebit * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                msbToPrint.Append("Debit  Sales".PadRight(21) + ":" + (Details.DebitPayment * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("RewardPoints Redeemd".PadRight(21) + ":" + Details.RewardPointsPayment.ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("     Cash Equivalent".PadRight(21) + ":" + (Details.RewardConvertedPayment * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Employee Acct.".PadRight(21) + ":" + "0.00".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Void Sales".PadRight(21) + ":" + (Details.VoidSales * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Refund Sales".PadRight(21) + ":" + (Details.RefundSales * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("      Cash".PadRight(21) + ":" + (Details.RefundCash * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("      Cheque".PadRight(21) + ":" + (Details.RefundCheque * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("      Credit Card".PadRight(21) + ":" + (Details.RefundCreditCard * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("      Credit".PadRight(21) + ":" + (Details.RefundCredit * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("      Debit".PadRight(21) + ":" + (Details.RefundDebit * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;

                Data.TerminalReport clsTerminalReport = new Data.TerminalReport(mConnection, mTransaction);
                Data.TerminalReportDetails clsTerminalReportDetails = clsTerminalReport.Details(Details.BranchID, Details.TerminalNo);

                System.Data.DataTable dt = clsSalesTransactions.SalesPerCreditCard(Details.BranchID, Details.TerminalNo, Details.CashierID, clsTerminalReportDetails.DateLastInitialized, clsTerminalReportDetails.NEXTDateLastInitialized);
                clsSalesTransactions.CommitAndDispose();

                if (dt.Rows.Count > 0)
                {
                    msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                    msbToPrint.Append(CenterString("Credit Card Breakdown", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                    msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                    foreach (System.Data.DataRow dr in dt.Rows)
                    { msbToPrint.Append(dr["CardTypeCode"].ToString().PadRight(21) + ":" + (Convert.ToDecimal(dr["Amount"].ToString()) * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine); }
                    msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                }

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("Discounts", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("Items Discount".PadRight(21) + ":" + (Details.ItemsDiscount * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("     Senior Citizen".PadRight(21) + ":" + (Details.SNRItemsDiscount * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("     PWD".PadRight(21) + ":" + (Details.PWDItemsDiscount * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("     Others".PadRight(21) + ":" + (Details.OtherItemsDiscount * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Subtotal Discount".PadRight(21) + ":" + (Details.SubTotalDiscount * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("     Senior Citizen".PadRight(21) + ":" + (Details.SNRDiscount * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("     PWD".PadRight(21) + ":" + (Details.PWDDiscount * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("     Others".PadRight(21) + ":" + (Details.OtherDiscount * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("".PadRight(21) + ":" + "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22, ' ') + Environment.NewLine);
                msbToPrint.Append("Total Discounts".PadRight(21) + ":" + (Details.TotalDiscount * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;
                dt = clsSalesTransactions.Discounts(Details.BranchID, Details.TerminalNo, clsTerminalReportDetails.BeginningTransactionNo, clsTerminalReportDetails.EndingTransactionNo, Details.CashierID);
                clsSalesTransactions.CommitAndDispose();
                if (dt.Rows.Count > 0)
                {
                    msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                    msbToPrint.Append(CenterString("Subtotal Discounts Breakdown", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                    msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                    foreach (System.Data.DataRow dr in dt.Rows)
                    { msbToPrint.Append(dr["DiscountCode"].ToString().PadRight(21) + ":" + (Convert.ToDecimal(dr["Discount"].ToString()) * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine); }
                }

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("Drawer Information", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("Beginning Balance".PadRight(21) + ":" + (Details.BeginningBalance).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Cash-In-Drawer".PadRight(21) + ":" + (Details.BeginningBalance + ((Details.CashInDrawer - Details.BeginningBalance) * ((100 - TrustFund) / 100))).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("Paid Out", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("Paid Out".PadRight(21) + ":" + (Details.TotalPaidOut * ((100 - TrustFund) / 100)).ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("PICK UP / Disburstment", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("Cash".PadRight(21) + ":" + (Details.CashDisburse * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Cheque".PadRight(21) + ":" + (Details.ChequeDisburse * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Credit Card".PadRight(21) + ":" + (Details.CreditCardDisburse * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("Receive on Account", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("Cash".PadRight(21) + ":" + (Details.CashWithHold * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Cheque".PadRight(21) + ":" + (Details.ChequeWithHold * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Credit Card".PadRight(21) + ":" + (Details.CreditCardWithHold * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("Customer Deposits", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("Cash".PadRight(21) + ":" + (Details.CashDeposit * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Cheque".PadRight(21) + ":" + (Details.ChequeDeposit * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Credit Card".PadRight(21) + ":" + (Details.CreditCardDeposit * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("Transaction Count Breakdown", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("Cash Transactions".PadRight(21) + ":" + Details.NoOfCashTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Cheque Transactions".PadRight(21) + ":" + Details.NoOfChequeTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Credit Card Trans.".PadRight(21) + ":" + Details.NoOfCreditCardTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Credit Transactions".PadRight(21) + ":" + Details.NoOfCreditTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Debit Payment Trans.".PadRight(21) + ":" + Details.NoOfDebitPaymentTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Refund Transactions".PadRight(21) + ":" + Details.NoOfRefundTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Void Transactions".PadRight(21) + ":" + Details.NoOfVoidTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Combination Tran".PadRight(21) + ":" + Details.NoOfCombinationPaymentTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Credit Payment Trans".PadRight(21) + ":" + Details.NoOfCreditPaymentTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Reward Points  Trans".PadRight(21) + ":" + Details.NoOfRewardPointsPayment.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                //				msbToPrint.Append("Employees Acct Trans".PadRight(21) + ":" + "0".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22)  + Environment.NewLine);
                msbToPrint.Append("".PadRight(21) + ":" + "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22, ' ') + Environment.NewLine);
                msbToPrint.Append("Total Transactions".PadRight(21) + ":" + Details.NoOfTotalTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("Cash Count", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("Cash In Drawer".PadRight(21) + ":" + (Details.CashInDrawer * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Cash Count".PadRight(21) + ":" + (Details.CashCount * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                if (Details.CashInDrawer > Details.CashCount)
                {
                    decimal decShort = Details.CashInDrawer - Details.CashCount;
                    msbToPrint.Append("Short".PadRight(21) + ":" + decShort.ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                }
                else if (Details.CashCount > Details.CashInDrawer)
                {
                    decimal decOver = Details.CashCount - Details.CashInDrawer;
                    msbToPrint.Append("Over".PadRight(21) + ":" + decOver.ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                }
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("Misc Amount Breakdown", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("Consignment".PadRight(21) + ":" + (Details.ConsignmentSales * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Walk-In".PadRight(21) + ":" + (Details.WalkInSales * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Out Of Stock".PadRight(21) + ":" + (Details.OutOfStockSales * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("      Refund:" + Environment.NewLine);
                msbToPrint.Append("Consignment".PadRight(21) + ":" + (Details.ConsignmentRefundSales * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Walk-In".PadRight(21) + ":" + (Details.WalkInRefundSales * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Out Of Stock".PadRight(21) + ":" + (Details.OutOfStockRefundSales * ((100 - TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("Misc Trans Count Breakdown", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("Consignment Trans".PadRight(21) + ":" + Details.NoOfConsignmentTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Walk-In Trans".PadRight(21) + ":" + Details.NoOfWalkInTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Out Of Stock Trans".PadRight(21) + ":" + Details.NoOfOutOfStockTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("      Refund:" + Environment.NewLine);
                msbToPrint.Append("Consignment Trans".PadRight(21) + ":" + Details.NoOfConsignmentRefundTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Walk-In Trans".PadRight(21) + ":" + Details.NoOfWalkInRefundTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Out Of Stock Trans".PadRight(21) + ":" + Details.NoOfOutOfStockRefundTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);

                PrintPageAndReportFooterSection(false, DateTime.MinValue);

                mclsTerminalDetails.AutoPrint = oldCONFIG_AutoPrint;

                InsertAuditLog(AccessTypes.PrintCashierReport, "Print cashier report: CashInDrawer=" + Details.CashInDrawer.ToString("#,##0.#0") + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);
            }
            catch (Exception ex)
            {
                InsertErrorLogToFile(ex, "ERROR!!! Printing cashier report data. Err Description: ");
            }
            Cursor.Current = Cursors.Default;
        }
Ejemplo n.º 2
0
        public void PrintTerminalReportDetailsXRead(Data.TerminalReportDetails Details)
        {
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                Data.SysConfig clsSysConfig = new Data.SysConfig(mConnection, mTransaction);
                mConnection = clsSysConfig.Connection; mTransaction = clsSysConfig.Transaction;

                if (Int64.Parse(Details.BeginningORNo) == 0)
                    msbToPrint.Append("Beginning OR No.".PadRight(21) + ":" + (Details.BeginningORNo.Remove(Details.BeginningORNo.Length - 1) + "1").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                else
                    msbToPrint.Append("Beginning OR No.".PadRight(21) + ":" + Details.BeginningORNo.PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                msbToPrint.Append("Ending    OR No.".PadRight(21) + ":" + Details.EndingORNo.PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine + Environment.NewLine);
                msbToPrint.Append("Gross Sales".PadRight(21) + ":" + ((Details.GrossSales + Details.TotalCharge) * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("(-) Service Charge".PadRight(21) + ":" + (Details.TotalCharge * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("".PadRight(21) + ":" + "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22, ' ') + Environment.NewLine);
                msbToPrint.Append("Total Amount".PadRight(21) + ":" + (Details.GrossSales * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append(("(-) " + mclsTerminalDetails.VAT.ToString("##") + "% VAT Exempt").PadRight(21) + ":" + (Details.VATExempt * (mclsTerminalDetails.VAT / 100) * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("(-) Discount".PadRight(21) + ":" + ((Details.SubTotalDiscount + Details.ItemsDiscount) * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("".PadRight(21) + ":" + "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22, ' ') + Environment.NewLine);
                msbToPrint.Append("Net Sales".PadRight(21) + ":" + (Details.NetSales * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                if (mclsTerminalDetails.WillPrintGrandTotal == true)
                {
                    msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                    msbToPrint.Append("OLD GRAND TOTAL".PadRight(21) + ":" + (Details.eSalesOldGrandTotal).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                    msbToPrint.Append("This Total Amount".PadRight(21) + ":" + (Details.GrossSales * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                    msbToPrint.Append("".PadRight(21) + ":" + "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22, ' ') + Environment.NewLine);
                    msbToPrint.Append("NEW GRAND TOTAL".PadRight(21) + ":" + (Details.eSalesNewGrandTotal).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                    mclsSysConfigDetails.WillDeductTFInTerminalReport = clsSysConfig.get_WillDeductTFInTerminalReport();
                }

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("Taxables Breakdown", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("VAT Exempt".PadRight(21) + ":" + (Details.VATExempt * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("VAT Zero Rated".PadRight(21) + ":" + (Details.ZeroRatedSales * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("NonVATable Amount".PadRight(21) + ":" + (Details.NonVATableAmount * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("VATable Amount".PadRight(21) + ":" + (Details.VATableAmount * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("VAT".PadRight(21) + ":" + (Details.VAT * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Local Tax".PadRight(21) + ":" + (Details.LocalTax * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("Total Amount Breakdown", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("Cash Sales".PadRight(21) + ":" + (Details.CashSales * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Cheque Sales".PadRight(21) + ":" + (Details.ChequeSales * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Credit Card Sales".PadRight(21) + ":" + (Details.CreditCardSales * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Credit (Charge)".PadRight(21) + ":" + (Details.CreditSales * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Credit Payment".PadRight(21) + ":" + (Details.CreditPayment * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                msbToPrint.Append("      Cash".PadRight(21) + ":" + (Details.CreditPaymentCash * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("      Cheque".PadRight(21) + ":" + (Details.CreditPaymentCheque * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("      Credit Card".PadRight(21) + ":" + (Details.CreditPaymentCreditCard * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("      Debit".PadRight(21) + ":" + (Details.CreditPaymentDebit * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                msbToPrint.Append("Debit  Sales".PadRight(21) + ":" + (Details.DebitPayment * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("RewardPoints Redeemd".PadRight(21) + ":" + Details.RewardPointsPayment.ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("     Cash Equivalent".PadRight(21) + ":" + (Details.RewardConvertedPayment * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Employee Acct.".PadRight(21) + ":" + "0.00".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Void Sales".PadRight(21) + ":" + (Details.VoidSales * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Refund Sales".PadRight(21) + ":" + (Details.RefundSales * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("      Cash".PadRight(21) + ":" + (Details.RefundCash * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("      Cheque".PadRight(21) + ":" + (Details.RefundCheque * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("      Credit Card".PadRight(21) + ":" + (Details.RefundCreditCard * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("      Credit".PadRight(21) + ":" + (Details.RefundCredit * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("      Debit".PadRight(21) + ":" + (Details.RefundDebit * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction; // CashierID = 0 ALL
                System.Data.DataTable dt = clsSalesTransactions.SalesPerCreditCard(Details.BranchID, Details.TerminalNo, 0, Details.DateLastInitialized, Details.NEXTDateLastInitialized);
                clsSalesTransactions.CommitAndDispose();

                if (dt.Rows.Count > 0)
                {
                    msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                    msbToPrint.Append(CenterString("Credit Card Breakdown", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                    msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                    foreach (System.Data.DataRow dr in dt.Rows)
                    { msbToPrint.Append(dr["CardTypeCode"].ToString().PadRight(21) + ":" + (Convert.ToDecimal(dr["Amount"].ToString()) * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine); }
                    msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                }

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("Discounts", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("Items Discount".PadRight(21) + ":" + (Details.ItemsDiscount * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("     Senior Citizen".PadRight(21) + ":" + (Details.SNRItemsDiscount * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("     PWD".PadRight(21) + ":" + (Details.PWDItemsDiscount * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("     Other".PadRight(21) + ":" + (Details.OtherItemsDiscount * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Subtotal Discount".PadRight(21) + ":" + (Details.SubTotalDiscount * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("     Senior Citizen".PadRight(21) + ":" + (Details.SNRDiscount * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("     PWD".PadRight(21) + ":" + (Details.PWDDiscount * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("     Others".PadRight(21) + ":" + (Details.OtherDiscount * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("".PadRight(21) + ":" + "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22, ' ') + Environment.NewLine);
                msbToPrint.Append("Total Discounts".PadRight(21) + ":" + (Details.TotalDiscount * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;
                dt = clsSalesTransactions.Discounts(Details.BranchID, Details.TerminalNo, Details.BeginningTransactionNo, Details.EndingTransactionNo);
                clsSalesTransactions.CommitAndDispose();
                clsSysConfig.CommitAndDispose();

                if (dt.Rows.Count > 0)
                {
                    msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                    msbToPrint.Append(CenterString("Subtotal Discounts Breakdown", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                    msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                    foreach (System.Data.DataRow dr in dt.Rows)
                    { msbToPrint.Append(dr["DiscountCode"].ToString().PadRight(21) + ":" + (Convert.ToDecimal(dr["Discount"].ToString()) * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine); }
                }

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("Drawer Information", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("Beginning Balance".PadRight(21) + ":" + (Details.BeginningBalance).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Cash-In-Drawer".PadRight(21) + ":" + (Details.BeginningBalance + ((Details.CashInDrawer - Details.BeginningBalance) * ((100 - Details.TrustFund) / 100))).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("Paid Out", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("Paid Out".PadRight(21) + ":" + (Details.TotalPaidOut * ((100 - Details.TrustFund) / 100)).ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("PICK UP / Disburstment", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("Cash".PadRight(21) + ":" + (Details.CashDisburse * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Cheque".PadRight(21) + ":" + (Details.ChequeDisburse * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Credit Card".PadRight(21) + ":" + (Details.CreditCardDisburse * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("Receive on Account", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("Cash".PadRight(21) + ":" + (Details.CashWithHold * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Cheque".PadRight(21) + ":" + (Details.ChequeWithHold * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Credit Card".PadRight(21) + ":" + (Details.CreditCardWithHold * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("Customer Deposits", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("Cash".PadRight(21) + ":" + (Details.CashDeposit * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Cheque".PadRight(21) + ":" + (Details.ChequeDeposit * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Credit Card".PadRight(21) + ":" + (Details.CreditCardDeposit * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append(CenterString("Transaction Count Breakdown", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                msbToPrint.Append("Cash Transactions".PadRight(21) + ":" + Details.NoOfCashTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Cheque Transactions".PadRight(21) + ":" + Details.NoOfChequeTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Credit Card Trans.".PadRight(21) + ":" + Details.NoOfCreditCardTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Credit Transactions".PadRight(21) + ":" + Details.NoOfCreditTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Debit Payment Trans.".PadRight(21) + ":" + Details.NoOfDebitPaymentTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Refund Transactions".PadRight(21) + ":" + Details.NoOfRefundTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Void Transactions".PadRight(21) + ":" + Details.NoOfVoidTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Combination Tran".PadRight(21) + ":" + Details.NoOfCombinationPaymentTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Credit Payment Trans".PadRight(21) + ":" + Details.NoOfCreditPaymentTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                msbToPrint.Append("Reward Points  Trans".PadRight(21) + ":" + Details.NoOfRewardPointsPayment.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                //				msbToPrint.Append("Employees Acct Trans".PadRight(21) + ":" + "0".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22)  + Environment.NewLine);
                msbToPrint.Append("".PadRight(21) + ":" + "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22, ' ') + Environment.NewLine);
                msbToPrint.Append("Total Transactions".PadRight(21) + ":" + Details.NoOfTotalTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                //msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                //msbToPrint.Append(CenterString("Misc Amount Breakdown", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                //msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                //msbToPrint.Append("Consignment".PadRight(21) + ":" + (Details.ConsignmentSales * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                //msbToPrint.Append("Walk-In".PadRight(21) + ":" + (Details.WalkInSales * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                //msbToPrint.Append("Out Of Stock".PadRight(21) + ":" + (Details.OutOfStockSales * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                //msbToPrint.Append("      Refund:" + Environment.NewLine);
                //msbToPrint.Append("Consignment".PadRight(21) + ":" + (Details.ConsignmentRefundSales * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                //msbToPrint.Append("Walk-In".PadRight(21) + ":" + (Details.WalkInRefundSales * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                //msbToPrint.Append("Out Of Stock".PadRight(21) + ":" + (Details.OutOfStockRefundSales * ((100 - Details.TrustFund) / 100)).ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                //msbToPrint.Append("".PadRight(21) + ":" + "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22, ' ') + Environment.NewLine);
                //msbToPrint.Append("Consignment Trans".PadRight(21) + ":" + Details.NoOfConsignmentTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                //msbToPrint.Append("Walk-In Trans".PadRight(21) + ":" + Details.NoOfWalkInTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                //msbToPrint.Append("Out Of StockTrans".PadRight(21) + ":" + Details.NoOfOutOfStockTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                //msbToPrint.Append("      Refund:" + Environment.NewLine);
                //msbToPrint.Append("Consignment Trans".PadRight(21) + ":" + Details.NoOfConsignmentRefundTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                //msbToPrint.Append("Walk-In Trans".PadRight(21) + ":" + Details.NoOfWalkInRefundTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);
                //msbToPrint.Append("Out Of Stock Trans".PadRight(21) + ":" + Details.NoOfOutOfStockRefundTransactions.ToString("#,##0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 22) + Environment.NewLine);

                msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
            }
            catch (Exception ex)
            {
                InsertErrorLogToFile(ex, "ERROR!!! Printing terminal report details. Err Description: ");
            }
            Cursor.Current = Cursors.Default;
        }
Ejemplo n.º 3
0
        private void PopulateCashiersReport()
        {
            Receipt clsReceipt = new Receipt();
            clsReceipt.GetConnection();

            Data.TerminalReportDetails clsTerminalReportDetails = new Data.TerminalReport(clsReceipt.Connection, clsReceipt.Transaction).Details(mclsDetails.BranchID, mclsDetails.TerminalNo);

            mclsTerminalDetails.MaxReceiptWidth = 94;

            System.Data.DataTable dt = new System.Data.DataTable("tblTerminalReport");
            dt.Columns.Add("Module");
            dt.Columns.Add("Separator");
            dt.Columns.Add("Value");
            //dt.Rows.Add(CenterString(CompanyDetails.CompanyCode, mclsTerminalDetails.MaxReceiptWidth));
            //dt.Rows.Add("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-'));
            //dt.Rows.Add(CenterString("Terminal Report", mclsTerminalDetails.MaxReceiptWidth));
            //dt.Rows.Add("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-'));

            //string strReportHeader1 = clsReceipt.Details("ReportHeader1").Value;
            //string strReportHeader2 = clsReceipt.Details("ReportHeader2").Value;
            //string strReportHeader3 = clsReceipt.Details("ReportHeader3").Value;
            //string strReportHeader4 = clsReceipt.Details("ReportHeader4").Value;
            //if (!string.IsNullOrEmpty(strReportHeader1)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportHeader1), mclsTerminalDetails.MaxReceiptWidth));
            //if (!string.IsNullOrEmpty(strReportHeader2)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportHeader2), mclsTerminalDetails.MaxReceiptWidth));
            //if (!string.IsNullOrEmpty(strReportHeader3)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportHeader3), mclsTerminalDetails.MaxReceiptWidth));
            //if (!string.IsNullOrEmpty(strReportHeader4)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportHeader4), mclsTerminalDetails.MaxReceiptWidth));

            dt.Rows.Add("Gross Sales", ":", (mclsDetails.GrossSales + mclsDetails.TotalCharge).ToString("#,##0.#0"));
            dt.Rows.Add("(-) Service Charge", ":", mclsDetails.TotalCharge.ToString("#,##0.#0"));
            dt.Rows.Add("", ":", "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 66, '-'));
            dt.Rows.Add("Total Amount", ":", mclsDetails.GrossSales.ToString("#,##0.#0"));
            dt.Rows.Add("(-) " + mclsTerminalDetails.VAT.ToString("##") + "% VAT Exempt ", ":", (mclsDetails.VATExempt * (mclsTerminalDetails.VAT / 100)).ToString("#,##0.#0"));
            dt.Rows.Add("(-) Subtotal Discount", ":", mclsDetails.SubTotalDiscount.ToString("#,##0.#0"));
            dt.Rows.Add("", ":", "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 66, '-'));
            dt.Rows.Add("Net Sales", ":", mclsDetails.NetSales.ToString("#,##0.#0"));

            dt.Rows.Add("Taxables Breakdown", "", "");
            dt.Rows.Add("VAT Exempt", ":", mclsDetails.VATExempt.ToString("#,##0.00"));
            dt.Rows.Add("VAT Zero Rated", ":", mclsDetails.ZeroRatedSales.ToString("#,##0.00"));
            dt.Rows.Add("NonVATable Amount", ":", mclsDetails.NonVATableAmount.ToString("#,##0.00"));
            dt.Rows.Add("VATable Amount", ":", mclsDetails.VATableAmount.ToString("#,##0.00"));
            dt.Rows.Add(mclsTerminalDetails.VAT.ToString("##") + "% VAT", ":", mclsDetails.VAT.ToString("#,##0.00"));
            dt.Rows.Add("Local Tax", ":", mclsDetails.LocalTax.ToString("#,##0.00"));

            dt.Rows.Add("Total Amount Breakdown", "", "");
            dt.Rows.Add("Cash Sales", ":", mclsDetails.CashSales.ToString("#,##0.00"));
            dt.Rows.Add("Cheque Sales", ":", mclsDetails.ChequeSales.ToString("#,##0.00"));
            dt.Rows.Add("Credit Card Sales", ":", mclsDetails.CreditCardSales.ToString("#,##0.00"));
            dt.Rows.Add("Credit (Charge)", ":", mclsDetails.CreditSales.ToString("#,##0.00"));
            dt.Rows.Add("Credit Payment", ":", mclsDetails.CreditPayment.ToString("#,##0.00"));
            dt.Rows.Add("      Cash", ":", mclsDetails.CreditPaymentCash.ToString("#,##0.00"));
            dt.Rows.Add("      Cheque", ":", mclsDetails.CreditPaymentCheque.ToString("#,##0.00"));
            dt.Rows.Add("      Credit Card", ":", mclsDetails.CreditPaymentCreditCard.ToString("#,##0.00"));
            dt.Rows.Add("      Debit", ":", mclsDetails.CreditPaymentDebit.ToString("#,##0.00"));
            dt.Rows.Add("Debit Sales", ":", mclsDetails.DebitPayment.ToString("#,##0.00"));
            dt.Rows.Add("     Rewards Points Redeemed", ":", mclsDetails.RewardPointsPayment.ToString("#,##0.00"));
            dt.Rows.Add("Employee Acct.", ":", "0.00");
            dt.Rows.Add("Void Sales", ":", mclsDetails.VoidSales.ToString("#,##0.00"));
            dt.Rows.Add("Refund Sales", ":", mclsDetails.RefundSales.ToString("#,##0.00"));
            dt.Rows.Add("      Cash", ":", mclsDetails.RefundCash.ToString("#,##0.00"));
            dt.Rows.Add("      Cheque", ":", mclsDetails.RefundCheque.ToString("#,##0.00"));
            dt.Rows.Add("      Credit Card", ":", mclsDetails.RefundCreditCard.ToString("#,##0.00"));
            dt.Rows.Add("      Credit", ":", mclsDetails.RefundCredit.ToString("#,##0.00"));
            dt.Rows.Add("      Debit", ":", mclsDetails.RefundDebit.ToString("#,##0.00"));

            Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(clsReceipt.Connection, clsReceipt.Transaction);
            // CashierID = 0 ALL

            Data.TerminalReport clsTerminalReport = new Data.TerminalReport(clsReceipt.Connection, clsReceipt.Transaction);
            System.Data.DataTable dtCreditCards = clsSalesTransactions.SalesPerCreditCard(mclsDetails.BranchID, mclsDetails.TerminalNo, mclsDetails.CashierID, clsTerminalReportDetails.DateLastInitialized, clsTerminalReportDetails.NEXTDateLastInitialized);

            if (dtCreditCards.Rows.Count > 0)
            {
                dt.Rows.Add("-", "-", "-");
                dt.Rows.Add("Credit Card Breakdown", "", "");
                dt.Rows.Add("-", "-", "-");
                foreach (System.Data.DataRow dr in dtCreditCards.Rows)
                {
                    dt.Rows.Add(dr["CardTypeCode"].ToString(), ":", decimal.Parse(dr["Amount"].ToString()).ToString("#,##0.00"));
                }
            }

            dt.Rows.Add("Discounts", "", "");
            dt.Rows.Add("Items Discount", ":", mclsDetails.ItemsDiscount.ToString("#,##0.00"));
            dt.Rows.Add("Subtotal Discount", ":", mclsDetails.SubTotalDiscount.ToString("#,##0.00"));
            dt.Rows.Add("     Senior Citizen", ":", mclsDetails.SNRDiscount.ToString("#,##0.00"));
            dt.Rows.Add("     PWD", ":", mclsDetails.PWDDiscount.ToString("#,##0.00"));
            dt.Rows.Add("     Others", ":", mclsDetails.OtherDiscount.ToString("#,##0.00"));
            dt.Rows.Add("Total Discounts", ":", mclsDetails.TotalDiscount.ToString("#,##0.00"));

            clsSalesTransactions = new Data.SalesTransactions(clsReceipt.Connection, clsReceipt.Transaction);

            System.Data.DataTable dtDiscounts = clsSalesTransactions.Discounts(mclsDetails.BranchID, mclsDetails.TerminalNo, clsTerminalReportDetails.BeginningTransactionNo, clsTerminalReportDetails.EndingTransactionNo);
            if (dtDiscounts.Rows.Count > 0)
            {
                dt.Rows.Add("-", "-", "-");
                dt.Rows.Add("Subtotal Discounts Breakdown", "", "");
                dt.Rows.Add("-", "-", "-");
                foreach (System.Data.DataRow dr in dtDiscounts.Rows)
                {
                    dt.Rows.Add(dr["DiscountCode"].ToString(), ":", decimal.Parse(dr["Discount"].ToString()).ToString("#,##0.00"));
                }
            }

            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Drawer Information", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Beginning Balance", ":", mclsDetails.BeginningBalance.ToString("#,##0.00"));
            dt.Rows.Add("Cash In Drawer", ":", mclsDetails.CashInDrawer.ToString("#,##0.00"));
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Paid Out", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Paid Out", ":", mclsDetails.TotalPaidOut.ToString("#,##0.00"));
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("PICK UP / Disburstment", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Cash", ":", mclsDetails.CashDisburse.ToString("#,##0.00"));
            dt.Rows.Add("Cheque", ":", mclsDetails.ChequeDisburse.ToString("#,##0.00"));
            dt.Rows.Add("Credit Card", ":", mclsDetails.CreditCardDisburse.ToString("#,##0.00"));
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Receive on Account", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Cash", ":", mclsDetails.CashWithHold.ToString("#,##0.00"));
            dt.Rows.Add("Cheque", ":", mclsDetails.ChequeWithHold.ToString("#,##0.00"));
            dt.Rows.Add("Credit Card", ":", mclsDetails.CreditCardWithHold.ToString("#,##0.00"));
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Customer Deposits", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Cash", ":", mclsDetails.CashDeposit.ToString("#,##0.00"));
            dt.Rows.Add("Cheque", ":", mclsDetails.ChequeDeposit.ToString("#,##0.00"));
            dt.Rows.Add("Credit Card", ":", mclsDetails.CreditCardDeposit.ToString("#,##0.00"));
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Transaction Count Breakdown", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Cash Transactions", ":", mclsDetails.NoOfCashTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Cheque Transactions", ":", mclsDetails.NoOfChequeTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Credit Card Transactions", ":", mclsDetails.NoOfCreditCardTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Credit Transactions", ":", mclsDetails.NoOfCreditTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Debit Transactions", ":", mclsDetails.NoOfDebitPaymentTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Refund Transactions", ":", mclsDetails.NoOfRefundTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Void Transactions", ":", mclsDetails.NoOfVoidTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Combination Trans", ":", mclsDetails.NoOfCombinationPaymentTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Credit Payment Trans", ":", mclsDetails.NoOfCreditPaymentTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Reward Points Trans", ":", mclsDetails.NoOfRewardPointsPayment.ToString("#,##0.00"));

            dt.Rows.Add("", ":", "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 66, '-'));
            dt.Rows.Add("Total Transactions", ":", mclsDetails.NoOfTotalTransactions.ToString("#,##0.00"));

            dt.Rows.Add("Misc Amount Breakdown", "", "");
            dt.Rows.Add("    Consignment", ":", mclsDetails.ConsignmentSales.ToString("#,##0.00"));
            dt.Rows.Add("    Walk-In", ":", mclsDetails.WalkInSales.ToString("#,##0.00"));
            dt.Rows.Add("    Out Of Stock", ":", mclsDetails.OutOfStockSales.ToString("#,##0.00"));
            dt.Rows.Add("Refund - Misc Amount Breakdown", "", "");
            dt.Rows.Add("    Consignment", ":", mclsDetails.ConsignmentRefundSales.ToString("#,##0.00"));
            dt.Rows.Add("    Walk-In", ":", mclsDetails.WalkInRefundSales.ToString("#,##0.00"));
            dt.Rows.Add("    Out Of Stock", ":", mclsDetails.OutOfStockRefundSales.ToString("#,##0.00"));
            dt.Rows.Add("Misc Trans Breakdown", "", "");
            dt.Rows.Add("    Consignment Trans", ":", mclsDetails.NoOfConsignmentTransactions.ToString("#,##0.00"));
            dt.Rows.Add("    Walk-In Trans", ":", mclsDetails.NoOfWalkInTransactions.ToString("#,##0.00"));
            dt.Rows.Add("    Out Of Stock Trans", ":", mclsDetails.NoOfOutOfStockTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Refund - Misc Trans Breakdown", "", "");
            dt.Rows.Add("    Consignment Trans", ":", mclsDetails.NoOfConsignmentRefundTransactions.ToString("#,##0.00"));
            dt.Rows.Add("    Walk-In Trans", ":", mclsDetails.NoOfWalkInRefundTransactions.ToString("#,##0.00"));
            dt.Rows.Add("    Out Of Stock Trans", ":", mclsDetails.NoOfOutOfStockRefundTransactions.ToString("#,##0.00"));

            string strReportFooter1 = clsReceipt.Details("ReportFooter1").Value;
            string strReportFooter2 = clsReceipt.Details("ReportFooter2").Value;
            string strReportFooter3 = clsReceipt.Details("ReportFooter3").Value;
            if (!string.IsNullOrEmpty(strReportFooter1)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportFooter1), mclsTerminalDetails.MaxReceiptWidth));
            if (!string.IsNullOrEmpty(strReportFooter2)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportFooter2), mclsTerminalDetails.MaxReceiptWidth));
            if (!string.IsNullOrEmpty(strReportFooter3)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportFooter3), mclsTerminalDetails.MaxReceiptWidth));

            clsReceipt.CommitAndDispose();

            dgvItems.MultiSelect = true;
            dgvItems.AutoGenerateColumns = true;
            dgvItems.AutoSize = true;
            dgvItems.ScrollBars = ScrollBars.Vertical;
            dgvItems.DataSource = dt.TableName;
            dgvItems.DataSource = dt;

            //dgvItems.Columns["ReportValue"].Visible = true;
            //dgvItems.Columns["ReportValue"].HeaderText = "";
            //dgvItems.Columns["ReportValue"].Width = 388;

            dgvItems.Columns["Module"].Visible = true;
            dgvItems.Columns["Separator"].Visible = true;
            dgvItems.Columns["Value"].Visible = true;

            dgvItems.Columns["Module"].HeaderText = "";
            dgvItems.Columns["Separator"].HeaderText = "";
            dgvItems.Columns["Value"].HeaderText = "";

            dgvItems.Columns["Module"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
            dgvItems.Columns["Separator"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgvItems.Columns["Value"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;

            dgvItems.Columns["Module"].Width = 230;
            dgvItems.Columns["Separator"].Width = 20;
            dgvItems.Columns["Value"].Width = dgvItems.Width-250-20;

        }
Ejemplo n.º 4
0
        private void PopulateCashiersReport()
        {
            Receipt clsReceipt = new Receipt();

            clsReceipt.GetConnection();

            Data.TerminalReportDetails clsTerminalReportDetails = new Data.TerminalReport(clsReceipt.Connection, clsReceipt.Transaction).Details(mclsDetails.BranchID, mclsDetails.TerminalNo);

            mclsTerminalDetails.MaxReceiptWidth = 94;

            System.Data.DataTable dt = new System.Data.DataTable("tblTerminalReport");
            dt.Columns.Add("Module");
            dt.Columns.Add("Separator");
            dt.Columns.Add("Value");
            //dt.Rows.Add(CenterString(CompanyDetails.CompanyCode, mclsTerminalDetails.MaxReceiptWidth));
            //dt.Rows.Add("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-'));
            //dt.Rows.Add(CenterString("Terminal Report", mclsTerminalDetails.MaxReceiptWidth));
            //dt.Rows.Add("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-'));

            //string strReportHeader1 = clsReceipt.Details("ReportHeader1").Value;
            //string strReportHeader2 = clsReceipt.Details("ReportHeader2").Value;
            //string strReportHeader3 = clsReceipt.Details("ReportHeader3").Value;
            //string strReportHeader4 = clsReceipt.Details("ReportHeader4").Value;
            //if (!string.IsNullOrEmpty(strReportHeader1)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportHeader1), mclsTerminalDetails.MaxReceiptWidth));
            //if (!string.IsNullOrEmpty(strReportHeader2)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportHeader2), mclsTerminalDetails.MaxReceiptWidth));
            //if (!string.IsNullOrEmpty(strReportHeader3)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportHeader3), mclsTerminalDetails.MaxReceiptWidth));
            //if (!string.IsNullOrEmpty(strReportHeader4)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportHeader4), mclsTerminalDetails.MaxReceiptWidth));

            dt.Rows.Add("Gross Sales", ":", (mclsDetails.GrossSales + mclsDetails.TotalCharge).ToString("#,##0.#0"));
            dt.Rows.Add("(-) Service Charge", ":", mclsDetails.TotalCharge.ToString("#,##0.#0"));
            dt.Rows.Add("", ":", "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 66, '-'));
            dt.Rows.Add("Total Amount", ":", mclsDetails.GrossSales.ToString("#,##0.#0"));
            dt.Rows.Add("(-) " + mclsTerminalDetails.VAT.ToString("##") + "% VAT Exempt ", ":", (mclsDetails.VATExempt * (mclsTerminalDetails.VAT / 100)).ToString("#,##0.#0"));
            dt.Rows.Add("(-) Subtotal Discount", ":", mclsDetails.SubTotalDiscount.ToString("#,##0.#0"));
            dt.Rows.Add("", ":", "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 66, '-'));
            dt.Rows.Add("Net Sales", ":", mclsDetails.NetSales.ToString("#,##0.#0"));

            dt.Rows.Add("Taxables Breakdown", "", "");
            dt.Rows.Add("VAT Exempt", ":", mclsDetails.VATExempt.ToString("#,##0.00"));
            dt.Rows.Add("VAT Zero Rated", ":", mclsDetails.ZeroRatedSales.ToString("#,##0.00"));
            dt.Rows.Add("NonVATable Amount", ":", mclsDetails.NonVATableAmount.ToString("#,##0.00"));
            dt.Rows.Add("VATable Amount", ":", mclsDetails.VATableAmount.ToString("#,##0.00"));
            dt.Rows.Add(mclsTerminalDetails.VAT.ToString("##") + "% VAT", ":", mclsDetails.VAT.ToString("#,##0.00"));
            dt.Rows.Add("Local Tax", ":", mclsDetails.LocalTax.ToString("#,##0.00"));

            dt.Rows.Add("Total Amount Breakdown", "", "");
            dt.Rows.Add("Cash Sales", ":", mclsDetails.CashSales.ToString("#,##0.00"));
            dt.Rows.Add("Cheque Sales", ":", mclsDetails.ChequeSales.ToString("#,##0.00"));
            dt.Rows.Add("Credit Card Sales", ":", mclsDetails.CreditCardSales.ToString("#,##0.00"));
            dt.Rows.Add("Credit (Charge)", ":", mclsDetails.CreditSales.ToString("#,##0.00"));
            dt.Rows.Add("Credit Payment", ":", mclsDetails.CreditPayment.ToString("#,##0.00"));
            dt.Rows.Add("      Cash", ":", mclsDetails.CreditPaymentCash.ToString("#,##0.00"));
            dt.Rows.Add("      Cheque", ":", mclsDetails.CreditPaymentCheque.ToString("#,##0.00"));
            dt.Rows.Add("      Credit Card", ":", mclsDetails.CreditPaymentCreditCard.ToString("#,##0.00"));
            dt.Rows.Add("      Debit", ":", mclsDetails.CreditPaymentDebit.ToString("#,##0.00"));
            dt.Rows.Add("Debit Sales", ":", mclsDetails.DebitPayment.ToString("#,##0.00"));
            dt.Rows.Add("     Rewards Points Redeemed", ":", mclsDetails.RewardPointsPayment.ToString("#,##0.00"));
            dt.Rows.Add("Employee Acct.", ":", "0.00");
            dt.Rows.Add("Void Sales", ":", mclsDetails.VoidSales.ToString("#,##0.00"));
            dt.Rows.Add("Refund Sales", ":", mclsDetails.RefundSales.ToString("#,##0.00"));
            dt.Rows.Add("      Cash", ":", mclsDetails.RefundCash.ToString("#,##0.00"));
            dt.Rows.Add("      Cheque", ":", mclsDetails.RefundCheque.ToString("#,##0.00"));
            dt.Rows.Add("      Credit Card", ":", mclsDetails.RefundCreditCard.ToString("#,##0.00"));
            dt.Rows.Add("      Credit", ":", mclsDetails.RefundCredit.ToString("#,##0.00"));
            dt.Rows.Add("      Debit", ":", mclsDetails.RefundDebit.ToString("#,##0.00"));

            Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(clsReceipt.Connection, clsReceipt.Transaction);
            // CashierID = 0 ALL

            Data.TerminalReport   clsTerminalReport = new Data.TerminalReport(clsReceipt.Connection, clsReceipt.Transaction);
            System.Data.DataTable dtCreditCards     = clsSalesTransactions.SalesPerCreditCard(mclsDetails.BranchID, mclsDetails.TerminalNo, mclsDetails.CashierID, clsTerminalReportDetails.DateLastInitialized, clsTerminalReportDetails.NEXTDateLastInitialized);

            if (dtCreditCards.Rows.Count > 0)
            {
                dt.Rows.Add("-", "-", "-");
                dt.Rows.Add("Credit Card Breakdown", "", "");
                dt.Rows.Add("-", "-", "-");
                foreach (System.Data.DataRow dr in dtCreditCards.Rows)
                {
                    dt.Rows.Add(dr["CardTypeCode"].ToString(), ":", decimal.Parse(dr["Amount"].ToString()).ToString("#,##0.00"));
                }
            }

            dt.Rows.Add("Discounts", "", "");
            dt.Rows.Add("Items Discount", ":", mclsDetails.ItemsDiscount.ToString("#,##0.00"));
            dt.Rows.Add("Subtotal Discount", ":", mclsDetails.SubTotalDiscount.ToString("#,##0.00"));
            dt.Rows.Add("     Senior Citizen", ":", mclsDetails.SNRDiscount.ToString("#,##0.00"));
            dt.Rows.Add("     PWD", ":", mclsDetails.PWDDiscount.ToString("#,##0.00"));
            dt.Rows.Add("     Others", ":", mclsDetails.OtherDiscount.ToString("#,##0.00"));
            dt.Rows.Add("Total Discounts", ":", mclsDetails.TotalDiscount.ToString("#,##0.00"));

            clsSalesTransactions = new Data.SalesTransactions(clsReceipt.Connection, clsReceipt.Transaction);

            System.Data.DataTable dtDiscounts = clsSalesTransactions.Discounts(mclsDetails.BranchID, mclsDetails.TerminalNo, clsTerminalReportDetails.BeginningTransactionNo, clsTerminalReportDetails.EndingTransactionNo);
            if (dtDiscounts.Rows.Count > 0)
            {
                dt.Rows.Add("-", "-", "-");
                dt.Rows.Add("Subtotal Discounts Breakdown", "", "");
                dt.Rows.Add("-", "-", "-");
                foreach (System.Data.DataRow dr in dtDiscounts.Rows)
                {
                    dt.Rows.Add(dr["DiscountCode"].ToString(), ":", decimal.Parse(dr["Discount"].ToString()).ToString("#,##0.00"));
                }
            }

            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Drawer Information", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Beginning Balance", ":", mclsDetails.BeginningBalance.ToString("#,##0.00"));
            dt.Rows.Add("Cash In Drawer", ":", mclsDetails.CashInDrawer.ToString("#,##0.00"));
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Paid Out", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Paid Out", ":", mclsDetails.TotalPaidOut.ToString("#,##0.00"));
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("PICK UP / Disburstment", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Cash", ":", mclsDetails.CashDisburse.ToString("#,##0.00"));
            dt.Rows.Add("Cheque", ":", mclsDetails.ChequeDisburse.ToString("#,##0.00"));
            dt.Rows.Add("Credit Card", ":", mclsDetails.CreditCardDisburse.ToString("#,##0.00"));
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Receive on Account", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Cash", ":", mclsDetails.CashWithHold.ToString("#,##0.00"));
            dt.Rows.Add("Cheque", ":", mclsDetails.ChequeWithHold.ToString("#,##0.00"));
            dt.Rows.Add("Credit Card", ":", mclsDetails.CreditCardWithHold.ToString("#,##0.00"));
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Customer Deposits", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Cash", ":", mclsDetails.CashDeposit.ToString("#,##0.00"));
            dt.Rows.Add("Cheque", ":", mclsDetails.ChequeDeposit.ToString("#,##0.00"));
            dt.Rows.Add("Credit Card", ":", mclsDetails.CreditCardDeposit.ToString("#,##0.00"));
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Transaction Count Breakdown", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Cash Transactions", ":", mclsDetails.NoOfCashTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Cheque Transactions", ":", mclsDetails.NoOfChequeTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Credit Card Transactions", ":", mclsDetails.NoOfCreditCardTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Credit Transactions", ":", mclsDetails.NoOfCreditTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Debit Transactions", ":", mclsDetails.NoOfDebitPaymentTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Refund Transactions", ":", mclsDetails.NoOfRefundTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Void Transactions", ":", mclsDetails.NoOfVoidTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Combination Trans", ":", mclsDetails.NoOfCombinationPaymentTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Credit Payment Trans", ":", mclsDetails.NoOfCreditPaymentTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Reward Points Trans", ":", mclsDetails.NoOfRewardPointsPayment.ToString("#,##0.00"));

            dt.Rows.Add("", ":", "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 66, '-'));
            dt.Rows.Add("Total Transactions", ":", mclsDetails.NoOfTotalTransactions.ToString("#,##0.00"));

            dt.Rows.Add("Misc Amount Breakdown", "", "");
            dt.Rows.Add("    Consignment", ":", mclsDetails.ConsignmentSales.ToString("#,##0.00"));
            dt.Rows.Add("    Walk-In", ":", mclsDetails.WalkInSales.ToString("#,##0.00"));
            dt.Rows.Add("    Out Of Stock", ":", mclsDetails.OutOfStockSales.ToString("#,##0.00"));
            dt.Rows.Add("Refund - Misc Amount Breakdown", "", "");
            dt.Rows.Add("    Consignment", ":", mclsDetails.ConsignmentRefundSales.ToString("#,##0.00"));
            dt.Rows.Add("    Walk-In", ":", mclsDetails.WalkInRefundSales.ToString("#,##0.00"));
            dt.Rows.Add("    Out Of Stock", ":", mclsDetails.OutOfStockRefundSales.ToString("#,##0.00"));
            dt.Rows.Add("Misc Trans Breakdown", "", "");
            dt.Rows.Add("    Consignment Trans", ":", mclsDetails.NoOfConsignmentTransactions.ToString("#,##0.00"));
            dt.Rows.Add("    Walk-In Trans", ":", mclsDetails.NoOfWalkInTransactions.ToString("#,##0.00"));
            dt.Rows.Add("    Out Of Stock Trans", ":", mclsDetails.NoOfOutOfStockTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Refund - Misc Trans Breakdown", "", "");
            dt.Rows.Add("    Consignment Trans", ":", mclsDetails.NoOfConsignmentRefundTransactions.ToString("#,##0.00"));
            dt.Rows.Add("    Walk-In Trans", ":", mclsDetails.NoOfWalkInRefundTransactions.ToString("#,##0.00"));
            dt.Rows.Add("    Out Of Stock Trans", ":", mclsDetails.NoOfOutOfStockRefundTransactions.ToString("#,##0.00"));

            string strReportFooter1 = clsReceipt.Details("ReportFooter1").Value;
            string strReportFooter2 = clsReceipt.Details("ReportFooter2").Value;
            string strReportFooter3 = clsReceipt.Details("ReportFooter3").Value;

            if (!string.IsNullOrEmpty(strReportFooter1))
            {
                dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportFooter1), mclsTerminalDetails.MaxReceiptWidth));
            }
            if (!string.IsNullOrEmpty(strReportFooter2))
            {
                dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportFooter2), mclsTerminalDetails.MaxReceiptWidth));
            }
            if (!string.IsNullOrEmpty(strReportFooter3))
            {
                dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportFooter3), mclsTerminalDetails.MaxReceiptWidth));
            }

            clsReceipt.CommitAndDispose();

            dgvItems.MultiSelect         = true;
            dgvItems.AutoGenerateColumns = true;
            dgvItems.AutoSize            = true;
            dgvItems.ScrollBars          = ScrollBars.Vertical;
            dgvItems.DataSource          = dt.TableName;
            dgvItems.DataSource          = dt;

            //dgvItems.Columns["ReportValue"].Visible = true;
            //dgvItems.Columns["ReportValue"].HeaderText = "";
            //dgvItems.Columns["ReportValue"].Width = 388;

            dgvItems.Columns["Module"].Visible    = true;
            dgvItems.Columns["Separator"].Visible = true;
            dgvItems.Columns["Value"].Visible     = true;

            dgvItems.Columns["Module"].HeaderText    = "";
            dgvItems.Columns["Separator"].HeaderText = "";
            dgvItems.Columns["Value"].HeaderText     = "";

            dgvItems.Columns["Module"].DefaultCellStyle.Alignment    = DataGridViewContentAlignment.MiddleLeft;
            dgvItems.Columns["Separator"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgvItems.Columns["Value"].DefaultCellStyle.Alignment     = DataGridViewContentAlignment.MiddleRight;

            dgvItems.Columns["Module"].Width    = 230;
            dgvItems.Columns["Separator"].Width = 20;
            dgvItems.Columns["Value"].Width     = dgvItems.Width - 250 - 20;
        }
Ejemplo n.º 5
0
        private void PopulateTerminalReport()
        {
            Receipt clsReceipt = new Receipt();

            mclsTerminalDetails.MaxReceiptWidth = 94;

            System.Data.DataTable dt = new System.Data.DataTable("tblTerminalReport");
            dt.Columns.Add("Module");
            dt.Columns.Add("Separator");
            dt.Columns.Add("Value");

            //dt.Rows.Add(CenterString(CompanyDetails.CompanyCode, mclsTerminalDetails.MaxReceiptWidth));
            //dt.Rows.Add("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-'));
            //dt.Rows.Add(CenterString("Terminal Report", mclsTerminalDetails.MaxReceiptWidth));
            //dt.Rows.Add("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-'));

            //string strReportHeader1 = clsReceipt.Details("ReportHeader1").Value;
            //string strReportHeader2 = clsReceipt.Details("ReportHeader2").Value;
            //string strReportHeader3 = clsReceipt.Details("ReportHeader3").Value;
            //string strReportHeader4 = clsReceipt.Details("ReportHeader4").Value;
            //if (!string.IsNullOrEmpty(strReportHeader1)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportHeader1), mclsTerminalDetails.MaxReceiptWidth));
            //if (!string.IsNullOrEmpty(strReportHeader2)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportHeader2), mclsTerminalDetails.MaxReceiptWidth));
            //if (!string.IsNullOrEmpty(strReportHeader3)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportHeader3), mclsTerminalDetails.MaxReceiptWidth));
            //if (!string.IsNullOrEmpty(strReportHeader4)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportHeader4), mclsTerminalDetails.MaxReceiptWidth));

            if (Int64.Parse(mclsDetails.BeginningORNo) == 0)
            {
                dt.Rows.Add("Beginning OR No.", ":", mclsDetails.BeginningORNo.Remove(mclsDetails.BeginningORNo.Length - 1) + "1");
            }
            else
            {
                dt.Rows.Add("Beginning OR No.", ":", mclsDetails.BeginningORNo);
            }

            dt.Rows.Add("Ending OR No.", ":", mclsDetails.EndingORNo);
            dt.Rows.Add("", "", "");
            dt.Rows.Add("Gross Sales", ":", ((mclsDetails.GrossSales + mclsDetails.TotalCharge)).ToString("#,##0.#0"));
            dt.Rows.Add("(-) Service Charge", ":", mclsDetails.TotalCharge.ToString("#,##0.#0"));
            dt.Rows.Add("", ":", "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 66, '-'));
            dt.Rows.Add("Total Amount", ":", (mclsDetails.GrossSales).ToString("#,##0.#0"));
            dt.Rows.Add("(-) " + mclsTerminalDetails.VAT.ToString("##") + "% VAT Exempt ", ":", (mclsDetails.VATExempt * (mclsTerminalDetails.VAT / 100)).ToString("#,##0.#0"));
            dt.Rows.Add("(-) Discount", ":", (mclsDetails.SubTotalDiscount + mclsDetails.ItemsDiscount).ToString("#,##0.#0"));
            dt.Rows.Add("", ":", "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 66, '-'));
            dt.Rows.Add("Net Sales", ":", (mclsDetails.NetSales).ToString("#,##0.#0"));

            if (mclsTerminalDetails.WillPrintGrandTotal == true)
            {
                //switch (mTerminalReportType)
                //{
                //    case Reports.TerminalReportType.XRead:
                //    case Reports.TerminalReportType.TerminalReport:
                //    case Reports.TerminalReportType.CashiersTerminalReport:
                //        dt.Rows.Add("-", "-", "-");
                //        dt.Rows.Add("OLD GRAND TOTAL", ":", (mclsDetails.eSalesOldGrandTotal).ToString("#,##0.#0"));
                //        dt.Rows.Add("This Total Amount", ":", (mclsDetails.GrossSales).ToString("#,##0.#0"));
                //        dt.Rows.Add("", ":", "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 66, '-'));
                //        dt.Rows.Add("NEW GRAND TOTAL", ":", (mclsDetails.eSalesNewGrandTotal).ToString("#,##0.#0"));
                //        break;
                //    default:
                dt.Rows.Add("-", "-", "-");
                dt.Rows.Add("OLD GRAND TOTAL", ":", (mclsDetails.OldGrandTotal).ToString("#,##0.#0"));
                dt.Rows.Add("This Total Amount", ":", (mclsDetails.GrossSales).ToString("#,##0.#0"));
                if (Math.Round((mclsDetails.NewGrandTotal - (mclsDetails.OldGrandTotal + mclsDetails.GrossSales))) != 0)
                {
                    dt.Rows.Add("   (-) TF Consigned", ":", ((mclsDetails.OldGrandTotal + mclsDetails.GrossSales) - mclsDetails.NewGrandTotal).ToString("#,##0.#0"));
                }
                dt.Rows.Add("", ":", "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 66, '-'));
                dt.Rows.Add("NEW GRAND TOTAL", ":", (mclsDetails.NewGrandTotal).ToString("#,##0.#0"));
                //        break;
                //}
                //dt.Rows.Add("-", "-", "-");
                //dt.Rows.Add("OLD GRAND TOTAL", ":", (mclsDetails.eSalesOldGrandTotal).ToString("#,##0.#0"));
                //dt.Rows.Add("This Total Amount", ":", (mclsDetails.GrossSales).ToString("#,##0.#0"));
                //dt.Rows.Add("", ":", "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 66, '-'));
                //dt.Rows.Add("NEW GRAND TOTAL", ":", (mclsDetails.eSalesOldGrandTotal + mclsDetails.GrossSales).ToString("#,##0.#0"));
            }

            dt.Rows.Add("Taxables Breakdown", "", "");
            dt.Rows.Add("VAT Exempt", ":", (mclsDetails.VATExempt).ToString("#,##0.00"));
            dt.Rows.Add("VAT Zero Rated", ":", (mclsDetails.ZeroRatedSales).ToString("#,##0.00"));
            dt.Rows.Add("NonVATable Amount", ":", (mclsDetails.NonVATableAmount).ToString("#,##0.00"));
            dt.Rows.Add("VATable Amount", ":", (mclsDetails.VATableAmount).ToString("#,##0.00"));
            dt.Rows.Add(mclsTerminalDetails.VAT.ToString("##") + "% VAT", ":", (mclsDetails.VAT).ToString("#,##0.00"));
            dt.Rows.Add("Local Tax", ":", (mclsDetails.LocalTax).ToString("#,##0.00"));

            dt.Rows.Add("Total Amount Breakdown", "", "");
            dt.Rows.Add("Cash Sales", ":", (mclsDetails.CashSales).ToString("#,##0.00"));
            dt.Rows.Add("Cheque Sales", ":", (mclsDetails.ChequeSales).ToString("#,##0.00"));
            dt.Rows.Add("Credit Card Sales", ":", (mclsDetails.CreditCardSales).ToString("#,##0.00"));
            dt.Rows.Add("Credit (Charge)", ":", (mclsDetails.CreditSales).ToString("#,##0.00"));
            dt.Rows.Add("Credit Payment", ":", (mclsDetails.CreditPayment).ToString("#,##0.00"));
            dt.Rows.Add("      Cash", ":", (mclsDetails.CreditPaymentCash).ToString("#,##0.00"));
            dt.Rows.Add("      Cheque", ":", (mclsDetails.CreditPaymentCheque).ToString("#,##0.00"));
            dt.Rows.Add("      Credit Card", ":", (mclsDetails.CreditPaymentCreditCard).ToString("#,##0.00"));
            dt.Rows.Add("      Debit", ":", (mclsDetails.CreditPaymentDebit).ToString("#,##0.00"));
            dt.Rows.Add("Debit Sales", ":", (mclsDetails.DebitPayment).ToString("#,##0.00"));
            dt.Rows.Add("     Rewards Points Redeemed", ":", (mclsDetails.RewardPointsPayment).ToString("#,##0.00"));
            dt.Rows.Add("Employee Acct.", ":", "0.00");
            dt.Rows.Add("Void Sales", ":", (mclsDetails.VoidSales).ToString("#,##0.00"));
            dt.Rows.Add("Refund Sales", ":", (mclsDetails.RefundSales).ToString("#,##0.00"));
            dt.Rows.Add("      Cash", ":", (mclsDetails.RefundCash).ToString("#,##0.00"));
            dt.Rows.Add("      Cheque", ":", (mclsDetails.RefundCheque).ToString("#,##0.00"));
            dt.Rows.Add("      Credit Card", ":", (mclsDetails.RefundCreditCard).ToString("#,##0.00"));
            dt.Rows.Add("      Credit", ":", (mclsDetails.RefundCredit).ToString("#,##0.00"));
            dt.Rows.Add("      Debit", ":", (mclsDetails.RefundDebit).ToString("#,##0.00"));

            Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(clsReceipt.Connection, clsReceipt.Transaction);
            System.Data.DataTable  dtCreditCards        = clsSalesTransactions.SalesPerCreditCard(mclsDetails.BranchID, mclsDetails.TerminalNo, 0, mclsDetails.DateLastInitialized, mclsDetails.NEXTDateLastInitialized);

            if (dtCreditCards.Rows.Count > 0)
            {
                dt.Rows.Add("-", "-", "-");
                dt.Rows.Add("Credit Card Breakdown", "", "");
                dt.Rows.Add("-", "-", "-");
                foreach (System.Data.DataRow dr in dtCreditCards.Rows)
                {
                    dt.Rows.Add(dr["CardTypeCode"].ToString(), ":", (decimal.Parse(dr["Amount"].ToString()) * ((100 - mclsDetails.TrustFund) / 100)).ToString("#,##0.00"));
                }
            }

            dt.Rows.Add("Discounts", "", "");
            dt.Rows.Add("Items Discount", ":", (mclsDetails.ItemsDiscount).ToString("#,##0.00"));
            dt.Rows.Add("Subtotal Discount", ":", (mclsDetails.SubTotalDiscount).ToString("#,##0.00"));
            dt.Rows.Add("     Senior Citizen", ":", (mclsDetails.SNRDiscount).ToString("#,##0.00"));
            dt.Rows.Add("     PWD", ":", (mclsDetails.PWDDiscount).ToString("#,##0.00"));
            dt.Rows.Add("     Others", ":", (mclsDetails.OtherDiscount).ToString("#,##0.00"));
            dt.Rows.Add("Total Discounts", ":", (mclsDetails.TotalDiscount).ToString("#,##0.00"));

            clsSalesTransactions = new Data.SalesTransactions(clsReceipt.Connection, clsReceipt.Transaction);

            System.Data.DataTable dtDiscounts = clsSalesTransactions.Discounts(mclsDetails.BranchID, mclsDetails.TerminalNo, mclsDetails.BeginningTransactionNo, mclsDetails.EndingTransactionNo);
            if (dtDiscounts.Rows.Count > 0)
            {
                dt.Rows.Add("-", "-", "-");
                dt.Rows.Add("Subtotal Discounts Breakdown", "", "");
                dt.Rows.Add("-", "-", "-");
                foreach (System.Data.DataRow dr in dtDiscounts.Rows)
                {
                    dt.Rows.Add(dr["DiscountCode"].ToString(), ":", (decimal.Parse(dr["Discount"].ToString()) * ((100 - mclsDetails.TrustFund) / 100)).ToString("#,##0.00"));
                }
            }

            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Drawer Information", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Beginning Balance", ":", (mclsDetails.BeginningBalance).ToString("#,##0.00"));
            dt.Rows.Add("Cash In Drawer", ":", (mclsDetails.CashInDrawer).ToString("#,##0.00"));
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Paid Out", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Paid Out", ":", (mclsDetails.TotalPaidOut).ToString("#,##0.00"));
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("PICK UP / Disburstment", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Cash", ":", (mclsDetails.CashDisburse).ToString("#,##0.00"));
            dt.Rows.Add("Cheque", ":", (mclsDetails.ChequeDisburse).ToString("#,##0.00"));
            dt.Rows.Add("Credit Card", ":", (mclsDetails.CreditCardDisburse).ToString("#,##0.00"));
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Receive on Account", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Cash", ":", (mclsDetails.CashWithHold).ToString("#,##0.00"));
            dt.Rows.Add("Cheque", ":", (mclsDetails.ChequeWithHold).ToString("#,##0.00"));
            dt.Rows.Add("Credit Card", ":", (mclsDetails.CreditCardWithHold).ToString("#,##0.00"));
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Customer Deposits", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Cash", ":", (mclsDetails.CashDeposit).ToString("#,##0.00"));
            dt.Rows.Add("Cheque", ":", (mclsDetails.ChequeDeposit).ToString("#,##0.00"));
            dt.Rows.Add("Credit Card", ":", (mclsDetails.CreditCardDeposit).ToString("#,##0.00"));
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Transaction Count Breakdown", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Cash Transactions", ":", mclsDetails.NoOfCashTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Cheque Transactions", ":", mclsDetails.NoOfChequeTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Credit Card Transactions", ":", mclsDetails.NoOfCreditCardTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Credit Transactions", ":", mclsDetails.NoOfCreditTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Debit Transactions", ":", mclsDetails.NoOfDebitPaymentTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Refund Transactions", ":", mclsDetails.NoOfRefundTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Void Transactions", ":", mclsDetails.NoOfVoidTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Combination Trans", ":", mclsDetails.NoOfCombinationPaymentTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Credit Payment Trans", ":", mclsDetails.NoOfCreditPaymentTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Reward Points Trans", ":", mclsDetails.NoOfRewardPointsPayment.ToString("#,##0.00"));
            dt.Rows.Add("", ":", "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 66, '-'));
            dt.Rows.Add("Total Transactions", ":", mclsDetails.NoOfTotalTransactions.ToString("#,##0.00"));

            // 25Feb2015 : These lines will not be printed in the actual print-out
            dt.Rows.Add("Misc Amount Breakdown", "", "");
            dt.Rows.Add("Consignment", ":", (mclsDetails.ConsignmentSales).ToString("#,##0.00"));
            dt.Rows.Add("Walk-In", ":", (mclsDetails.WalkInSales).ToString("#,##0.00"));
            dt.Rows.Add("Out Of Stock", ":", (mclsDetails.OutOfStockSales).ToString("#,##0.00"));
            dt.Rows.Add("    Refund", "", "");
            dt.Rows.Add("Consignment", ":", (mclsDetails.ConsignmentRefundSales).ToString("#,##0.00"));
            dt.Rows.Add("Walk-In", ":", (mclsDetails.WalkInRefundSales).ToString("#,##0.00"));
            dt.Rows.Add("Out Of Stock", ":", (mclsDetails.OutOfStockRefundSales).ToString("#,##0.00"));

            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Consignment Trans", ":", mclsDetails.NoOfConsignmentTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Walk-In Trans", ":", mclsDetails.NoOfWalkInTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Out Of Stock Trans", ":", mclsDetails.NoOfOutOfStockTransactions.ToString("#,##0.00"));
            dt.Rows.Add("    Refund", "", "");
            dt.Rows.Add("Consignment Trans", ":", mclsDetails.NoOfConsignmentRefundTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Walk-In Trans", ":", mclsDetails.NoOfWalkInRefundTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Out Of Stock Trans", ":", mclsDetails.NoOfOutOfStockRefundTransactions.ToString("#,##0.00"));
            // 25Feb2015 : End of lines

            string strReportFooter1 = clsReceipt.Details("ReportFooter1").Value;
            string strReportFooter2 = clsReceipt.Details("ReportFooter2").Value;
            string strReportFooter3 = clsReceipt.Details("ReportFooter3").Value;

            if (!string.IsNullOrEmpty(strReportFooter1))
            {
                dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportFooter1), mclsTerminalDetails.MaxReceiptWidth));
            }
            if (!string.IsNullOrEmpty(strReportFooter2))
            {
                dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportFooter2), mclsTerminalDetails.MaxReceiptWidth));
            }
            if (!string.IsNullOrEmpty(strReportFooter3))
            {
                dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportFooter3), mclsTerminalDetails.MaxReceiptWidth));
            }

            clsReceipt.CommitAndDispose();

            dgvItems.MultiSelect         = true;
            dgvItems.AutoGenerateColumns = true;
            dgvItems.AutoSize            = true;
            dgvItems.ScrollBars          = ScrollBars.Vertical;
            dgvItems.DataSource          = dt.TableName;
            dgvItems.DataSource          = dt;

            //dgvItems.Columns["ReportValue"].Visible = true;
            //dgvItems.Columns["ReportValue"].HeaderText = "";
            //dgvItems.Columns["ReportValue"].Width = 388;

            dgvItems.Columns["Module"].Visible    = true;
            dgvItems.Columns["Separator"].Visible = true;
            dgvItems.Columns["Value"].Visible     = true;

            dgvItems.Columns["Module"].HeaderText    = "";
            dgvItems.Columns["Separator"].HeaderText = "";
            dgvItems.Columns["Value"].HeaderText     = "";

            dgvItems.Columns["Module"].DefaultCellStyle.Alignment    = DataGridViewContentAlignment.MiddleLeft;
            dgvItems.Columns["Separator"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgvItems.Columns["Value"].DefaultCellStyle.Alignment     = DataGridViewContentAlignment.MiddleRight;

            dgvItems.Columns["Module"].Width    = 230;
            dgvItems.Columns["Separator"].Width = 20;
            dgvItems.Columns["Value"].Width     = dgvItems.Width - 250 - 20;
        }
Ejemplo n.º 6
0
        private void PopulateTerminalReport()
        {
            Receipt clsReceipt = new Receipt();

            mclsTerminalDetails.MaxReceiptWidth = 94;

            System.Data.DataTable dt = new System.Data.DataTable("tblTerminalReport");
            dt.Columns.Add("Module");
            dt.Columns.Add("Separator");
            dt.Columns.Add("Value");
            
            //dt.Rows.Add(CenterString(CompanyDetails.CompanyCode, mclsTerminalDetails.MaxReceiptWidth));
            //dt.Rows.Add("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-'));
            //dt.Rows.Add(CenterString("Terminal Report", mclsTerminalDetails.MaxReceiptWidth));
            //dt.Rows.Add("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-'));

            //string strReportHeader1 = clsReceipt.Details("ReportHeader1").Value;
            //string strReportHeader2 = clsReceipt.Details("ReportHeader2").Value;
            //string strReportHeader3 = clsReceipt.Details("ReportHeader3").Value;
            //string strReportHeader4 = clsReceipt.Details("ReportHeader4").Value;
            //if (!string.IsNullOrEmpty(strReportHeader1)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportHeader1), mclsTerminalDetails.MaxReceiptWidth));
            //if (!string.IsNullOrEmpty(strReportHeader2)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportHeader2), mclsTerminalDetails.MaxReceiptWidth));
            //if (!string.IsNullOrEmpty(strReportHeader3)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportHeader3), mclsTerminalDetails.MaxReceiptWidth));
            //if (!string.IsNullOrEmpty(strReportHeader4)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportHeader4), mclsTerminalDetails.MaxReceiptWidth));

            if (Int64.Parse(mclsDetails.BeginningORNo) == 0)
                dt.Rows.Add("Beginning OR No.", ":", mclsDetails.BeginningORNo.Remove(mclsDetails.BeginningORNo.Length - 1) + "1");
            else
                dt.Rows.Add("Beginning OR No.", ":", mclsDetails.BeginningORNo);

            dt.Rows.Add("Ending OR No.", ":", mclsDetails.EndingORNo);
            dt.Rows.Add("", "", "");
            dt.Rows.Add("Gross Sales", ":", ((mclsDetails.GrossSales + mclsDetails.TotalCharge)).ToString("#,##0.#0"));
            dt.Rows.Add("(-) Service Charge", ":", mclsDetails.TotalCharge.ToString("#,##0.#0"));
            dt.Rows.Add("",":","------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 66, '-'));
            dt.Rows.Add("Total Amount", ":", (mclsDetails.GrossSales).ToString("#,##0.#0"));
            dt.Rows.Add("(-) " + mclsTerminalDetails.VAT.ToString("##") + "% VAT Exempt ", ":", (mclsDetails.VATExempt * (mclsTerminalDetails.VAT / 100)).ToString("#,##0.#0"));
            dt.Rows.Add("(-) Discount", ":", (mclsDetails.SubTotalDiscount + mclsDetails.ItemsDiscount).ToString("#,##0.#0"));
            dt.Rows.Add("", ":", "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 66, '-'));
            dt.Rows.Add("Net Sales", ":", (mclsDetails.NetSales).ToString("#,##0.#0"));

            if (mclsTerminalDetails.WillPrintGrandTotal == true)
            {
                //switch (mTerminalReportType)
                //{
                //    case Reports.TerminalReportType.XRead:
                //    case Reports.TerminalReportType.TerminalReport:
                //    case Reports.TerminalReportType.CashiersTerminalReport:
                //        dt.Rows.Add("-", "-", "-");
                //        dt.Rows.Add("OLD GRAND TOTAL", ":", (mclsDetails.eSalesOldGrandTotal).ToString("#,##0.#0"));
                //        dt.Rows.Add("This Total Amount", ":", (mclsDetails.GrossSales).ToString("#,##0.#0"));
                //        dt.Rows.Add("", ":", "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 66, '-'));
                //        dt.Rows.Add("NEW GRAND TOTAL", ":", (mclsDetails.eSalesNewGrandTotal).ToString("#,##0.#0"));
                //        break;
                //    default:
                dt.Rows.Add("-", "-", "-");
                dt.Rows.Add("OLD GRAND TOTAL", ":", (mclsDetails.OldGrandTotal).ToString("#,##0.#0"));
                dt.Rows.Add("This Total Amount", ":", (mclsDetails.GrossSales).ToString("#,##0.#0"));
                if (Math.Round((mclsDetails.NewGrandTotal - (mclsDetails.OldGrandTotal + mclsDetails.GrossSales))) != 0)
                    dt.Rows.Add("   (-) TF Consigned", ":", ((mclsDetails.OldGrandTotal + mclsDetails.GrossSales) - mclsDetails.NewGrandTotal).ToString("#,##0.#0"));
                dt.Rows.Add("", ":", "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 66, '-'));
                dt.Rows.Add("NEW GRAND TOTAL", ":", (mclsDetails.NewGrandTotal).ToString("#,##0.#0"));
                //        break;
                //}
                //dt.Rows.Add("-", "-", "-");
                //dt.Rows.Add("OLD GRAND TOTAL", ":", (mclsDetails.eSalesOldGrandTotal).ToString("#,##0.#0"));
                //dt.Rows.Add("This Total Amount", ":", (mclsDetails.GrossSales).ToString("#,##0.#0"));
                //dt.Rows.Add("", ":", "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 66, '-'));
                //dt.Rows.Add("NEW GRAND TOTAL", ":", (mclsDetails.eSalesOldGrandTotal + mclsDetails.GrossSales).ToString("#,##0.#0"));
            }

            dt.Rows.Add("Taxables Breakdown", "", "");
            dt.Rows.Add("VAT Exempt", ":", (mclsDetails.VATExempt).ToString("#,##0.00"));
            dt.Rows.Add("VAT Zero Rated", ":", (mclsDetails.ZeroRatedSales).ToString("#,##0.00"));
            dt.Rows.Add("NonVATable Amount", ":", (mclsDetails.NonVATableAmount).ToString("#,##0.00"));
            dt.Rows.Add("VATable Amount", ":", (mclsDetails.VATableAmount).ToString("#,##0.00"));
            dt.Rows.Add(mclsTerminalDetails.VAT.ToString("##") + "% VAT", ":", (mclsDetails.VAT).ToString("#,##0.00"));
            dt.Rows.Add("Local Tax", ":", (mclsDetails.LocalTax).ToString("#,##0.00"));

            dt.Rows.Add("Total Amount Breakdown", "", "");
            dt.Rows.Add("Cash Sales", ":", (mclsDetails.CashSales).ToString("#,##0.00"));
            dt.Rows.Add("Cheque Sales", ":", (mclsDetails.ChequeSales).ToString("#,##0.00"));
            dt.Rows.Add("Credit Card Sales", ":", (mclsDetails.CreditCardSales).ToString("#,##0.00"));
            dt.Rows.Add("Credit (Charge)", ":", (mclsDetails.CreditSales).ToString("#,##0.00"));
            dt.Rows.Add("Credit Payment", ":", (mclsDetails.CreditPayment).ToString("#,##0.00"));
            dt.Rows.Add("      Cash", ":", (mclsDetails.CreditPaymentCash).ToString("#,##0.00"));
            dt.Rows.Add("      Cheque", ":", (mclsDetails.CreditPaymentCheque).ToString("#,##0.00"));
            dt.Rows.Add("      Credit Card", ":", (mclsDetails.CreditPaymentCreditCard).ToString("#,##0.00"));
            dt.Rows.Add("      Debit", ":", (mclsDetails.CreditPaymentDebit).ToString("#,##0.00"));
            dt.Rows.Add("Debit Sales", ":", (mclsDetails.DebitPayment).ToString("#,##0.00"));
            dt.Rows.Add("     Rewards Points Redeemed", ":", (mclsDetails.RewardPointsPayment).ToString("#,##0.00"));
            dt.Rows.Add("Employee Acct.", ":", "0.00");
            dt.Rows.Add("Void Sales", ":", (mclsDetails.VoidSales).ToString("#,##0.00"));
            dt.Rows.Add("Refund Sales", ":", (mclsDetails.RefundSales).ToString("#,##0.00"));
            dt.Rows.Add("      Cash", ":", (mclsDetails.RefundCash).ToString("#,##0.00"));
            dt.Rows.Add("      Cheque", ":", (mclsDetails.RefundCheque).ToString("#,##0.00"));
            dt.Rows.Add("      Credit Card", ":", (mclsDetails.RefundCreditCard).ToString("#,##0.00"));
            dt.Rows.Add("      Credit", ":", (mclsDetails.RefundCredit).ToString("#,##0.00"));
            dt.Rows.Add("      Debit", ":", (mclsDetails.RefundDebit).ToString("#,##0.00"));

            Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(clsReceipt.Connection, clsReceipt.Transaction);
            System.Data.DataTable dtCreditCards = clsSalesTransactions.SalesPerCreditCard(mclsDetails.BranchID, mclsDetails.TerminalNo, 0, mclsDetails.DateLastInitialized, mclsDetails.NEXTDateLastInitialized);

            if (dtCreditCards.Rows.Count > 0)
            {
                dt.Rows.Add("-", "-", "-");
                dt.Rows.Add("Credit Card Breakdown", "", "");
                dt.Rows.Add("-", "-", "-");
                foreach (System.Data.DataRow dr in dtCreditCards.Rows)
                {
                    dt.Rows.Add(dr["CardTypeCode"].ToString(), ":", (decimal.Parse(dr["Amount"].ToString()) * ((100 - mclsDetails.TrustFund) / 100)).ToString("#,##0.00"));
                }
            }

            dt.Rows.Add("Discounts", "", "");
            dt.Rows.Add("Items Discount", ":", (mclsDetails.ItemsDiscount).ToString("#,##0.00"));
            dt.Rows.Add("Subtotal Discount", ":", (mclsDetails.SubTotalDiscount).ToString("#,##0.00"));
            dt.Rows.Add("     Senior Citizen", ":", (mclsDetails.SNRDiscount).ToString("#,##0.00"));
            dt.Rows.Add("     PWD", ":", (mclsDetails.PWDDiscount).ToString("#,##0.00"));
            dt.Rows.Add("     Others", ":", (mclsDetails.OtherDiscount).ToString("#,##0.00"));
            dt.Rows.Add("Total Discounts", ":", (mclsDetails.TotalDiscount).ToString("#,##0.00"));

            clsSalesTransactions = new Data.SalesTransactions(clsReceipt.Connection, clsReceipt.Transaction);

            System.Data.DataTable dtDiscounts = clsSalesTransactions.Discounts(mclsDetails.BranchID, mclsDetails.TerminalNo, mclsDetails.BeginningTransactionNo, mclsDetails.EndingTransactionNo);
            if (dtDiscounts.Rows.Count > 0)
            {
                dt.Rows.Add("-", "-", "-");
                dt.Rows.Add("Subtotal Discounts Breakdown", "", "");
                dt.Rows.Add("-", "-", "-");
                foreach (System.Data.DataRow dr in dtDiscounts.Rows)
                {
                    dt.Rows.Add(dr["DiscountCode"].ToString(), ":", (decimal.Parse(dr["Discount"].ToString()) * ((100 - mclsDetails.TrustFund) / 100)).ToString("#,##0.00"));
                }
            }

            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Drawer Information", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Beginning Balance", ":", (mclsDetails.BeginningBalance).ToString("#,##0.00"));
            dt.Rows.Add("Cash In Drawer", ":", (mclsDetails.CashInDrawer).ToString("#,##0.00"));
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Paid Out", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Paid Out", ":", (mclsDetails.TotalPaidOut).ToString("#,##0.00"));
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("PICK UP / Disburstment", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Cash", ":", (mclsDetails.CashDisburse).ToString("#,##0.00"));
            dt.Rows.Add("Cheque", ":", (mclsDetails.ChequeDisburse).ToString("#,##0.00"));
            dt.Rows.Add("Credit Card", ":", (mclsDetails.CreditCardDisburse).ToString("#,##0.00"));
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Receive on Account", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Cash", ":", (mclsDetails.CashWithHold).ToString("#,##0.00"));
            dt.Rows.Add("Cheque", ":", (mclsDetails.ChequeWithHold).ToString("#,##0.00"));
            dt.Rows.Add("Credit Card", ":", (mclsDetails.CreditCardWithHold).ToString("#,##0.00"));
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Customer Deposits", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Cash", ":", (mclsDetails.CashDeposit).ToString("#,##0.00"));
            dt.Rows.Add("Cheque", ":", (mclsDetails.ChequeDeposit).ToString("#,##0.00"));
            dt.Rows.Add("Credit Card", ":", (mclsDetails.CreditCardDeposit).ToString("#,##0.00"));
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Transaction Count Breakdown", "", "");
            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Cash Transactions", ":", mclsDetails.NoOfCashTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Cheque Transactions", ":", mclsDetails.NoOfChequeTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Credit Card Transactions", ":", mclsDetails.NoOfCreditCardTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Credit Transactions", ":", mclsDetails.NoOfCreditTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Debit Transactions", ":", mclsDetails.NoOfDebitPaymentTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Refund Transactions", ":", mclsDetails.NoOfRefundTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Void Transactions", ":", mclsDetails.NoOfVoidTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Combination Trans", ":", mclsDetails.NoOfCombinationPaymentTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Credit Payment Trans", ":", mclsDetails.NoOfCreditPaymentTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Reward Points Trans", ":", mclsDetails.NoOfRewardPointsPayment.ToString("#,##0.00"));
            dt.Rows.Add("", ":", "------------".PadLeft(mclsTerminalDetails.MaxReceiptWidth - 66, '-'));
            dt.Rows.Add("Total Transactions", ":", mclsDetails.NoOfTotalTransactions.ToString("#,##0.00"));

            // 25Feb2015 : These lines will not be printed in the actual print-out
            dt.Rows.Add("Misc Amount Breakdown", "", "");
            dt.Rows.Add("Consignment", ":", (mclsDetails.ConsignmentSales).ToString("#,##0.00"));
            dt.Rows.Add("Walk-In", ":", (mclsDetails.WalkInSales).ToString("#,##0.00"));
            dt.Rows.Add("Out Of Stock", ":", (mclsDetails.OutOfStockSales).ToString("#,##0.00"));
            dt.Rows.Add("    Refund", "", "");
            dt.Rows.Add("Consignment", ":", (mclsDetails.ConsignmentRefundSales).ToString("#,##0.00"));
            dt.Rows.Add("Walk-In", ":", (mclsDetails.WalkInRefundSales).ToString("#,##0.00"));
            dt.Rows.Add("Out Of Stock", ":", (mclsDetails.OutOfStockRefundSales).ToString("#,##0.00"));

            dt.Rows.Add("-", "-", "-");
            dt.Rows.Add("Consignment Trans", ":", mclsDetails.NoOfConsignmentTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Walk-In Trans", ":", mclsDetails.NoOfWalkInTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Out Of Stock Trans", ":", mclsDetails.NoOfOutOfStockTransactions.ToString("#,##0.00"));
            dt.Rows.Add("    Refund", "", "");
            dt.Rows.Add("Consignment Trans", ":", mclsDetails.NoOfConsignmentRefundTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Walk-In Trans", ":", mclsDetails.NoOfWalkInRefundTransactions.ToString("#,##0.00"));
            dt.Rows.Add("Out Of Stock Trans", ":", mclsDetails.NoOfOutOfStockRefundTransactions.ToString("#,##0.00"));
            // 25Feb2015 : End of lines

            string strReportFooter1 = clsReceipt.Details("ReportFooter1").Value;
            string strReportFooter2 = clsReceipt.Details("ReportFooter2").Value;
            string strReportFooter3 = clsReceipt.Details("ReportFooter3").Value;
            if (!string.IsNullOrEmpty(strReportFooter1)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportFooter1), mclsTerminalDetails.MaxReceiptWidth));
            if (!string.IsNullOrEmpty(strReportFooter2)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportFooter2), mclsTerminalDetails.MaxReceiptWidth));
            if (!string.IsNullOrEmpty(strReportFooter3)) dt.Rows.Add(CenterString(GetReceiptFormatParameter(strReportFooter3), mclsTerminalDetails.MaxReceiptWidth));

            clsReceipt.CommitAndDispose();

            dgvItems.MultiSelect = true;
            dgvItems.AutoGenerateColumns = true;
            dgvItems.AutoSize = true;
            dgvItems.ScrollBars = ScrollBars.Vertical;
            dgvItems.DataSource = dt.TableName;
            dgvItems.DataSource = dt;
            
            //dgvItems.Columns["ReportValue"].Visible = true;
            //dgvItems.Columns["ReportValue"].HeaderText = "";
            //dgvItems.Columns["ReportValue"].Width = 388;

            dgvItems.Columns["Module"].Visible = true;
            dgvItems.Columns["Separator"].Visible = true;
            dgvItems.Columns["Value"].Visible = true;

            dgvItems.Columns["Module"].HeaderText = "";
            dgvItems.Columns["Separator"].HeaderText = "";
            dgvItems.Columns["Value"].HeaderText = "";

            dgvItems.Columns["Module"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
            dgvItems.Columns["Separator"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgvItems.Columns["Value"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;

            dgvItems.Columns["Module"].Width = 230;
            dgvItems.Columns["Separator"].Width = 20;
            dgvItems.Columns["Value"].Width = dgvItems.Width - 250 - 20;

        }