private void GetCurrentBalance()
        {
            Generate frmGenerate = new Generate();
            DateTime dtDate = DateTime.Now;

            foreach (DataRow dtRow in dsCustomersOverLimit.Tables[0].Rows)
            {
                double d = Convert.ToDouble(dtRow["CurrentBalance"].ToString());
                frmGenerate.CalculateCurrentOutstandingBalance(dtRow["CustomerCode"].ToString(), "", "CalculateCustomer", dtDate);
                decimal deCurrentBalanceValue = Convert.ToDecimal(d);
                if (frmGenerate.deGrandTotal > Convert.ToDecimal(dtRow["CreditLimit"].ToString()))
                {
                    int n = dgFlagCustomers.Rows.Add();
                    dgFlagCustomers.Rows[n].Cells["clCustomerCode"].Value = dtRow["CustomerCode"].ToString();
                    dgFlagCustomers.Rows[n].Cells["clCustomerDesc"].Value = dtRow["CustomerDesc"].ToString();
                    dgFlagCustomers.Rows[n].Cells["clPastelBalance"].Value = dtRow["CurrentBalance"].ToString();
                    dgFlagCustomers.Rows[n].Cells["clCreditLimit"].Value = dtRow["CreditLimit"].ToString();
                    dgFlagCustomers.Rows[n].Cells["clTotalBalance"].Value = frmGenerate.deGrandTotal.ToString("N2");
                }
            }
        }
Exemplo n.º 2
0
        private void GetCustomerBalance()
        {
            Generate frmGenerate = new Generate();
            //get end of month date
            DateTime dtDate = new DateTime(DateTime.Now.Year,DateTime.Now.Month,1);
            dtDate = dtDate.AddMonths(1).AddDays(-1);
            decimal dOpenSalesOrderAmount = 0;
            decimal dTotalInvoiceAmount = 0;
            decimal dInvoiceAmount = 0;

            foreach (DataRow dtRow in dsEstimatedTurnover.Tables[0].Rows)
            {
                decimal dTotalBalance = 0;
                frmGenerate.CalculateCurrentOutstandingBalance(dtRow["CustomerCode"].ToString().Trim(), "", "CalculateCustomer", dtDate);
                dOpenSalesOrderAmount = dOpenSalesOrderAmount + frmGenerate.deGrandTotal;
                //dInvoiceAmount = CalculateInvoiceBalance(dtRow["CustomerCode"].ToString().Trim());
                //dTotalInvoiceAmount = dTotalInvoiceAmount + dInvoiceAmount;
                dTotalBalance = frmGenerate.deGrandTotal + dInvoiceAmount;
                dtRow["Balance"] = dTotalBalance.ToString("N2");
                StepProgressBar();
            }
            dTotalInvoiceAmount = CalculateInvoiceBalance();
            //txtOpenSalesOrderValue.Text = dOpenSalesOrderAmount.ToString("N2");
            //txtTotalInvoiceValue.Text = dTotalInvoiceAmount.ToString("N2");
            //txtTotalTurnover.Text = (dTotalInvoiceAmount + dOpenSalesOrderAmount).ToString("N2");
            GenerateReport(dOpenSalesOrderAmount, dTotalInvoiceAmount);
            CompleteProcess();
        }
Exemplo n.º 3
0
 private void cmdForecast_Click(object sender, EventArgs e)
 {
     Generate frmGenerate = new Generate();
     //frmGenerate.CalculateCurrentOutstandingBalance("", "00002762", "CalculateDocument");
     frmGenerate.CalculateCurrentOutstandingBalance("DUP006", "", "CalculateCustomer",DateTime.Now);
     //lblForecastValue.Text = frmGenerate.deGrandTotal.ToString("N2");
 }
Exemplo n.º 4
0
        private void DoForecast(DateTime dtForecastUpto)
        {
            if (txtCustomerCode.Text != "")
            {
                Cursor = System.Windows.Forms.Cursors.WaitCursor;

                Generate frmGenerate = new Generate();

                decimal deCurrentBalanceValue = Convert.ToDecimal(lblCurrentBalanceValue.Text.Replace("R", ""));
                frmGenerate.CalculateCurrentOutstandingBalance(txtCustomerCode.Text.Trim(), "", "CalculateCustomer", dtForecastUpto);
                lblForecast.Text = "R" + (frmGenerate.deGrandTotal + deCurrentBalanceValue).ToString("N2");
                lblInfoForecastBalance.Text = "R" + (frmGenerate.deGrandTotal + deCurrentBalanceValue).ToString("N2");
                lblInfoForecast.Text = "R" + frmGenerate.deGrandTotal.ToString("N2");

                Cursor = System.Windows.Forms.Cursors.Default;
                //Block Customer Message on forecast
                //if (Convert.ToDecimal(lblCreditLimitValue.Text.Replace("R", "")) < (frmGenerate.deGrandTotal + deCurrentBalanceValue))
                //{
                //    if (MessageBox.Show("On forecast, customer " + txtCustomerCode.Text.Trim() + " is over his credit limit. Do you want to block this customer?", "Customer Over Credit Limit on Forecast", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                //    {
                //        blockCustomer(txtCustomerCode.Text.Trim());
                //    }

                //}
            }
        }