Esempio n. 1
0
        private void btnInsert_Click(object sender, EventArgs e)
        {
            decimal paymentDue = 0;

            if (decimal.TryParse(tbPaymentDue.Text, out paymentDue))
            {
                if (calDueDate.Value != null)
                {
                    if (ddlPO.SelectedValue != null)
                    {
                        if (BLSupplierInvoice.insertSupplierInvoice(APCContext, tbSupplierOriInvoiceNo.Text, paymentDue, calDueDate.Value, BLPO.GetPOById(APCContext, int.Parse(ddlPO.SelectedValue.ToString()))))
                        {
                            MessageBox.Show("SupplierInvoice Successfully Added");
                        }
                        else
                        {
                            MessageBox.Show("Please check your input");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please select the associated PO Number");
                    }
                }
                else
                {
                    MessageBox.Show("Please specify Due Date");
                }
            }
            else
            {
                MessageBox.Show("Please specify correct amount of Payment Due");
            }
        }
Esempio n. 2
0
        public List <SupplierInvoice> searchById(int id)
        {
            if (id != 0)
            {
                List <SupplierInvoice> supplierInvoiceList = BLSupplierInvoice.GetSupplierInvoiceListById(APCContext, id);

                if (supplierInvoiceList != null)
                {
                    tbId.Text = supplierInvoiceList[0].Id.ToString();
                    tbSupplierOriInvoiceNo.Text = supplierInvoiceList[0].SupplierOriNo;
                    tbPaymentDue.Text           = supplierInvoiceList[0].PaymentDue.ToString();
                    calDueDate.Value            = DateTime.Parse(supplierInvoiceList[0].DueDate.ToString());
                    ddlPO.SelectedValue         = int.Parse(supplierInvoiceList[0].PO.Id.ToString());
                    return(supplierInvoiceList);
                }
                else
                {
                    MessageBox.Show("SupplierInvoice Id not found");
                }
            }
            else
            {
                MessageBox.Show("SupplierInvoice Id not found");
            }
            return(null);
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            DateTime startDate = calStartDueDate.Value;
            DateTime endDate   = calEndDueDate.Value;
            List <SupplierInvoice> supplierInvoiceList = BLSupplierInvoice.GetSupplierInvoiceByDate(APCContext, startDate, endDate, cbPaid.Checked);

            dgPaymentToSupplier.DataSource = convertListToDataTable(supplierInvoiceList);
        }
Esempio n. 4
0
 private void btnSearchBySupplierOriInvoiceNo_Click(object sender, EventArgs e)
 {
     if (tbSearchSupplierOriNo.Text.Trim() != "")
     {
         List <SupplierInvoice> supplierInvoiceList = BLSupplierInvoice.GetSupplierInvoiceBySupplierOriNo(APCContext, tbSearchSupplierOriNo.Text);
         dgSupplierInvoice.DataSource = convertListToDataTable(supplierInvoiceList);
     }
     else
     {
         MessageBox.Show("SupplierInvoice Name not found");
     }
 }
Esempio n. 5
0
        private decimal calculateBalance(bool invoiced, bool paid, bool all)
        {
            decimal   total = 0;
            DataTable dt    = BLSupplierInvoice.GetSUMSupplierInvoiceDueDatePOInvoicedAndPaid(DateTime.Today.AddDays(14), invoiced, paid, all);

            if (dt.Rows.Count > 0)
            {
                if (decimal.TryParse(dt.Rows[0][0].ToString(), out total))
                {
                    return(total);
                }
            }
            return(0);
        }
Esempio n. 6
0
        private void PaymentToSupplierForm_Load(object sender, EventArgs e)
        {
            lblTodaysDate.Text            = DateTime.Today.ToShortDateString();
            lblPurchaseNotInvoiced.Text   = calculateBalance(false, false, false).ToString();
            lblArconInvoiceNotPaid.Text   = calculateBalance(true, false, false).ToString();
            lblPaymentDueForSupplier.Text = calculateBalance(false, false, true).ToString();
            APCContext         = new APCEntities();
            cbPaid.Enabled     = false;
            cbInvoiced.Enabled = false;
            cbALL.Checked      = true;
            DataTable dt = BLSupplierInvoice.GetSupplierInvoiceDueDatePOInvoicedAndPaid(DateTime.Today.AddDays(14), cbInvoiced.Checked, cbPaid.Checked, cbALL.Checked);

            dgReminderSupplierPayment.DataSource = dt;
        }
 public void setId(int SupplierInvoiceId, APCEntities APCContext1)
 {
     APCContext = APCContext1;
     DataTable dtSupplierInvoice = BLSupplierInvoice.GetSupplierInvoiceById(SupplierInvoiceId);
     if (dtSupplierInvoice.Rows.Count > 0)
     {
         DataRow supplierInvoiceRow = dtSupplierInvoice.Rows[0];
         int supplierInvoiceId = int.Parse(supplierInvoiceRow["Id"].ToString());
         tbSupplierInvoiceId.Text = supplierInvoiceRow["Id"].ToString();
         tbSupplierInvoiceOriginalNo.Text = supplierInvoiceRow["SupplierOriNo"].ToString();
         tbPONo.Text = supplierInvoiceRow["POId"].ToString();
         tbPaymentDue.Text = ((decimal.Parse(supplierInvoiceRow["PaymentDue"].ToString())) - TotalPaid(supplierInvoiceId)).ToString("N");
     }
 }
Esempio n. 8
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            int id = 0;

            int.TryParse(tbId.Text, out id);
            if (id != 0)
            {
                SupplierInvoice currentSupplierInvoice = BLSupplierInvoice.GetSupplierInvoiceById(APCContext, id);
                if (currentSupplierInvoice != null)
                {
                    decimal paymentDue = 0;
                    if (decimal.TryParse(tbPaymentDue.Text, out paymentDue))
                    {
                        if (calDueDate.Value != null)
                        {
                            if (ddlPO.SelectedValue != null)
                            {
                                currentSupplierInvoice.SupplierOriNo = tbSupplierOriInvoiceNo.Text;
                                currentSupplierInvoice.PaymentDue    = paymentDue;
                                currentSupplierInvoice.DueDate       = calDueDate.Value;
                                currentSupplierInvoice.PO            = BLPO.GetPOById(APCContext, int.Parse(ddlPO.SelectedValue.ToString()));
                                APCContext.SaveChanges();
                                MessageBox.Show("SupplierInvoice Details Successfully Updated");
                            }
                            else
                            {
                                MessageBox.Show("Please select the associated PO Number");
                            }
                        }
                        else
                        {
                            MessageBox.Show("Please specify a correct due date");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please specify correct amount of Payment Due");
                    }
                }
                else
                {
                    MessageBox.Show("SupplierInvoice Id not found");
                }
            }
            else
            {
                MessageBox.Show("SupplierInvoice Id not found");
            }
        }
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     SupplierInvoice supplierInvoice = BLSupplierInvoice.GetSupplierInvoiceListById(APCContext,int.Parse(tbSupplierInvoiceId.Text)).First();
     BLPaymentToSupplier.insertPaymentToSupplier(APCContext, supplierInvoice, decimal.Parse(tbPaymentAmount.Text), calPaidDate.Value);
     
     //check if payment has been made full - if yes then can mark as paid.
     if (supplierInvoice.PaymentDue <= TotalPaid(supplierInvoice.Id))
     {
         supplierInvoice.Paid = true;
         supplierInvoice.PaidDate = DateTime.Now;
         APCContext.SaveChanges();
     }
     
     MessageBox.Show("Payment has been recorded");
 }
Esempio n. 10
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            int id = 0;

            int.TryParse(tbId.Text, out id);
            if (id != 0)
            {
                SupplierInvoice currentSupplierInvoice = BLSupplierInvoice.GetSupplierInvoiceById(APCContext, id);
                if (currentSupplierInvoice != null)
                {
                    APCContext.DeleteObject(currentSupplierInvoice);
                    APCContext.SaveChanges();
                    MessageBox.Show("Delete Successfully");
                }
                else
                {
                    MessageBox.Show("SupplierInvoice Id not found");
                }
            }
            else
            {
                MessageBox.Show("SupplierInvoice Id not found");
            }
        }
Esempio n. 11
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            DataTable dt = BLSupplierInvoice.GetSupplierInvoiceDueDatePOInvoicedAndPaid(DateTime.Today.AddDays(14), cbInvoiced.Checked, cbPaid.Checked, cbALL.Checked);

            dgReminderSupplierPayment.DataSource = dt;
        }