Ejemplo n.º 1
0
        private void dgvPOSTransactions_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            foreach (DataRow _dr in loPOSTransaction.getPOSTransaction(dgvPOSTransactions.CurrentRow.Cells[0].Value.ToString()).Rows)
            {
                if (GlobalVariables.ORSize == "Plain Continuous-Long")
                {
                    DataTable _dtTransactions = loPOSTransactionDetail.getPOSTransactionDetails(dgvPOSTransactions.CurrentRow.Cells[0].Value.ToString());
                    if (_dtTransactions.Rows.Count > 0)
                    {
                        loOrderSlipRpt.SetDataSource(GlobalVariables.DTCompanyLogo);
                        loOrderSlipRpt.Database.Tables[1].SetDataSource(_dtTransactions);
                        loOrderSlipRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName);
                        loOrderSlipRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress);
                        loOrderSlipRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber);
                        loOrderSlipRpt.SetParameterValue("Username", GlobalVariables.Userfullname);
                        loOrderSlipRpt.SetParameterValue("Title", "Order Slip");
                        loOrderSlipRpt.SetParameterValue("SubTitle", "Order Slip");
                        loOrderSlipRpt.SetParameterValue("TransactionNo", _dr["Id"].ToString());
                        loOrderSlipRpt.SetParameterValue("Date", _dr["Date"].ToString());
                        loOrderSlipRpt.SetParameterValue("TotalPrice", string.Format("{0:n}", decimal.Parse(_dr["Total Price"].ToString())));
                        loOrderSlipRpt.SetParameterValue("TotalDiscount", string.Format("{0:n}", decimal.Parse(_dr["Total Discount"].ToString())));
                        loOrderSlipRpt.SetParameterValue("TotalDue", string.Format("{0:n}", decimal.Parse(_dr["Total Due"].ToString())));
                        loOrderSlipRpt.SetParameterValue("PreparedBy", _dr["PreparedBy"].ToString());
                        loOrderSlipRpt.SetParameterValue("Customer", _dr["Customer"].ToString());
                        loOrderSlipRpt.SetParameterValue("Address", _dr["CustomerAddress"].ToString());
                        crvList.ReportSource = loOrderSlipRpt;
                    }
                    else
                    {
                        crvList.ReportSource = null;
                    }
                }
                else if (GlobalVariables.ORSize == "Receipt Printed(80mm)")
                {
                    try
                    {
                        foreach (DataRow _dr80mm in loPOSTransaction.getPOSTransaction(dgvPOSTransactions.CurrentRow.Cells[0].Value.ToString()).Rows)
                        {
                            loOrderSlipRpt.Subreports["TransactionDetailListRpt.rpt"].SetDataSource(loPOSTransactionDetail.getPOSTransactionDetails(dgvPOSTransactions.CurrentRow.Cells[0].Value.ToString()));
                            loOrderSlipRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName.ToUpper());
                            loOrderSlipRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress);
                            loOrderSlipRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber);

                            loOrderSlipRpt.SetParameterValue("Date", string.Format("{0:MM-dd-yyyy}", DateTime.Parse(_dr80mm["Date"].ToString())));
                            loOrderSlipRpt.SetParameterValue("TransactionNo", dgvPOSTransactions.CurrentRow.Cells[0].Value.ToString());
                            loOrderSlipRpt.SetParameterValue("Customer", _dr["Customer"].ToString());
                            crvList.ReportSource = loOrderSlipRpt;
                        }
                    }
                    catch { }
                }
            }
        }
Ejemplo n.º 2
0
        private void printOrderSlip(string pPOSTransactionId, string pORNo)
        {
            foreach (DataRow _dr in loPOSTransaction.getPOSTransaction(pPOSTransactionId).Rows)
            {
                if (GlobalVariables.ORSize == "Plain Continuous-Long")
                {
                    loOrderSlipRpt.SetDataSource(GlobalVariables.DTCompanyLogo);
                    loOrderSlipRpt.Database.Tables[1].SetDataSource(loPOSTransactionDetail.getPOSTransactionDetails(pPOSTransactionId));
                    loOrderSlipRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName);
                    loOrderSlipRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress);
                    loOrderSlipRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber);
                    loOrderSlipRpt.SetParameterValue("Username", GlobalVariables.Userfullname);
                    loOrderSlipRpt.SetParameterValue("Title", "Order Slip");
                    loOrderSlipRpt.SetParameterValue("SubTitle", "Order Slip");
                    loOrderSlipRpt.SetParameterValue("TransactionNo", _dr["Id"].ToString());
                    loOrderSlipRpt.SetParameterValue("Date", _dr["Date"].ToString());
                    loOrderSlipRpt.SetParameterValue("TotalPrice", string.Format("{0:n}", decimal.Parse(_dr["Total Price"].ToString())));
                    loOrderSlipRpt.SetParameterValue("TotalDiscount", string.Format("{0:n}", decimal.Parse(_dr["Total Discount"].ToString())));
                    loOrderSlipRpt.SetParameterValue("TotalDue", string.Format("{0:n}", decimal.Parse(_dr["Total Due"].ToString())));
                    loOrderSlipRpt.SetParameterValue("PreparedBy", _dr["PreparedBy"].ToString());
                    loOrderSlipRpt.SetParameterValue("Customer", _dr["Customer"].ToString());
                    loOrderSlipRpt.SetParameterValue("Address", _dr["CustomerAddress"].ToString());

                    if (GlobalVariables.PreviewOR)
                    {
                        loReportViewer.crystalReportViewer.ReportSource = loOrderSlipRpt;
                        loReportViewer.ShowDialog();
                    }
                    else
                    {
                        try
                        {
                            loOrderSlipRpt.PrintOptions.PrinterName = GlobalVariables.PrinterName;
                            loOrderSlipRpt.PrintToPrinter(0, false, 0, 0);
                        }
                        catch { }
                    }
                }
                else if (GlobalVariables.ORSize == "Receipt Printed(80mm)")
                {
                    try
                    {
                        foreach (DataRow _dr80mm in loPOSTransaction.getPOSTransaction(pPOSTransactionId).Rows)
                        {
                            loOrderSlipRpt.Subreports["TransactionDetailListRpt.rpt"].SetDataSource(loPOSTransactionDetail.getPOSTransactionDetails(pPOSTransactionId));
                            loOrderSlipRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName.ToUpper());
                            loOrderSlipRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress);
                            loOrderSlipRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber);

                            loOrderSlipRpt.SetParameterValue("Date", string.Format("{0:MM-dd-yyyy}", DateTime.Parse(_dr80mm["Date"].ToString())));
                            loOrderSlipRpt.SetParameterValue("TransactionNo", pPOSTransactionId);
                            loOrderSlipRpt.SetParameterValue("Customer", _dr["Customer"].ToString());
                        }
                    }
                    catch { }

                    if (GlobalVariables.PreviewSlip)
                    {
                        loReportViewer.crystalReportViewer.ReportSource = loOrderSlipRpt;
                        loReportViewer.ShowDialog();
                    }
                    else
                    {
                        try
                        {
                            loOrderSlipRpt.PrintOptions.PrinterName = GlobalVariables.PrinterName;
                            loOrderSlipRpt.PrintToPrinter(0, false, 0, 0);
                        }
                        catch { }
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public DataTable getPOSTransaction(string pId)
 {
     return(loPOSTransaction.getPOSTransaction(pId));
 }