Esempio n. 1
0
 public bool closeCashierPeriod(string pId, string pCashierId, decimal pTotalSales, decimal pReturnedItemTotal,
                                decimal pTotalDiscount, decimal pNetSales, decimal pNonCashSales,
                                decimal pCashSales, decimal pNetCashSales, decimal pCashCount, decimal pVariance,
                                string pRemarks, string pUserId)
 {
     return(loCashierPeriod.closeCashierPeriod(pId, pCashierId, pTotalSales, pReturnedItemTotal,
                                               pTotalDiscount, pNetSales, pNonCashSales,
                                               pCashSales, pNetCashSales, pCashCount, pVariance, pRemarks, pUserId));
 }
        private void btnClosePeriod_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsmCloseCashierPeriod", "Close"))
                {
                    return;
                }

                string _CashierPeriodId = GlobalVariables.CashierPeriodId;

                if (loCashierPeriod.closeCashierPeriod(_CashierPeriodId, GlobalVariables.CashierId,
                                                       decimal.Parse(lblTotalSales.Text), decimal.Parse(lblReturnedItemTotal.Text),
                                                       decimal.Parse(lblTotalDiscount.Text), decimal.Parse(lblNetSales.Text),
                                                       decimal.Parse(lblNonCashSales.Text), decimal.Parse(lblCashSales.Text),
                                                       decimal.Parse(lblNetCashSales.Text), decimal.Parse(txtCashCount.Text),
                                                       decimal.Parse(lblVariance.Text), txtRemarks.Text))
                {
                    //insert to Accounting entry to Sales Journal
                    //insertJournalEntry(decimal.Parse(lblNetSales.Text), "POS Sales ("+string.Format("{0:MM-dd-yyyy}",DateTime.Now)+") || Cashier Period Id:"+GlobalVariables.CashierPeriodId);

                    GlobalVariables.CashierPeriodId = "";
                    MessageBoxUI _mb = new MessageBoxUI("Cashier period has been close successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    this.Close();
                    foreach (DataRow _dr in loCashierPeriod.getAllData("", _CashierPeriodId, "").Rows)
                    {
                        if (GlobalVariables.ORSize == "Plain Continuous-Long")
                        {
                            loCashierPeriodSummaryRpt.SetDataSource(GlobalVariables.DTCompanyLogo);
                            loCashierPeriodSummaryRpt.Subreports["CashierPeriodStockSoldRpt.rpt"].SetDataSource(loCashierPeriod.getCashierPeriodStockSold(_CashierPeriodId));
                            loCashierPeriodSummaryRpt.Subreports["CashierPeriodReturnedItemRpt.rpt"].SetDataSource(loCashierPeriod.getCashierPeriodReturnedItem(_CashierPeriodId));
                            //loCashierPeriodSummaryRpt.Database.Tables[1].SetDataSource(loPOSTransactionDetail.getPOSTransactionDetails(pPOSTransactionId));
                            loCashierPeriodSummaryRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName);
                            loCashierPeriodSummaryRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress);
                            loCashierPeriodSummaryRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber);
                            loCashierPeriodSummaryRpt.SetParameterValue("Username", GlobalVariables.Userfullname);
                            loCashierPeriodSummaryRpt.SetParameterValue("Title", "Cashier Period Summary");
                            loCashierPeriodSummaryRpt.SetParameterValue("SubTitle", "Cashier Period Summary");
                            loCashierPeriodSummaryRpt.SetParameterValue("CashierPeriodNo", _dr["Id"].ToString());
                            loCashierPeriodSummaryRpt.SetParameterValue("DateOpen", _dr["Date Open"].ToString());
                            loCashierPeriodSummaryRpt.SetParameterValue("DateClose", _dr["Date Close"].ToString());
                            loCashierPeriodSummaryRpt.SetParameterValue("PeriodStatus", _dr["Period Status"].ToString());
                            loCashierPeriodSummaryRpt.SetParameterValue("OpenCashier", _dr["Open Cashier"].ToString());
                            loCashierPeriodSummaryRpt.SetParameterValue("CloseCashier", _dr["Close Cashier"].ToString());
                            loCashierPeriodSummaryRpt.SetParameterValue("CashDeposit", string.Format("{0:n}", decimal.Parse(_dr["Cash Deposit"].ToString())));
                            loCashierPeriodSummaryRpt.SetParameterValue("TotalSales", string.Format("{0:n}", decimal.Parse(_dr["Total Sales"].ToString())));
                            loCashierPeriodSummaryRpt.SetParameterValue("ReturnedItemTotal", string.Format("{0:n}", decimal.Parse(_dr["Returned Item Total"].ToString())));
                            loCashierPeriodSummaryRpt.SetParameterValue("TotalDiscount", string.Format("{0:n}", decimal.Parse(_dr["Total Discount"].ToString())));
                            loCashierPeriodSummaryRpt.SetParameterValue("NetSales", string.Format("{0:n}", decimal.Parse(_dr["Net Sales"].ToString())));
                            loCashierPeriodSummaryRpt.SetParameterValue("NonCashSales", string.Format("{0:n}", decimal.Parse(_dr["Non-Cash Sales"].ToString())));
                            loCashierPeriodSummaryRpt.SetParameterValue("CashSales", string.Format("{0:n}", decimal.Parse(_dr["Cash Sales"].ToString())));
                            loCashierPeriodSummaryRpt.SetParameterValue("NetCashSales", string.Format("{0:n}", decimal.Parse(_dr["Net Cash Sales"].ToString())));
                            loCashierPeriodSummaryRpt.SetParameterValue("CashCount", string.Format("{0:n}", decimal.Parse(_dr["Cash Count"].ToString())));
                            loCashierPeriodSummaryRpt.SetParameterValue("Variance", string.Format("{0:n}", decimal.Parse(_dr["Variance"].ToString())));
                            loCashierPeriodSummaryRpt.SetParameterValue("Remarks", _dr["Remarks"].ToString());
                            loCashierPeriodSummaryRpt.SetParameterValue("PreparedBy", _dr["Close Cashier"].ToString());
                            loReportViewer.crystalReportViewer.ReportSource = loCashierPeriodSummaryRpt;
                            loReportViewer.ShowDialog();
                        }
                        else if (GlobalVariables.ORSize == "Receipt Printed(80mm)")
                        {
                            loCloseCashierPeriodRpt.Subreports["ItemSoldRpt.rpt"].SetDataSource(loCashierPeriod.getCashierPeriodStockSold(_CashierPeriodId));
                            loCloseCashierPeriodRpt.Subreports["ItemReturnedRpt.rpt"].SetDataSource(loCashierPeriod.getCashierPeriodReturnedItem(_CashierPeriodId));
                            loCloseCashierPeriodRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName.ToUpper());
                            loCloseCashierPeriodRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress);
                            loCloseCashierPeriodRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber);
                            loCloseCashierPeriodRpt.SetParameterValue("PeriodNo", _dr["Id"].ToString());
                            loCloseCashierPeriodRpt.SetParameterValue("Cashier", _dr["Close Cashier"].ToString());
                            //loCloseCashierPeriodRpt.SetParameterValue("Date", _dr["Date Close"].ToString());
                            loCloseCashierPeriodRpt.SetParameterValue("DateOpen", _dr["Date Open"].ToString());
                            loCloseCashierPeriodRpt.SetParameterValue("DateClose", _dr["Date Close"].ToString());
                            loCloseCashierPeriodRpt.SetParameterValue("CashDeposit", string.Format("{0:n}", decimal.Parse(_dr["Cash Deposit"].ToString())));
                            loCloseCashierPeriodRpt.SetParameterValue("TotalSales", string.Format("{0:n}", decimal.Parse(_dr["Total Sales"].ToString())));
                            loCloseCashierPeriodRpt.SetParameterValue("ReturnedItem", "(" + string.Format("{0:n}", decimal.Parse(_dr["Returned Item Total"].ToString())) + ")");
                            loCloseCashierPeriodRpt.SetParameterValue("TotalDiscount", string.Format("{0:n}", decimal.Parse(_dr["Total Discount"].ToString())));
                            loCloseCashierPeriodRpt.SetParameterValue("NetSales", string.Format("{0:n}", decimal.Parse(_dr["Net Sales"].ToString())));
                            loCloseCashierPeriodRpt.SetParameterValue("NonCashSales", string.Format("{0:n}", decimal.Parse(_dr["Non-Cash Sales"].ToString())));
                            loCloseCashierPeriodRpt.SetParameterValue("CashSales", string.Format("{0:n}", decimal.Parse(_dr["Cash Sales"].ToString())));
                            loCloseCashierPeriodRpt.SetParameterValue("NetCashSales", string.Format("{0:n}", decimal.Parse(_dr["Net Cash Sales"].ToString())));
                            loCloseCashierPeriodRpt.SetParameterValue("CashCount", string.Format("{0:n}", decimal.Parse(_dr["Cash Count"].ToString())));
                            loCloseCashierPeriodRpt.SetParameterValue("Variance", string.Format("{0:n}", decimal.Parse(_dr["Variance"].ToString())));
                            loCloseCashierPeriodRpt.SetParameterValue("Remarks", _dr["Remarks"].ToString());

                            if (GlobalVariables.PreviewOR)
                            {
                                loReportViewer.crystalReportViewer.ReportSource = loCloseCashierPeriodRpt;
                                loReportViewer.ShowDialog();
                            }
                            else
                            {
                                try
                                {
                                    loCloseCashierPeriodRpt.PrintOptions.PrinterName = GlobalVariables.PrinterName;
                                    loCloseCashierPeriodRpt.PrintToPrinter(0, false, 0, 0);
                                }
                                catch { }
                            }
                        }
                    }
                }
            }
            catch { }
        }