private void SetDataSource(ReportDocument Report)
		{
			ReportDataset rptds = new ReportDataset();
			DataRow drNew;

			/****************************sales transaction *****************************/
			SalesTransactions clsSalesTransactions = new SalesTransactions();
			SalesTransactionDetails clsDetails = clsSalesTransactions.Details(txtTransactionNo.Text, txtTerminalNo.Text, int.Parse(cboBranch.SelectedItem.Value));
			clsSalesTransactions.CommitAndDispose();

			if (clsDetails.isExist == true )
			{
				drNew = rptds.Transactions.NewRow();

                drNew["BranchCode"]         = clsDetails.BranchCode;
				drNew["TransactionID"]		= clsDetails.TransactionID;
				drNew["TransactionNo"]		= clsDetails.TransactionNo;
				drNew["CustomerName"]		= clsDetails.CustomerName;
				drNew["CashierName"]		= clsDetails.CashierName;
				drNew["TerminalNo"]			= clsDetails.TerminalNo;
				drNew["TransactionDate"]	= clsDetails.TransactionDate;
				drNew["DateSuspended"]		= clsDetails.DateSuspended.ToString();
				drNew["DateResumed"]		= clsDetails.DateResumed;
				drNew["TransactionStatus"]	= clsDetails.TransactionStatus;
				drNew["SubTotal"]			= clsDetails.SubTotal;
				drNew["ItemsDiscount"]		= clsDetails.ItemsDiscount;
				drNew["Discount"]			= clsDetails.Discount;
				drNew["VAT"]				= clsDetails.VAT;
				drNew["VatableAmount"]		= clsDetails.VATableAmount;
				drNew["LocalTax"]			= clsDetails.LocalTax;
				drNew["AmountPaid"]			= clsDetails.AmountPaid;
				drNew["CashPayment"]		= clsDetails.CashPayment;
				drNew["ChequePayment"]		= clsDetails.ChequePayment;
				drNew["CreditCardPayment"]	= clsDetails.CreditCardPayment;
				drNew["BalanceAmount"]		= clsDetails.BalanceAmount;
				drNew["ChangeAmount"]		= clsDetails.ChangeAmount;
				drNew["DateClosed"]			= clsDetails.DateClosed;
				drNew["PaymentType"]		= clsDetails.PaymentType.ToString("d");
				drNew["ItemsDiscount"]		= clsDetails.ItemsDiscount;
				drNew["Charge"]				= clsDetails.Charge;
                drNew["CreditPayment"]      = clsDetails.CreditPayment;
                drNew["CreatedByName"]      = clsDetails.CreatedByName;

				rptds.Transactions.Rows.Add(drNew);

				/****************************sales transaction items*****************************/
				SalesTransactionItems clsSalesTransactionItems = new SalesTransactionItems();
				System.Data.DataTable dt = clsSalesTransactionItems.List(clsDetails.TransactionID, clsDetails.TransactionDate,"TransactionItemsID",SortOption.Ascending);
				clsSalesTransactionItems.CommitAndDispose();

				foreach(System.Data.DataRow dr in dt.Rows)
				{
					drNew = rptds.TransactionItems.NewRow();
				
					foreach (DataColumn dc in rptds.TransactionItems.Columns)
                        drNew[dc] = dr[dc.ColumnName]; 
				
					rptds.TransactionItems.Rows.Add(drNew);
				}
			}

			Report.SetDataSource(rptds); 

			SetParameters(Report);
		}
Пример #2
0
		private void Upload()
		{
            GLATransaction clsTransactionGLA = new GLATransaction();

            try
            {
                string BatchID = string.Empty;

                List<HttpPostedFile> pfiles = new List<HttpPostedFile>();
                List<string> pfilesName = new List<string>();

                for (int i = 0; i < Request.Files.Count; i++)
                {
                    HttpPostedFile file = Request.Files[i];
                    if (file.ContentLength > 0)
                    {
                        pfiles.Add(file); pfilesName.Add(System.IO.Path.GetFileName(file.FileName.ToLower()));
                    }
                }

                Label1.Text = "";

                #region checking

                // Label1.Text += "Files to upload:";
                //Label1.Text += "      "
                if (pfilesName.IndexOf(Constants.GLA_file_batch_id) < 0)
                    Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the batch file in the upload. Filename: " + Constants.GLA_file_batch_id + "</font></b><br />";
                if (pfilesName.IndexOf(Constants.GLA_file_d_dsc_def) < 0)
                    Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the discount file in the upload. Filename: " + Constants.GLA_file_d_dsc_def + "</font></b><br />";
                if (pfilesName.IndexOf(Constants.GLA_file_d_emp_def) < 0)
                    Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the employees file in the upload. Filename: " + Constants.GLA_file_d_emp_def + "</font></b><br />";
                if (pfilesName.IndexOf(Constants.GLA_file_d_location_def) < 0)
                    Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the location file in the upload. Filename: " + Constants.GLA_file_d_location_def + "</font></b><br />";
                //do not check the item. it's ok not to upload the item
                //if (pfilesName.IndexOf(Constants.GLA_file_d_mi_def) < 0)
                //    Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the menu items file in the upload. Filename: " + Constants.GLA_file_d_mi_def + "</font></b><br />";
                if (pfilesName.IndexOf(Constants.GLA_file_d_svc_def) < 0)
                    Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the service charge file in the upload. Filename: " + Constants.GLA_file_d_svc_def + "</font></b><br />";
                if (pfilesName.IndexOf(Constants.GLA_file_d_tmd_def) < 0)
                    Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the tender definitions file in the upload. Filename: " + Constants.GLA_file_d_tmd_def + "</font></b><br />";
                if (pfilesName.IndexOf(Constants.GLA_file_f_dtl_chk_dsc) < 0)
                    Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the discount details file in the upload. Filename: " + Constants.GLA_file_f_dtl_chk_dsc + "</font></b><br />";
                if (pfilesName.IndexOf(Constants.GLA_file_f_dtl_chk_headers) < 0)
                    Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the check information file in the upload. Filename: " + Constants.GLA_file_f_dtl_chk_headers + "</font></b><br />";
                if (pfilesName.IndexOf(Constants.GLA_file_f_dtl_chk_svc) < 0)
                    Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the service charge file in the upload. Filename: " + Constants.GLA_file_f_dtl_chk_svc + "</font></b><br />";
                if (pfilesName.IndexOf(Constants.GLA_file_f_dtl_chk_tmd) < 0)
                    Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the tender detail file in the upload. Filename: " + Constants.GLA_file_f_dtl_chk_tmd + "</font></b><br />";
                //if (pfilesName.IndexOf(Constants.GLA_file_otntender) < 0)
                //    Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the OTN_Tender file in the upload. Filename: " + Constants.GLA_file_otntender + "</font></b><br />";
                #endregion

                if (!string.IsNullOrEmpty(Label1.Text)) return;

                string strfile = "";
                string strfolder = "/RetailPlus/temp/uploaded/gla/";
                Security.AccessUserDetails clsAccessUserDetails = (Security.AccessUserDetails)Session["AccessUserDetails"];
                DateTime DateCreated = DateTime.Now;
                int iTranCount = 0;

                #region Constants.GLA_file_batch
                if (1==1)    //process batchfile
                {
                    strfile = Server.MapPath(strfolder + Constants.GLA_file_batch_id);

                    if (System.IO.File.Exists(strfile))
                        System.IO.File.Delete(strfile);

                    pfiles[pfilesName.IndexOf(Constants.GLA_file_batch_id)].SaveAs(strfile);

                    using (var reader = new StreamReader(strfile))
                    {
                        string line;
                        while ((line = reader.ReadLine()) != null)
                        {
                            //get the firstline as the batchid
                            BatchID = line;
                            break;
                        }
                    }
                }

                if (string.IsNullOrEmpty(BatchID))
                {
                    Label1.Text += "<br /><br /><b><font class='ms-error'>Cannot get any information from batch file. Please double check the batch file: " + Constants.GLA_file_batch_id + "</font></b><br />";
                    return;
                }

                Label1.Text += "<br /><br /><b><font class='ms-error'>Uploading Batch ID: " + BatchID + "</font></b><br />";
                #endregion

                #region saveallfiles

                // delete the temporary batch file
                if (System.IO.File.Exists(strfile))
                    System.IO.File.Delete(strfile);

                // save it again in a folder
                strfolder = strfolder + BatchID + "/";

                foreach (HttpPostedFile pfile in pfiles)
                {
                    strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(pfile.FileName));

                    if (!System.IO.Directory.Exists(Server.MapPath(strfolder)))
                        System.IO.Directory.CreateDirectory(Server.MapPath(strfolder));
                    
                    if (System.IO.File.Exists(strfile))
                        System.IO.File.Delete(strfile);

                    pfile.SaveAs(strfile);
                }

                //pfiles[pfilesName.IndexOf(Constants.GLA_file_batch)].SaveAs(strfile);
                //pfiles[pfilesName.IndexOf(Constants.GLA_file_batch)].SaveAs(strfile + Constants.GLA_file_batch);

                #endregion

                #region GLA_file_d_dsc_def
                /***** upload the transaction *****/
                Label1.Text += "Processing " + Constants.GLA_file_d_dsc_def + " ...";
                strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_d_dsc_def));

                IList<GLADiscountDetails> lstGLADiscountDetails = new List<GLADiscountDetails>();
                GLADiscountDetails clsGLADiscountDetails = new GLADiscountDetails();
                iTranCount = 0;
                using (var reader = new StreamReader(strfile))
                {
                    string line;
                    while ((line = reader.ReadLine()) != null)
                    {
                        clsGLADiscountDetails = setDscDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_d_dsc_def, BatchID);
                        lstGLADiscountDetails.Add(clsGLADiscountDetails);

                        iTranCount++;
                    }
                }

                GLADiscount clsGLADiscount = new GLADiscount(clsTransactionGLA.Connection, clsTransactionGLA.Transaction);
                clsGLADiscount.Delete(BatchID);
                foreach (GLADiscountDetails det in lstGLADiscountDetails)
                {
                    clsGLADiscount.Insert(det);
                }
                Label1.Text += "      <b><font class='ms-error'>" + lstGLADiscountDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />";
                
                #endregion

                #region GLA_file_d_emp_def
                /***** upload the transaction *****/
                Label1.Text += "Processing " + Constants.GLA_file_d_emp_def + " ...";
                strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_d_emp_def));

                IList<GLAEmployeeDetails> lstGLAEmployeeDetails = new List<GLAEmployeeDetails>();
                GLAEmployeeDetails clsGLAEmployeeDetails = new GLAEmployeeDetails();
                iTranCount = 0;
                using (var reader = new StreamReader(strfile))
                {
                    string line;
                    while ((line = reader.ReadLine()) != null)
                    {
                        clsGLAEmployeeDetails = setEmpDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_d_emp_def, BatchID);
                        lstGLAEmployeeDetails.Add(clsGLAEmployeeDetails);

                        iTranCount++;
                    }
                }

                GLAEmployee clsGLAEmployee = new GLAEmployee(clsTransactionGLA.Connection, clsTransactionGLA.Transaction);
                clsGLAEmployee.Delete(BatchID);
                foreach (GLAEmployeeDetails det in lstGLAEmployeeDetails)
                {
                    clsGLAEmployee.Insert(det);
                }
                Label1.Text += "      <b><font class='ms-error'>" + lstGLAEmployeeDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />";
                /***** upload the discount end *****/
                #endregion

                #region GLA_file_d_location_def
                /***** upload the transaction *****/
                Label1.Text += "Processing " + Constants.GLA_file_d_location_def + " ...";
                strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_d_location_def));

                IList<GLALocationDetails> lstGLALocationDetails = new List<GLALocationDetails>();
                GLALocationDetails clsGLALocationDetails = new GLALocationDetails();
                iTranCount = 0;
                using (var reader = new StreamReader(strfile))
                {
                    string line;
                    while ((line = reader.ReadLine()) != null)
                    {
                        clsGLALocationDetails = setLocDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_d_location_def, BatchID);
                        lstGLALocationDetails.Add(clsGLALocationDetails);

                        iTranCount++;
                    }
                }

                GLALocation clsGLALocation = new GLALocation(clsTransactionGLA.Connection, clsTransactionGLA.Transaction);
                clsGLALocation.Delete(BatchID);
                foreach (GLALocationDetails det in lstGLALocationDetails)
                {
                    clsGLALocation.Insert(det);
                }
                Label1.Text += "      <b><font class='ms-error'>" + lstGLALocationDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />";
                /***** upload the discount end *****/
                #endregion

                #region GLA_file_d_mi_def
                /***** upload the transaction *****/
                if (pfilesName.IndexOf(Constants.GLA_file_d_mi_def) >= 0)
                {
                    Label1.Text += "Processing " + Constants.GLA_file_d_mi_def + " ...";
                    strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_d_mi_def));

                    IList<GLAItemDetails> lstGLAItemDetails = new List<GLAItemDetails>();
                    GLAItemDetails clsGLAItemDetails = new GLAItemDetails();
                    iTranCount = 0;
                    using (var reader = new StreamReader(strfile))
                    {
                        string line;
                        while ((line = reader.ReadLine()) != null)
                        {
                            clsGLAItemDetails = setItemDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_d_mi_def, BatchID);
                            lstGLAItemDetails.Add(clsGLAItemDetails);

                            iTranCount++;
                        }
                    }

                    if (lstGLAItemDetails.Count > 0)
                    {
                        GLAItem clsGLAItem = new GLAItem(clsTransactionGLA.Connection, clsTransactionGLA.Transaction);
                        clsGLAItem.Delete(BatchID);
                        foreach (GLAItemDetails det in lstGLAItemDetails)
                        {
                            clsGLAItem.Insert(det);
                        }
                    }
                    Label1.Text += "      <b><font class='ms-error'>" + lstGLAItemDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />";
                }
                /***** upload the discount end *****/
                #endregion

                #region GLA_file_d_svc_def
                /***** upload the transaction *****/
                Label1.Text += "Processing " + Constants.GLA_file_d_svc_def + " ...";
                strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_d_svc_def));

                IList<GLAServiceChargeDetails> lstGLAServiceChargeDetails = new List<GLAServiceChargeDetails>();
                GLAServiceChargeDetails clsGLAServiceChargeDetailss = new GLAServiceChargeDetails();
                iTranCount = 0;
                using (var reader = new StreamReader(strfile))
                {
                    string line;
                    while ((line = reader.ReadLine()) != null)
                    {
                        clsGLAServiceChargeDetailss = setSvcDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_d_svc_def, BatchID);
                        lstGLAServiceChargeDetails.Add(clsGLAServiceChargeDetailss);

                        iTranCount++;
                    }
                }

                GLAServiceCharge clsGLAServiceCharge = new GLAServiceCharge(clsTransactionGLA.Connection, clsTransactionGLA.Transaction);
                clsGLAServiceCharge.Delete(BatchID);
                foreach (GLAServiceChargeDetails det in lstGLAServiceChargeDetails)
                {
                    clsGLAServiceCharge.Insert(det);
                }
                Label1.Text += "      <b><font class='ms-error'>" + lstGLAServiceChargeDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />";
                /***** upload the discount end *****/
                #endregion

                #region GLA_file_d_tmd_def
                /***** upload the tenders *****/
                Label1.Text += "Processing " + Constants.GLA_file_d_tmd_def + " ...";
                strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_d_tmd_def));

                IList<GLATenderDetails> lstGLATenderDetails = new List<GLATenderDetails>();
                GLATenderDetails clsGLATenderDetails = new GLATenderDetails();
                iTranCount = 0;
                using (var reader = new StreamReader(strfile))
                {
                    string line;
                    while ((line = reader.ReadLine()) != null)
                    {
                        clsGLATenderDetails = setTenderDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_d_tmd_def, BatchID);
                        lstGLATenderDetails.Add(clsGLATenderDetails);

                        iTranCount++;
                    }
                }

                GLATender clsGLATender = new GLATender(clsTransactionGLA.Connection, clsTransactionGLA.Transaction);
                clsGLATender.Delete(BatchID);
                foreach (GLATenderDetails det in lstGLATenderDetails)
                {
                    clsGLATender.Insert(det);
                }
                Label1.Text += "      <b><font class='ms-error'>" + lstGLATenderDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />";
                
                /***** upload the discount end *****/
                #endregion

                #region GLA_file_f_dtl_chk_dsc
                /***** upload the transaction *****/
                Label1.Text += "Processing " + Constants.GLA_file_f_dtl_chk_dsc + " ...";
                strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_f_dtl_chk_dsc));

                IList<GLATransactionDiscountDetails> lstGLATransactionDiscountDetails = new List<GLATransactionDiscountDetails>();
                IList<GLATransactionDiscountDetails> lstGLATransactionDiscountDetailsContactCode = new List<GLATransactionDiscountDetails>();
                GLATransactionDiscountDetails clsGLATransactionDiscountDetails = new GLATransactionDiscountDetails();
                iTranCount = 0;
                using (var reader = new StreamReader(strfile))
                {
                    string line;
                    while ((line = reader.ReadLine()) != null)
                    {
                        clsGLATransactionDiscountDetails = setTranDscDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_f_dtl_chk_dsc, BatchID);
                        lstGLATransactionDiscountDetails.Add(clsGLATransactionDiscountDetails);

                        if (!string.IsNullOrEmpty(clsGLATransactionDiscountDetails.ContactCode)) lstGLATransactionDiscountDetailsContactCode.Add(clsGLATransactionDiscountDetails);
                        iTranCount++;
                    }
                }

                GLATransactionDiscount clsGLATransactionDiscount = new GLATransactionDiscount(clsTransactionGLA.Connection, clsTransactionGLA.Transaction);
                clsGLADiscount.Delete(BatchID);
                foreach (GLATransactionDiscountDetails det in lstGLATransactionDiscountDetails)
                {
                    clsGLATransactionDiscount.Insert(det);
                }
                Label1.Text += "      <b><font class='ms-error'>" + lstGLATransactionDiscountDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />";
                /***** upload the discount end *****/
                #endregion

                #region GLA_file_f_dtl_chk_headers
                /***** upload the transaction *****/
                Label1.Text += "Processing " + Constants.GLA_file_f_dtl_chk_headers + " ...";
                strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_f_dtl_chk_headers));

                List<GLATransactionDetails> lstGLATransactionDetails = new List<GLATransactionDetails>();
                GLATransactionDetails clsGLATransactionDetails = new GLATransactionDetails();
                iTranCount = 0;
                using (var reader = new StreamReader(strfile))
                {
                    string line;
                    while ((line = reader.ReadLine()) != null)
                    {
                        clsGLATransactionDetails = setTranHdrDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_f_dtl_chk_headers, BatchID);
                        lstGLATransactionDetails.Add(clsGLATransactionDetails);

                        iTranCount++;
                    }
                }
                GLATransaction clsGLATransaction = new GLATransaction(clsTransactionGLA.Connection, clsTransactionGLA.Transaction);
                clsGLATransaction.Delete(BatchID);
                foreach (GLATransactionDetails det in lstGLATransactionDetails)
                {
                    clsGLATransaction.Insert(det);
                }
                Label1.Text += "      <b><font class='ms-error'>" + lstGLATransactionDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />";
                /***** upload the transaction end *****/
                #endregion

                #region GLA_file_f_dtl_chk_mi
                /***** upload the transaction *****/
                Label1.Text += "Processing " + Constants.GLA_file_f_dtl_chk_mi + " ...";
                strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_f_dtl_chk_mi));

                IList<GLATransactionItemDetails> lstGLATransactionItemDetails = new List<GLATransactionItemDetails>();
                IList<GLATransactionItemDetails> lstGLATransactionItemDetailsContactCode = new List<GLATransactionItemDetails>();
                GLATransactionItemDetails clsGLATransactionItemDetails = new GLATransactionItemDetails();
                iTranCount = 0;
                using (var reader = new StreamReader(strfile))
                {
                    string line;
                    while ((line = reader.ReadLine()) != null)
                    {
                        clsGLATransactionItemDetails = setTranItemDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_f_dtl_chk_mi, BatchID);
                        lstGLATransactionItemDetails.Add(clsGLATransactionItemDetails);
                        iTranCount++;
                    }
                }

                GLATransactionItem clsGLATransactionItem = new GLATransactionItem(clsTransactionGLA.Connection, clsTransactionGLA.Transaction);
                clsGLATransactionItem.Delete(BatchID);
                foreach (GLATransactionItemDetails det in lstGLATransactionItemDetails)
                {
                    clsGLATransactionItem.Insert(det);
                }
                Label1.Text += "      <b><font class='ms-error'>" + lstGLATransactionItemDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />";
                /***** upload the discount end *****/
                #endregion

                #region GLA_file_f_dtl_chk_svc
                /***** upload the transaction *****/
                Label1.Text += "Processing " + Constants.GLA_file_f_dtl_chk_svc + " ...";
                strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_f_dtl_chk_svc));

                IList<GLATransactionSvcDetails> lstGLATransactionSvcDetails = new List<GLATransactionSvcDetails>();
                IList<GLATransactionSvcDetails> lstGLATransactionSvcDetailsContactCode = new List<GLATransactionSvcDetails>();
                GLATransactionSvcDetails clsGLATransactionSvcDetails = new GLATransactionSvcDetails();
                iTranCount = 0;
                using (var reader = new StreamReader(strfile))
                {
                    string line;
                    while ((line = reader.ReadLine()) != null)
                    {
                        clsGLATransactionSvcDetails = setTranSvcDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_f_dtl_chk_svc, BatchID);
                        lstGLATransactionSvcDetails.Add(clsGLATransactionSvcDetails);
                        iTranCount++;
                    }
                }

                GLATransactionSvc clsGLATransactionSvc = new GLATransactionSvc(clsTransactionGLA.Connection, clsTransactionGLA.Transaction);
                clsGLATransactionSvc.Delete(BatchID);
                foreach (GLATransactionSvcDetails det in lstGLATransactionSvcDetails)
                {
                    clsGLATransactionSvc.Insert(det);
                }
                Label1.Text += "      <b><font class='ms-error'>" + lstGLATransactionSvcDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />";
                /***** upload the discount end *****/
                #endregion

                #region GLA_file_f_dtl_chk_tmd
                /***** upload the transaction *****/
                Label1.Text += "Processing " + Constants.GLA_file_f_dtl_chk_tmd + " ...";
                strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_f_dtl_chk_tmd));

                IList<GLATransactionTenderDetails> lstGLATransactionTenderDetails = new List<GLATransactionTenderDetails>();
                IList<GLATransactionTenderDetails> lstGLATransactionTenderDetailsContactCode = new List<GLATransactionTenderDetails>();
                GLATransactionTenderDetails clsGLATransactionTenderDetails = new GLATransactionTenderDetails();
                iTranCount = 0;
                using (var reader = new StreamReader(strfile))
                {
                    string line;
                    while ((line = reader.ReadLine()) != null)
                    {
                        clsGLATransactionTenderDetails = setTranTenderDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_f_dtl_chk_tmd, BatchID);
                        lstGLATransactionTenderDetails.Add(clsGLATransactionTenderDetails);
                        iTranCount++;
                    }
                }

                GLATransactionTender clsGLATransactionTender = new GLATransactionTender(clsTransactionGLA.Connection, clsTransactionGLA.Transaction);
                clsGLATransactionTender.Delete(BatchID);
                foreach (GLATransactionTenderDetails det in lstGLATransactionTenderDetails)
                {
                    clsGLATransactionTender.Insert(det);
                }
                Label1.Text += "      <b><font class='ms-error'>" + lstGLATransactionTenderDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />";
                /***** upload the discount end *****/
                #endregion

                #region clsTransaction

                Label1.Text += "Processing transactions by members... ";

                Data.SalesTransactions clsTransaction = new SalesTransactions(clsTransactionGLA.Connection, clsTransactionGLA.Transaction);
                clsTransaction.DeleteByDataSource(BatchID);
                clsTransactionGLA.ProcessBatch(BatchID);

                Label1.Text += "      <b><font class='ms-error'>" + lstGLATransactionDiscountDetailsContactCode.Count.ToString() + " has been successfully uploaded...</font></b><br />";
                
                #endregion

                #region GLA_file_otntender
                ///***** upload the otn tender *****/
                //Label1.Text += "Processing " + Constants.GLA_file_otntender + " ...";
                //strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_otntender));

                //List<OrderTenderGLADetails> lstOrderTenderGLADetails = new List<OrderTenderGLADetails>();
                //OrderTenderGLADetails clsOrderTenderGLADetails = new OrderTenderGLADetails();
                //iTranCount = 0;
                //using (var reader = new StreamReader(strfile))
                //{
                //    string line;
                //    while ((line = reader.ReadLine()) != null)
                //    {
                //        clsOrderTenderGLADetails = setOrderTenderDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_otntender, BatchID);
                //        lstOrderTenderGLADetails.Add(clsOrderTenderGLADetails);

                //        iTranCount++;
                //    }
                //}

                //OrderTenderGLA clsOrderTenderGLA = new OrderTenderGLA(clsTransactionGLA.Connection, clsTransactionGLA.Transaction);

                //Data.Contacts clsContacts = new Contacts(clsTransactionGLA.Connection, clsTransactionGLA.Transaction);
                //Data.ContactDetails clsContactDetails = new ContactDetails();

                //foreach (OrderTenderGLADetails det in lstOrderTenderGLADetails)
                //{

                //    clsOrderTenderGLA.Insert(det);
                //    clsSalesTransactionDetails = clsTransaction.Details(det.tender_seq.ToString(), Constants.C_DEFAULT_TERMINAL_01, Constants.BRANCH_ID_MAIN);
                        
                //    // update the customer information
                //    clsSalesTransactionDetails = setSalesTransactionDetails(det, clsSalesTransactionDetails);
                //    clsContactDetails = clsContacts.Details(det.auth_acct_no);

                //    clsTransaction.UpdateContact(clsSalesTransactionDetails.TransactionID, clsSalesTransactionDetails.TransactionDate, clsContactDetails);
                        
                //    //clsTransaction.Close(clsSalesTransactionDetails.TransactionID, clsSalesTransactionDetails.SubTotal, clsSalesTransactionDetails.ItemsDiscount, clsSalesTransactionDetails.Discount, clsSalesTransactionDetails.TransDiscount, clsSalesTransactionDetails.TransDiscountType, clsSalesTransactionDetails.VAT, clsSalesTransactionDetails.VatableAmount, clsSalesTransactionDetails.EVAT, clsSalesTransactionDetails.EVatableAmount, clsSalesTransactionDetails.LocalTax, clsSalesTransactionDetails.AmountPaid, clsSalesTransactionDetails.CashPayment, clsSalesTransactionDetails.ChequePayment, clsSalesTransactionDetails.CreditCardPayment, clsSalesTransactionDetails.CreditPayment, clsSalesTransactionDetails.DebitPayment, clsSalesTransactionDetails.RewardPointsPayment, clsSalesTransactionDetails.RewardConvertedPayment, clsSalesTransactionDetails.BalanceAmount, clsSalesTransactionDetails.ChangeAmount, clsSalesTransactionDetails.PaymentType, clsSalesTransactionDetails.DiscountCode, clsSalesTransactionDetails.DiscountRemarks, clsSalesTransactionDetails.Charge, clsSalesTransactionDetails.ChargeAmount, clsSalesTransactionDetails.ChargeCode, clsSalesTransactionDetails.ChargeRemarks, clsSalesTransactionDetails.CashierID, clsSalesTransactionDetails.CashierName);
                //    //clsTransaction.UpdateDateClosed(clsSalesTransactionDetails.TransactionID, clsSalesTransactionDetails.DateClosed);
                //}

                //Label1.Text += "      <b><font class='ms-error'>" + lstOrderTenderGLADetails.Count.ToString() + " has been successfully uploaded...</font></b><br />";
                #endregion

                clsTransactionGLA.CommitAndDispose();
            }
            catch (Exception ex){
                clsTransactionGLA.ThrowException(ex);
                throw ex;
            }
		}
Пример #3
0
		private void SetDataSource(ReportDocument Report)
		{
            string strProductGroup = cboProductGroup.SelectedItem.Text == Constants.ALL ? string.Empty : cboProductGroup.SelectedItem.Text;
            string TransactionNo = txtTransactionNo.Text;
            string CustomerName = cboContactName.SelectedItem.Text.Substring(0, 3).Trim() == Constants.ALL ? cboContactName.SelectedItem.Text.Replace("ALL", "").Replace("LIKE","").Trim() : cboContactName.SelectedItem.Text;
            string AgentName = cboAgent.SelectedItem.Text.Substring(0, 3).Trim() == Constants.ALL ? cboAgent.SelectedItem.Text.Replace("ALL", "").Replace("LIKE", "").Trim() : cboAgent.SelectedItem.Text;
            string CashierName = cboCashierName.SelectedItem.Text.Substring(0, 3).Trim() == Constants.ALL ? cboCashierName.SelectedItem.Text.Replace("ALL", "").Replace("LIKE", "").Trim() : cboCashierName.SelectedItem.Text;
            string TerminalNo = cboTerminalNo.SelectedItem.Text == Constants.ALL ? string.Empty : cboTerminalNo.SelectedItem.Text;
            DateTime StartTransactionDate = DateTime.MinValue;
            try
            { StartTransactionDate = Convert.ToDateTime(txtStartTransactionDate.Text + " " + txtStartTime.Text); }
            catch { }
            DateTime EndTransactionDate = DateTime.MinValue;
            try
            { EndTransactionDate = Convert.ToDateTime(txtEndTransactionDate.Text + " " + txtEndTime.Text); }
            catch { }
            TransactionStatus Status = (TransactionStatus)Enum.Parse(typeof(TransactionStatus), cboTransactionStatus.SelectedItem.Value);
            PaymentTypes PaymentType = (PaymentTypes)Enum.Parse(typeof(PaymentTypes), cboPaymentType.SelectedItem.Value);

            DataTable dt = new DataTable();

			ReportDataset rptds = new ReportDataset();

			SalesTransactions clsSalesTransactions;

            SalesTransactionsColumns clsSalesTransactionsColumns = new SalesTransactionsColumns();
            #region clsSalesTransactionsColumns

            clsSalesTransactionsColumns.BranchCode = true;
            clsSalesTransactionsColumns.TransactionNo = true;
            clsSalesTransactionsColumns.CustomerName = true;
            clsSalesTransactionsColumns.CustomerGroupName = true;
            clsSalesTransactionsColumns.CashierName = true;
            clsSalesTransactionsColumns.TerminalNo = true;
            clsSalesTransactionsColumns.TransactionDate = true;
            clsSalesTransactionsColumns.DateSuspended = true;
            clsSalesTransactionsColumns.DateResumed = true;
            clsSalesTransactionsColumns.TransactionStatus = true;
            clsSalesTransactionsColumns.SubTotal = true;
            clsSalesTransactionsColumns.Discount = true;
            clsSalesTransactionsColumns.VAT = true;
            clsSalesTransactionsColumns.VATableAmount = true;
            clsSalesTransactionsColumns.LocalTax = true;
            clsSalesTransactionsColumns.AmountPaid = true;
            clsSalesTransactionsColumns.CashPayment = true;
            clsSalesTransactionsColumns.ChequePayment = true;
            clsSalesTransactionsColumns.CreditCardPayment = true;
            clsSalesTransactionsColumns.BalanceAmount = true;
            clsSalesTransactionsColumns.ChangeAmount = true;
            clsSalesTransactionsColumns.DateClosed = true;
            clsSalesTransactionsColumns.PaymentType = true;
            clsSalesTransactionsColumns.ItemsDiscount = true;
            clsSalesTransactionsColumns.Charge = true;
            clsSalesTransactionsColumns.CreditPayment = true;
            clsSalesTransactionsColumns.CreatedByName = true;
            clsSalesTransactionsColumns.AgentName = true;
            clsSalesTransactionsColumns.PaxNo = true;

            #endregion

            SalesTransactionDetails clsSearchKey = new SalesTransactionDetails();
            clsSearchKey = new SalesTransactionDetails();
            clsSearchKey.TransactionNo = TransactionNo;
            clsSearchKey.CustomerName = CustomerName;
            clsSearchKey.CashierName = CashierName;
            clsSearchKey.TerminalNo = TerminalNo;
            clsSearchKey.BranchID = int.Parse(cboBranch.SelectedItem.Value);
            clsSearchKey.TransactionDateFrom = StartTransactionDate;
            clsSearchKey.TransactionDateTo = EndTransactionDate;
            clsSearchKey.TransactionStatus = Status;
            clsSearchKey.PaymentType = PaymentType;
            clsSearchKey.AgentName = AgentName;
            clsSearchKey.isConsignmentSearch = cboConsignment.SelectedItem.Value;
            if (clsSearchKey.isConsignmentSearch != "-1")
            {
                clsSearchKey.isConsignment = bool.Parse(cboConsignment.SelectedItem.Value);
            }

            bool boWithTrustFund = true;

			string strReportType = cboReportType.SelectedValue;

            switch (strReportType)
			{
                case ReportTypes.SalesPerDay:
                    #region Sales Per Day
                    clsSalesTransactions = new SalesTransactions();
                    dt = clsSalesTransactions.ListAsDataTable(clsSearchKey.BranchID, clsSearchKey.TerminalNo, TransactionStatus: clsSearchKey.TransactionStatus, TransactionDateFrom: StartTransactionDate, TransactionDateTo: EndTransactionDate, WithTF: boWithTrustFund);
                    //dt = clsSalesTransactions.SalesPerDay(StartTransactionDate, EndTransactionDate, boWithTrustFund);
                    clsSalesTransactions.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.Transactions.NewRow();

                        foreach (DataColumn dc in rptds.Transactions.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.Transactions.Rows.Add(drNew);
                    }
                    break;
                    #endregion

                case ReportTypes.SummarizeDailySales:
                    #region SummarizeDailySales
                    Data.TerminalReportHistory clsTerminalReportHistory = new Data.TerminalReportHistory();
                    dt = clsTerminalReportHistory.SummarizedDailySalesReport(Int32.Parse(cboBranch.SelectedItem.Value), TerminalNo, true, StartTransactionDate, EndTransactionDate, boWithTrustFund);
                    clsTerminalReportHistory.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.SalesReport.NewRow();

                        foreach (DataColumn dc in rptds.SalesReport.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.SalesReport.Rows.Add(drNew);
                    }
                    break;
                    #endregion

				default:
					break;
			}

			Report.SetDataSource(rptds); 

			SetParameters(Report);

		}
Пример #4
0
		private void SetDataSource(ReportDocument Report)
		{
            string strProductGroup = cboProductGroup.SelectedItem.Text == Constants.ALL ? string.Empty : cboProductGroup.SelectedItem.Text;
            string TransactionNo = txtTransactionNo.Text;
            string CustomerGroupName = cboContactGroupName.SelectedItem.Text.Substring(0, 3).Trim() == Constants.ALL ? cboContactGroupName.SelectedItem.Text.Replace("ALL", "").Replace("LIKE", "").Trim() : cboContactGroupName.SelectedItem.Text;
            string CustomerName = cboContactName.SelectedItem.Text.Substring(0, 3).Trim() == Constants.ALL ? cboContactName.SelectedItem.Text.Replace("ALL", "").Replace("LIKE","").Trim() : cboContactName.SelectedItem.Text;
            string AgentName = cboAgent.SelectedItem.Text.Substring(0, 3).Trim() == Constants.ALL ? cboAgent.SelectedItem.Text.Replace("ALL", "").Replace("LIKE", "").Trim() : cboAgent.SelectedItem.Text;
            string CashierName = cboCashierName.SelectedItem.Text.Substring(0, 3).Trim() == Constants.ALL ? cboCashierName.SelectedItem.Text.Replace("ALL", "").Replace("LIKE", "").Trim() : cboCashierName.SelectedItem.Text;
            string TerminalNo = cboTerminalNo.SelectedItem.Text == Constants.ALL ? string.Empty : cboTerminalNo.SelectedItem.Text;

            DateTime StartValidityDate = DateTime.TryParse(txtStartValidityDate.Text + " 00:00:00" + txtStartTime.Text, out StartValidityDate) ? StartValidityDate : DateTime.MinValue;
            DateTime EndValidityDate = DateTime.TryParse(txtEndValidityDate.Text + " 23:59:59", out EndValidityDate) ? EndValidityDate : DateTime.MinValue;

            DateTime StartTransactionDate = DateTime.TryParse(txtStartTransactionDate.Text + " " + txtStartTime.Text, out StartTransactionDate) ? StartTransactionDate : DateTime.MinValue;
            DateTime EndTransactionDate = DateTime.TryParse(txtEndTransactionDate.Text + " " + txtEndTime.Text, out EndTransactionDate) ? EndTransactionDate : DateTime.MinValue;

            TransactionStatus Status = (TransactionStatus)Enum.Parse(typeof(TransactionStatus), cboTransactionStatus.SelectedItem.Value);
            PaymentTypes PaymentType = (PaymentTypes)Enum.Parse(typeof(PaymentTypes), cboPaymentType.SelectedItem.Value);

            DataTable dt = new DataTable();

			ReportDataset rptds = new ReportDataset();

			SalesTransactions clsSalesTransactions;
			SalesTransactionItems clsSalesTransactionItems;

            SalesTransactionsColumns clsSalesTransactionsColumns = new SalesTransactionsColumns();
            #region clsSalesTransactionsColumns

            clsSalesTransactionsColumns.BranchCode = true;
            clsSalesTransactionsColumns.TransactionNo = true;
            clsSalesTransactionsColumns.CustomerName = true;
            clsSalesTransactionsColumns.CustomerGroupName = true;
            clsSalesTransactionsColumns.CashierName = true;
            clsSalesTransactionsColumns.TerminalNo = true;
            clsSalesTransactionsColumns.TransactionDate = true;
            clsSalesTransactionsColumns.DateSuspended = true;
            clsSalesTransactionsColumns.DateResumed = true;
            clsSalesTransactionsColumns.TransactionStatus = true;
            clsSalesTransactionsColumns.SubTotal = true;
            clsSalesTransactionsColumns.Discount = true;
            clsSalesTransactionsColumns.VAT = true;
            clsSalesTransactionsColumns.VATableAmount = true;
            clsSalesTransactionsColumns.LocalTax = true;
            clsSalesTransactionsColumns.AmountPaid = true;
            clsSalesTransactionsColumns.CashPayment = true;
            clsSalesTransactionsColumns.ChequePayment = true;
            clsSalesTransactionsColumns.CreditCardPayment = true;
            clsSalesTransactionsColumns.BalanceAmount = true;
            clsSalesTransactionsColumns.ChangeAmount = true;
            clsSalesTransactionsColumns.DateClosed = true;
            clsSalesTransactionsColumns.PaymentType = true;
            clsSalesTransactionsColumns.ItemsDiscount = true;
            clsSalesTransactionsColumns.Charge = true;
            clsSalesTransactionsColumns.CreditPayment = true;
            clsSalesTransactionsColumns.CreatedByName = true;
            clsSalesTransactionsColumns.AgentName = true;
            clsSalesTransactionsColumns.PaxNo = true;

            #endregion

            SalesTransactionDetails clsSearchKey = new SalesTransactionDetails();
            clsSearchKey = new SalesTransactionDetails();
            clsSearchKey.TransactionNo = TransactionNo;
            clsSearchKey.CustomerGroupName = CustomerGroupName;
            clsSearchKey.CustomerName = CustomerName;
            clsSearchKey.CashierName = CashierName;
            clsSearchKey.TerminalNo = TerminalNo;
            clsSearchKey.BranchID = int.Parse(cboBranch.SelectedItem.Value);
            clsSearchKey.TransactionDateFrom = StartTransactionDate;
            clsSearchKey.TransactionDateTo = EndTransactionDate;
            clsSearchKey.TransactionStatus = Status;
            clsSearchKey.PaymentType = PaymentType;
            clsSearchKey.AgentName = AgentName;
            clsSearchKey.isConsignmentSearch = cboConsignment.SelectedItem.Value;
            if (clsSearchKey.isConsignmentSearch != "-1")
            {
                clsSearchKey.isConsignment = bool.Parse(cboConsignment.SelectedItem.Value);
            }

            bool boWithTrustFund = true;

			string strReportType = cboReportType.SelectedValue;

            switch (strReportType)
			{
                case ReportTypes.SalesPerHour:
                    #region Sales Per Hour
                    clsSalesTransactions = new SalesTransactions();
                    dt = clsSalesTransactions.SalesPerHour(string.Empty, string.Empty, StartTransactionDate, EndTransactionDate,0, cboTerminalNo.SelectedItem.Text);
			        clsSalesTransactions.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.SalesPerHour.NewRow();

                        foreach (DataColumn dc in rptds.SalesPerHour.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.SalesPerHour.Rows.Add(drNew);
                    }
                    break;
                    #endregion

                case ReportTypes.SalesPerDay:
                //case ReportTypes.SalesPerDayWithTF:
                    #region Sales Per Day
                    if (strReportType == ReportTypes.SalesPerDay) boWithTrustFund = false;
                    clsSalesTransactions = new SalesTransactions();
                    dt = clsSalesTransactions.ListAsDataTable(clsSearchKey.BranchID, clsSearchKey.TerminalNo, TransactionStatus: clsSearchKey.TransactionStatus, TransactionDateFrom: StartTransactionDate, TransactionDateTo: EndTransactionDate, WithTF: boWithTrustFund);
                    //dt = clsSalesTransactions.SalesPerDay(StartTransactionDate, EndTransactionDate, boWithTrustFund);
                    clsSalesTransactions.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.Transactions.NewRow();

                        foreach (DataColumn dc in rptds.Transactions.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.Transactions.Rows.Add(drNew);
                    }
                    break;
                    #endregion

                case ReportTypes.SummarizeDailySales:
                //case ReportTypes.SummarizeDailySalesWithTF:
                    #region SummarizeDailySales

                    if (strReportType == ReportTypes.SummarizeDailySales) boWithTrustFund = false;
                    Data.TerminalReportHistory clsTerminalReportHistory = new Data.TerminalReportHistory();
                    dt = clsTerminalReportHistory.SummarizedDailySalesReport(Int32.Parse(cboBranch.SelectedItem.Value), TerminalNo, false, StartTransactionDate, EndTransactionDate, boWithTrustFund);
                    clsTerminalReportHistory.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.SalesReport.NewRow();

                        foreach (DataColumn dc in rptds.SalesReport.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.SalesReport.Rows.Add(drNew);
                    }
                    break;
                    #endregion

                case ReportTypes.SalesTransactions:
                    #region Sales Transactions
                    clsSalesTransactions = new SalesTransactions();
                    //dt = clsSalesTransactions.List(clsSalesTransactionsColumns, clsSearchKey, System.Data.SqlClient.SortOrder.Ascending, 0, "TransactionNo", System.Data.SqlClient.SortOrder.Ascending);
                    dt = clsSalesTransactions.ListAsDataTable(clsSearchKey, false, "TransactionNo", SortOption.Ascending, 0);
                    clsSalesTransactions.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.Transactions.NewRow();

                        foreach (DataColumn dc in rptds.Transactions.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.Transactions.Rows.Add(drNew);
                    }
                    break;
                    #endregion

                case ReportTypes.SalesTransactionPerCustomer:
                case ReportTypes.SalesTransactionPerCustomerPerGroup:
                case ReportTypes.SalesTransactionPerCustomerPerGroupSummarized:
                case ReportTypes.SalesTransactionPerCustomerWithCheque:
                case ReportTypes.SalesTransactionPerCashierPerCustomer:
                    #region Sales Transaction Per Customer
                    clsSalesTransactions = new SalesTransactions();
                    //dt = clsSalesTransactions.List(clsSalesTransactionsColumns, clsSearchKey, System.Data.SqlClient.SortOrder.Ascending, 0, "CustomerName", System.Data.SqlClient.SortOrder.Ascending);
                    dt = clsSalesTransactions.ListAsDataTable(clsSearchKey, false, "CustomerName", SortOption.Ascending, 0);
                    clsSalesTransactions.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.Transactions.NewRow();

                        foreach (DataColumn dc in rptds.Transactions.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.Transactions.Rows.Add(drNew);
                    }
                    break;
                    #endregion
                case ReportTypes.SalesTransactionPerCustomerPerItem:
                    #region Sales Transaction Per Customer Per Item
                    clsSalesTransactions = new SalesTransactions();
                    //dt = clsSalesTransactions.List(clsSalesTransactionsColumns, clsSearchKey, System.Data.SqlClient.SortOrder.Ascending, 0, "CustomerName", System.Data.SqlClient.SortOrder.Ascending);
                    dt = clsSalesTransactions.ListAsDataTable(clsSearchKey, false, "CustomerName", SortOption.Ascending, 0);
                    clsSalesTransactions.CommitAndDispose();

                    string stIDs = "";
                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.Transactions.NewRow();

                        foreach (DataColumn dc in rptds.Transactions.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.Transactions.Rows.Add(drNew);

                        stIDs += "," + dr["TransactionID"].ToString();
                    }

                    if (dt.Rows.Count > 0)
                    {
                        clsSalesTransactionItems = new SalesTransactionItems();
                        dt = clsSalesTransactionItems.List(stIDs.Remove(0,1));

                        foreach (DataRow dr in dt.Rows)
                        {
                            DataRow drNew = rptds.TransactionItems.NewRow();

                            foreach (DataColumn dc in rptds.TransactionItems.Columns)
                                drNew[dc] = dr[dc.ColumnName];

                            rptds.TransactionItems.Rows.Add(drNew);
                        }
                    }
                    break;

                    #endregion
                case ReportTypes.SalesTransactionPerCashier:
                    #region Sales Transaction Per Cashier/Customer & Per Cashier
                    clsSalesTransactions = new SalesTransactions();
                    //dt = clsSalesTransactions.List(clsSalesTransactionsColumns, clsSearchKey, System.Data.SqlClient.SortOrder.Ascending, 0, "CashierName", System.Data.SqlClient.SortOrder.Ascending);
                    dt = clsSalesTransactions.ListAsDataTable(clsSearchKey, false, "CashierName", SortOption.Ascending, 0);
                    clsSalesTransactions.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.Transactions.NewRow();

                        foreach (DataColumn dc in rptds.Transactions.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.Transactions.Rows.Add(drNew);
                    }
					break;
                    #endregion
                case ReportTypes.DailySalesTransaction:
                case ReportTypes.WeeklySalesTransaction:
                case ReportTypes.MonthlySalesTransaction:
                    #region Daily, Weekely, Monthly Sales Transaction

                    clsSalesTransactions = new SalesTransactions();
                    //dt = clsSalesTransactions.List(clsSalesTransactionsColumns, clsSearchKey, System.Data.SqlClient.SortOrder.Ascending, 0, "TransactionDate", System.Data.SqlClient.SortOrder.Ascending);
                    dt = clsSalesTransactions.ListAsDataTable(clsSearchKey, false, "TransactionDate", SortOption.Ascending, 0);
                    clsSalesTransactions.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.Transactions.NewRow();

                        foreach (DataColumn dc in rptds.Transactions.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.Transactions.Rows.Add(drNew);
                    }
					break;
                    #endregion

                case ReportTypes.SalesTransactionPerTerminal:
                    #region Sales Transaction Per Terminal
                    clsSalesTransactions = new SalesTransactions();
                    //dt = clsSalesTransactions.List(clsSalesTransactionsColumns, clsSearchKey, System.Data.SqlClient.SortOrder.Ascending, 0, "tblTransactions.TerminalNo", System.Data.SqlClient.SortOrder.Ascending);
                    dt = clsSalesTransactions.ListAsDataTable(clsSearchKey, false, "TerminalNo", SortOption.Ascending, 0);
                    clsSalesTransactions.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.Transactions.NewRow();

                        foreach (DataColumn dc in rptds.Transactions.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.Transactions.Rows.Add(drNew);
                    }
					break;
                    #endregion

                case ReportTypes.SalesTransactionPerItem:
                case ReportTypes.SalesTransactionPerItemWoutPurchaseDetails:
                    #region Sales Transaction Per Item

                    SaleperItemFilterType enumSaleperItemFilterType = SaleperItemFilterType.ShowBothPositiveAndNegative;
                    if (rdoShowPositiveOnly.Checked) enumSaleperItemFilterType = SaleperItemFilterType.ShowPositiveOnly;
                    if (rdoShowNegativeOnly.Checked) enumSaleperItemFilterType = SaleperItemFilterType.ShowNegativeOnly;

					clsSalesTransactionItems = new SalesTransactionItems();
                    if (cboProductGroup.Text == Constants.ALL)
                        dt = clsSalesTransactionItems.SalesPerItem(TransactionNo + "%", CustomerName + "%", CashierName + "%",
                            TerminalNo + "%", StartTransactionDate, EndTransactionDate, Status, PaymentType, enumSaleperItemFilterType);
                    else
                        dt = clsSalesTransactionItems.SalesPerItemByGroup(strProductGroup + "%", TransactionNo + "%", CustomerName + "%", CashierName + "%",
                            TerminalNo + "%", StartTransactionDate, EndTransactionDate, Status, PaymentType, enumSaleperItemFilterType);

					clsSalesTransactionItems.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.SalesTransactionPerItem.NewRow();

                        foreach (DataColumn dc in rptds.SalesTransactionPerItem.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.SalesTransactionPerItem.Rows.Add(drNew);
                    }
					break;
                    #endregion

                case ReportTypes.CashSalesDaily:
                case ReportTypes.CashSalesMonthly:
                    #region Cash-Sales Daily & Cash-Sales Monthly
                    clsSalesTransactionsColumns = new SalesTransactionsColumns();
                    #region clsSalesTransactionsColumns

                    clsSalesTransactionsColumns.TransactionDate = true;
                    clsSalesTransactionsColumns.TransactionStatus = true;
                    clsSalesTransactionsColumns.TransactionStatusName = true;
                    clsSalesTransactionsColumns.CashPayment = true;

                    #endregion

                    clsSalesTransactions = new SalesTransactions();
                    dt = clsSalesTransactions.Cash_Cheque_CreditCard_Credit_Sales(clsSalesTransactionsColumns, clsSearchKey, System.Data.SqlClient.SortOrder.Ascending, 0, "tblTransactions.TerminalNo", System.Data.SqlClient.SortOrder.Ascending);
                    clsSalesTransactions.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.CashSales.NewRow();

                        foreach (DataColumn dc in rptds.CashSales.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.CashSales.Rows.Add(drNew);
                    }
                    break;
                    #endregion

                case ReportTypes.ChequePaymentList:
                    #region ChequePaymentList
                    
                    ChequePaymentDetails clsChequeSearchKeys = new ChequePaymentDetails();

                    clsChequeSearchKeys.TransactionNo = TransactionNo;
                    clsChequeSearchKeys.CustomerGroupName = CustomerGroupName;
                    clsChequeSearchKeys.CustomerName = CustomerName;
                    clsChequeSearchKeys.CashierName = CashierName;
                    clsChequeSearchKeys.TerminalNo = TerminalNo;
                    clsChequeSearchKeys.BranchDetails.BranchID = int.Parse(cboBranch.SelectedItem.Value);
                    clsChequeSearchKeys.TransactionDateFrom = StartTransactionDate;
                    clsChequeSearchKeys.TransactionDateTo = EndTransactionDate;
                    clsChequeSearchKeys.ValidityDateFrom = StartValidityDate;
                    clsChequeSearchKeys.ValidityDateTo = StartValidityDate;
                    clsChequeSearchKeys.TransactionStatus = Status;
                    clsChequeSearchKeys.PaymentType = PaymentType;
                    clsChequeSearchKeys.AgentName = AgentName;

                    ChequePayments clsChequePayments = new ChequePayments();
                    dt = clsChequePayments.ListAsReport(clsChequeSearchKeys);
                    clsChequePayments.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.ChequePayments.NewRow();

                        foreach (DataColumn dc in rptds.ChequePayments.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.ChequePayments.Rows.Add(drNew);
                    }
                    break;
                    #endregion
                case ReportTypes.ChequeSalesDaily:
                case ReportTypes.ChequeSalesMonthly:
                    #region Cheque-Sales Daily & Cheque-Sales Monthly
                    clsSalesTransactionsColumns = new SalesTransactionsColumns();
                    #region clsSalesTransactionsColumns

                    clsSalesTransactionsColumns.TransactionDate = true;
                    clsSalesTransactionsColumns.TransactionStatus = true;
                    clsSalesTransactionsColumns.TransactionStatusName = true;
                    clsSalesTransactionsColumns.ChequePayment = true;

                    #endregion

                    clsSalesTransactions = new SalesTransactions();
                    dt = clsSalesTransactions.Cash_Cheque_CreditCard_Credit_Sales(clsSalesTransactionsColumns, clsSearchKey, System.Data.SqlClient.SortOrder.Ascending, 0, "tblTransactions.TerminalNo", System.Data.SqlClient.SortOrder.Ascending);
                    clsSalesTransactions.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.ChequeSales.NewRow();

                        foreach (DataColumn dc in rptds.ChequeSales.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.ChequeSales.Rows.Add(drNew);
                    }
                    break;
                    #endregion

                case ReportTypes.CreditCardSalesDaily:
                case ReportTypes.CreditCardSalesMonthly:
                    #region Card-Sales Daily    Card-Sales Monthly

                    clsSalesTransactionsColumns = new SalesTransactionsColumns();
                    #region clsSalesTransactionsColumns

                    clsSalesTransactionsColumns.TransactionDate = true;
                    clsSalesTransactionsColumns.TransactionStatus = true;
                    clsSalesTransactionsColumns.TransactionStatusName = true;
                    clsSalesTransactionsColumns.CreditCardPayment = true;

                    #endregion

                    clsSalesTransactions = new SalesTransactions();
                    dt = clsSalesTransactions.Cash_Cheque_CreditCard_Credit_Sales(clsSalesTransactionsColumns, clsSearchKey, System.Data.SqlClient.SortOrder.Ascending, 0, "tblTransactions.TerminalNo", System.Data.SqlClient.SortOrder.Ascending);
                    clsSalesTransactions.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.CreditCardSales.NewRow();

                        foreach (DataColumn dc in rptds.CreditCardSales.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.CreditCardSales.Rows.Add(drNew);
                    }
                    break;
                    #endregion

                case ReportTypes.PaidOut:
                    #region PaidOut Report
                    PaidOutColumns clsPaidOutColumns = new PaidOutColumns();
                    clsPaidOutColumns.BranchDetails = true;
                    clsPaidOutColumns.TerminalNo = true;
                    clsPaidOutColumns.Amount = true;
                    clsPaidOutColumns.PaymentType = true;
                    clsPaidOutColumns.DateCreated = true;
                    clsPaidOutColumns.TerminalNo = true;
                    clsPaidOutColumns.CashierID = true;
                    clsPaidOutColumns.CashierName = true;
                    clsPaidOutColumns.Remarks = true;

                    PaidOutDetails clsPaidOutSeachKey = new PaidOutDetails();
                    clsPaidOutSeachKey.StartTransactionDate = StartTransactionDate;
                    clsPaidOutSeachKey.EndTransactionDate = EndTransactionDate;

                    PaidOut clsPaidOut = new PaidOut();
                    dt = clsPaidOut.ListAsDataTable(clsPaidOutColumns, clsPaidOutSeachKey);
                    clsPaidOut.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.PaidOut.NewRow();

                        foreach (DataColumn dc in rptds.PaidOut.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.PaidOut.Rows.Add(drNew);
                    }
                    break;
                    #endregion

                case ReportTypes.Disburse:
                    #region Disburse Report
                    DisburseColumns clsDisburseColumns = new DisburseColumns();
                    clsDisburseColumns.BranchDetails = true;
                    clsDisburseColumns.TerminalNo = true;
                    clsDisburseColumns.Amount = true;
                    clsDisburseColumns.PaymentType = true;
                    clsDisburseColumns.DateCreated = true;
                    clsDisburseColumns.TerminalNo = true;
                    clsDisburseColumns.CashierID = true;
                    clsDisburseColumns.CashierName = true;
                    clsDisburseColumns.Remarks = true;

                    DisburseDetails clsDisburseSeachKey = new DisburseDetails();
                    clsDisburseSeachKey.StartTransactionDate = StartTransactionDate;
                    clsDisburseSeachKey.EndTransactionDate = EndTransactionDate;

                    Disburses clsDisburse = new Disburses();
                    dt = clsDisburse.ListAsDataTable(clsDisburseColumns, clsDisburseSeachKey);
                    clsDisburse.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.Disburse.NewRow();

                        foreach (DataColumn dc in rptds.Disburse.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.Disburse.Rows.Add(drNew);
                    }
                    break;
                    #endregion

                case ReportTypes.RecieveOnAccount:
                    #region WithHold Report
                    WithholdColumns clsWithHoldColumns = new WithholdColumns();
                    clsWithHoldColumns.BranchDetails = true;
                    clsWithHoldColumns.TerminalNo = true;
                    clsWithHoldColumns.Amount = true;
                    clsWithHoldColumns.PaymentType = true;
                    clsWithHoldColumns.DateCreated = true;
                    clsWithHoldColumns.TerminalNo = true;
                    clsWithHoldColumns.CashierID = true;
                    clsWithHoldColumns.CashierName = true;
                    clsWithHoldColumns.Remarks = true;

                    WithholdDetails clsWithHoldSeachKey = new WithholdDetails();
                    clsWithHoldSeachKey.StartTransactionDate = StartTransactionDate;
                    clsWithHoldSeachKey.EndTransactionDate = EndTransactionDate;

                    Withhold clsWithHold = new Withhold();
                    dt = clsWithHold.ListAsDataTable(clsWithHoldColumns, clsWithHoldSeachKey);
                    clsWithHold.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.Withhold.NewRow();

                        foreach (DataColumn dc in rptds.Withhold.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.Withhold.Rows.Add(drNew);
                    }
                    break;
                    #endregion

				default:
					break;
			}

			Report.SetDataSource(rptds); 

			SetParameters(Report);

		}
Пример #5
0
		private void SetDataSource(ReportDocument Report)
		{
            string strProductGroup = cboProductGroup.SelectedItem.Text == Constants.ALL ? string.Empty : cboProductGroup.SelectedItem.Text;
            string TransactionNo = txtTransactionNo.Text;
            string CustomerGroupName = cboContactGroupName.SelectedItem.Text.Substring(0, 3).Trim() == Constants.ALL ? cboContactGroupName.SelectedItem.Text.Replace("ALL", "").Replace("LIKE", "").Trim() : cboContactGroupName.SelectedItem.Text;
            string CustomerName = cboContactName.SelectedItem.Text.Substring(0, 3).Trim() == Constants.ALL ? cboContactName.SelectedItem.Text.Replace("ALL", "").Replace("LIKE","").Trim() : cboContactName.SelectedItem.Text;
            string AgentName = cboAgent.SelectedItem.Text.Substring(0, 3).Trim() == Constants.ALL ? cboAgent.SelectedItem.Text.Replace("ALL", "").Replace("LIKE", "").Trim() : cboAgent.SelectedItem.Text;
            string CashierName = cboCashierName.SelectedItem.Text.Substring(0, 3).Trim() == Constants.ALL ? cboCashierName.SelectedItem.Text.Replace("ALL", "").Replace("LIKE", "").Trim() : cboCashierName.SelectedItem.Text;
            string TerminalNo = cboTerminalNo.SelectedItem.Text == Constants.ALL ? string.Empty : cboTerminalNo.SelectedItem.Text;
            DateTime StartTransactionDate = DateTime.MinValue;
            StartTransactionDate = DateTime.TryParse(txtStartTransactionDate.Text + " " + txtStartTime.Text, out StartTransactionDate) ? StartTransactionDate : DateTime.MinValue;

            DateTime EndTransactionDate = DateTime.MinValue;
            EndTransactionDate = DateTime.TryParse(txtEndTransactionDate.Text + " " + txtEndTime.Text, out EndTransactionDate) ? EndTransactionDate : DateTime.MinValue;

            TransactionStatus Status = (TransactionStatus)Enum.Parse(typeof(TransactionStatus), cboTransactionStatus.SelectedItem.Value);
            PaymentTypes PaymentType = (PaymentTypes)Enum.Parse(typeof(PaymentTypes), cboPaymentType.SelectedItem.Value);

            DataTable dt = new DataTable();

			ReportDataset rptds = new ReportDataset();

			SalesTransactions clsSalesTransactions;
			SalesTransactionItems clsSalesTransactionItems;

            SalesTransactionsColumns clsSalesTransactionsColumns = new SalesTransactionsColumns();
            #region clsSalesTransactionsColumns

            clsSalesTransactionsColumns.BranchCode = true;
            clsSalesTransactionsColumns.TransactionNo = true;
            clsSalesTransactionsColumns.CustomerName = true;
            clsSalesTransactionsColumns.CustomerGroupName = true;
            clsSalesTransactionsColumns.CashierName = true;
            clsSalesTransactionsColumns.TerminalNo = true;
            clsSalesTransactionsColumns.TransactionDate = true;
            clsSalesTransactionsColumns.DateSuspended = true;
            clsSalesTransactionsColumns.DateResumed = true;
            clsSalesTransactionsColumns.TransactionStatus = true;
            clsSalesTransactionsColumns.SubTotal = true;
            clsSalesTransactionsColumns.Discount = true;
            clsSalesTransactionsColumns.VAT = true;
            clsSalesTransactionsColumns.VATableAmount = true;
            clsSalesTransactionsColumns.LocalTax = true;
            clsSalesTransactionsColumns.AmountPaid = true;
            clsSalesTransactionsColumns.CashPayment = true;
            clsSalesTransactionsColumns.ChequePayment = true;
            clsSalesTransactionsColumns.CreditCardPayment = true;
            clsSalesTransactionsColumns.BalanceAmount = true;
            clsSalesTransactionsColumns.ChangeAmount = true;
            clsSalesTransactionsColumns.DateClosed = true;
            clsSalesTransactionsColumns.PaymentType = true;
            clsSalesTransactionsColumns.ItemsDiscount = true;
            clsSalesTransactionsColumns.Charge = true;
            clsSalesTransactionsColumns.CreditPayment = true;
            clsSalesTransactionsColumns.CreatedByName = true;
            clsSalesTransactionsColumns.AgentName = true;
            clsSalesTransactionsColumns.PaxNo = true;

            #endregion

            SalesTransactionDetails clsSearchKey = new SalesTransactionDetails();
            clsSearchKey = new SalesTransactionDetails();
            clsSearchKey.TransactionNo = TransactionNo;
            clsSearchKey.CustomerGroupName = CustomerGroupName;
            clsSearchKey.CustomerName = CustomerName;
            clsSearchKey.CashierName = CashierName;
            clsSearchKey.TerminalNo = TerminalNo;
            clsSearchKey.BranchID = int.Parse(cboBranch.SelectedItem.Value);
            clsSearchKey.TransactionDateFrom = StartTransactionDate;
            clsSearchKey.TransactionDateTo = EndTransactionDate;
            clsSearchKey.TransactionStatus = Status;
            clsSearchKey.PaymentType = PaymentType;
            clsSearchKey.AgentName = AgentName;
            clsSearchKey.isConsignmentSearch = cboConsignment.SelectedItem.Value;
            if (clsSearchKey.isConsignmentSearch != "-1")
            {
                clsSearchKey.isConsignment = bool.Parse(cboConsignment.SelectedItem.Value);
            }

			string strReportType = cboReportType.SelectedValue;

            switch (strReportType)
			{
                case ReportTypes.ANALYTICS_All:
                case ReportTypes.ANALYTICS_All_Covers:
                    #region Daily, Weekely, Monthly Sales Transaction

                    clsSalesTransactions = new SalesTransactions();
                    dt = clsSalesTransactions.List(clsSalesTransactionsColumns, clsSearchKey, System.Data.SqlClient.SortOrder.Ascending, 0, "TransactionDate", System.Data.SqlClient.SortOrder.Ascending);
                    clsSalesTransactions.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.Transactions.NewRow();

                        foreach (DataColumn dc in rptds.Transactions.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.Transactions.Rows.Add(drNew);
                    }
					break;
                    #endregion

                case ReportTypes.ANALYTICS_ItemsForPOBasedOnSales:
                    #region Items For PO Based On Sales

                    SaleperItemFilterType enumSaleperItemFilterType = SaleperItemFilterType.ShowBothPositiveAndNegative;
                    if (rdoShowPositiveOnly.Checked) enumSaleperItemFilterType = SaleperItemFilterType.ShowPositiveOnly;
                    if (rdoShowNegativeOnly.Checked) enumSaleperItemFilterType = SaleperItemFilterType.ShowNegativeOnly;

                    clsSalesTransactionItems = new SalesTransactionItems();
                    //if (cboProductGroup.Text == Constants.ALL)
                    //    dt = clsSalesTransactionItems.SalesPerItem(TransactionNo + "%", CustomerName + "%", CashierName + "%",
                    //        TerminalNo + "%", StartTransactionDate, EndTransactionDate, Status, PaymentType, enumSaleperItemFilterType);
                    //else
                    //    dt = clsSalesTransactionItems.SalesPerItemByGroup(strProductGroup + "%", TransactionNo + "%", CustomerName + "%", CashierName + "%",
                    //        TerminalNo + "%", StartTransactionDate, EndTransactionDate, Status, PaymentType, enumSaleperItemFilterType);

                    if (cboProductGroup.Text == Constants.ALL)
                        dt = clsSalesTransactionItems.SalesPerItem(TransactionNo, CustomerName, CashierName, TerminalNo, StartTransactionDate, EndTransactionDate, Status, PaymentType, enumSaleperItemFilterType);
                    else
                        dt = clsSalesTransactionItems.SalesPerItemByGroupProc(strProductGroup, TransactionNo, CustomerName, CashierName, TerminalNo, StartTransactionDate, EndTransactionDate, Status, PaymentType, enumSaleperItemFilterType);

                    clsSalesTransactionItems.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.SalesTransactionPerItem.NewRow();

                        foreach (DataColumn dc in rptds.SalesTransactionPerItem.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.SalesTransactionPerItem.Rows.Add(drNew);
                    }
                    break;
                    #endregion

				default:
					break;
			}

			Report.SetDataSource(rptds); 

			SetParameters(Report);

		}
Пример #6
0
		private void SetDataSource(ReportDocument Report)
		{
			ReportDataset rptds = new ReportDataset();
            DataTable dt;

            switch (cboReportType.SelectedValue)
            {
                case ReportTypes.CustomerCredit:
                    #region Customer Credit
                    Customer clsCustomer = new Customer();
                    dt = clsCustomer.CustomersDataTable(cboContactName.SelectedItem.Text);

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.CustomerDetails.NewRow();

                        foreach (DataColumn dc in rptds.CustomerDetails.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.CustomerDetails.Rows.Add(drNew);
                    }

                    SalesTransactions clsSalesTransactions = new SalesTransactions(clsCustomer.Connection, clsCustomer.Transaction);
                    dt = clsSalesTransactions.ListForPaymentDataTable(Convert.ToInt64(cboContactName.SelectedItem.Value));
                    clsCustomer.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.CustomerCredit.NewRow();

                        foreach (DataColumn dc in rptds.CustomerCredit.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.CustomerCredit.Rows.Add(drNew);
                    }

                    break;
                    #endregion
                
                case ReportTypes.CustomerCreditListWCredit:
                    #region  Customers List With Credit

                    Contacts clsContact = new Contacts();
                    dt = clsContact.CustomerAdvanceSearch(null, cboContactName.SelectedItem.Text, cboCustomerGroup.SelectedItem.Value, true, "ContactID", SortOption.Ascending);
                    clsContact.CommitAndDispose();

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.Contacts.NewRow();

                        foreach (DataColumn dc in rptds.Contacts.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.Contacts.Rows.Add(drNew);
                    }
                    
                    break;
                    #endregion
                
            }
			Report.SetDataSource(rptds); 
			SetParameters(Report);
		}