Exemplo n.º 1
0
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         SalesOrderMasterSP spSalesOrderMaster = new SalesOrderMasterSP();
         if (txtVoucherNo.Text.Trim() == string.Empty)
         {
             strInvoiceNo = "-1";
         }
         else
         {
             strInvoiceNo = txtVoucherNo.Text;
         }
         if (cmbCashOrParty.SelectedIndex == 0 || cmbCashOrParty.SelectedIndex == -1)
         {
             decLedgerId = -1;
         }
         else
         {
             decLedgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString());
         }
         if (cmbVoucherType.SelectedIndex == 0 || cmbVoucherType.SelectedIndex == -1)
         {
             decVoucherTypeId = -1;
         }
         else
         {
             decVoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString());
         }
         if (cmbSalesMan.SelectedIndex == 0 || cmbSalesMan.SelectedIndex == -1)
         {
             decEmployeeId = -1;
         }
         else
         {
             decEmployeeId = Convert.ToDecimal(cmbSalesMan.SelectedValue.ToString());
         }
         if (txtProductCode.Text.Trim() == string.Empty)
         {
             strProductCode = string.Empty;
         }
         else
         {
             strProductCode = txtProductCode.Text;
         }
         if (cmbArea.SelectedIndex == 0 || cmbArea.SelectedIndex == -1)
         {
             decAreaId = -1;
         }
         else
         {
             decAreaId = Convert.ToDecimal(cmbArea.SelectedValue.ToString());
         }
         if (cmbRoute.SelectedIndex == 0 || cmbRoute.SelectedIndex == -1)
         {
             decRouteId = -1;
         }
         else
         {
             decRouteId = Convert.ToDecimal(cmbRoute.SelectedValue.ToString());
         }
         if (cmbProductGroup.SelectedIndex == 0 || cmbProductGroup.SelectedIndex == -1)
         {
             decGroupId = -1;
         }
         else
         {
             decGroupId = Convert.ToDecimal(cmbProductGroup.SelectedValue.ToString());
         }
         if (cmbQuotationNo.SelectedIndex == 0)
         {
             strSalesQuotationNo = "-1";
         }
         else
         {
             strSalesQuotationNo = cmbQuotationNo.SelectedValue.ToString();
         }
         if (cmbStatus.SelectedIndex == 0 || cmbStatus.SelectedIndex == -1)
         {
             strStatus = "All";
         }
         else
         {
             strStatus = cmbStatus.SelectedItem.ToString();
         }
         DateTime FromDate = this.dtpFromDate.Value;
         DateTime ToDate   = this.dtpToDate.Value;
         dtblSalesOrderReport = spSalesOrderMaster.SalesOrderReportViewAll(strInvoiceNo, decLedgerId, strProductCode, decVoucherTypeId, FromDate, ToDate, strStatus, decEmployeeId, strSalesQuotationNo, decAreaId, decGroupId, decRouteId);
         if (dtblSalesOrderReport.Rows.Count > 0)
         {
             decimal decTotal = 0;
             for (int i = 0; i < dtblSalesOrderReport.Rows.Count; i++)
             {
                 if (dtblSalesOrderReport.Rows[i]["totalAmount"].ToString() != null)
                 {
                     decTotal = decTotal + Convert.ToDecimal(dtblSalesOrderReport.Rows[i]["totalAmount"].ToString());
                 }
             }
             decTotal            = Math.Round(decTotal, 2);
             txtTotalAmount.Text = decTotal.ToString();
         }
         else
         {
             txtTotalAmount.Text = "0.00";
         }
         dgvSalesOrderReport.DataSource = dtblSalesOrderReport;
         if (dgvSalesOrderReport.Columns.Count > 0)
         {
             dgvSalesOrderReport.Columns["dgvtxtTotalAmount"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "SORP9:" + ex.Message;
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         SalesOrderMasterSP spSalesOrderMaster = new SalesOrderMasterSP();
         if (txtVoucherNo.Text.Trim() == string.Empty)
         {
             strInvoiceNo = "-1";
         }
         else
         {
             strInvoiceNo = txtVoucherNo.Text;
         }
         if (cmbCashOrParty.SelectedIndex == 0 || cmbCashOrParty.SelectedIndex == -1)
         {
             decLedgerId = -1;
         }
         else
         {
             decLedgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString());
         }
         if (cmbVoucherType.SelectedIndex == 0 || cmbVoucherType.SelectedIndex == -1)
         {
             decVoucherTypeId = -1;
         }
         else
         {
             decVoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString());
         }
         if (cmbSalesMan.SelectedIndex == 0 || cmbSalesMan.SelectedIndex == -1)
         {
             decEmployeeId = -1;
         }
         else
         {
             decEmployeeId = Convert.ToDecimal(cmbSalesMan.SelectedValue.ToString());
         }
         if (txtProductCode.Text.Trim() == string.Empty)
         {
             strProductCode = string.Empty;
         }
         else
         {
             strProductCode = txtProductCode.Text;
         }
         if (cmbArea.SelectedIndex == 0 || cmbArea.SelectedIndex == -1)
         {
             decAreaId = -1;
         }
         else
         {
             decAreaId = Convert.ToDecimal(cmbArea.SelectedValue.ToString());
         }
         if (cmbRoute.SelectedIndex == 0 || cmbRoute.SelectedIndex == -1)
         {
             decRouteId = -1;
         }
         else
         {
             decRouteId = Convert.ToDecimal(cmbRoute.SelectedValue.ToString());
         }
         if (cmbProductGroup.SelectedIndex == 0 || cmbProductGroup.SelectedIndex == -1)
         {
             decGroupId = -1;
         }
         else
         {
             decGroupId = Convert.ToDecimal(cmbProductGroup.SelectedValue.ToString());
         }
         if (cmbQuotationNo.SelectedIndex == 0)
         {
             strSalesQuotationNo = "-1";
         }
         else
         {
             strSalesQuotationNo = cmbQuotationNo.SelectedValue.ToString();
         }
         if (cmbStatus.SelectedIndex == 0 || cmbStatus.SelectedIndex == -1)
         {
             strStatus = "All";
         }
         else
         {
             strStatus = cmbStatus.SelectedItem.ToString();
         }
         DateTime FromDate = this.dtpFromDate.Value;
         DateTime ToDate = this.dtpToDate.Value;
         dtblSalesOrderReport = spSalesOrderMaster.SalesOrderReportViewAll(strInvoiceNo, decLedgerId, strProductCode, decVoucherTypeId, FromDate, ToDate, strStatus, decEmployeeId, strSalesQuotationNo, decAreaId, decGroupId, decRouteId);
         if (dtblSalesOrderReport.Rows.Count > 0)
         {
             decimal decTotal = 0;
             for (int i = 0; i < dtblSalesOrderReport.Rows.Count; i++)
             {
                 if (dtblSalesOrderReport.Rows[i]["totalAmount"].ToString() != null)
                 {
                     decTotal = decTotal + Convert.ToDecimal(dtblSalesOrderReport.Rows[i]["totalAmount"].ToString());
                 }
             }
             decTotal = Math.Round(decTotal, 2);
             txtTotalAmount.Text = decTotal.ToString();
         }
         else
         {
             txtTotalAmount.Text = "0.00";
         }
         dgvSalesOrderReport.DataSource = dtblSalesOrderReport;
         if (dgvSalesOrderReport.Columns.Count > 0)
         {
             dgvSalesOrderReport.Columns["dgvtxtTotalAmount"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SORP9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }