Example #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (dxValidationProvider1.Validate())
            {
                sc = new Server2Client();
                SupplierAccount ss = new SupplierAccount();

                string Remarks = txtRMKS.Text == "" ? "Debit Payment" : txtRMKS.Text;
                ss.SupplierID  = Convert.ToInt32(lueSNM.EditValue);
                ss.TransDate   = txtPDT.DateTime;
                ss.Description = Remarks;
                ss.Debit       = 0;
                ss.Credit      = Convert.ToDouble(txtAMNT.Text);
                ss.Balance     = Convert.ToDouble(txtNBAL.Text);

                sa = new SupplierAccounts();
                sc = sa.addTrans(ss);

                if (sc.Message == null)
                {
                    XtraMessageBox.Show("Payment done successfully!");
                    lueSNM.EditValue = null;
                    txtCBAL.Text     = "0";
                    txtAMNT.Text     = "0";
                    txtNBAL.Text     = "0";
                    txtRMKS.Text     = "";
                }
                else
                {
                    XtraMessageBox.Show(sc.Message);
                }
            }
        }
Example #2
0
        private void lueSUP_EditValueChanged(object sender, EventArgs e)
        {
            int              id  = lueSUP.EditValue == null ? 0 : Convert.ToInt32(lueSUP.EditValue);
            Server2Client    sc  = new Server2Client();
            SupplierAccounts sa  = new SupplierAccounts();
            Suppliers        sup = new Suppliers();

            //c = cus.getCustomer(id);
            sc = sa.getSupplierBalance(id);
            SupplierBalance = sc.Value;
        }
Example #3
0
        private void lueSNM_EditValueChanged(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(lueSNM.EditValue);

            sc = new Server2Client();
            sa = new SupplierAccounts();
            sc = sa.getSupplierBalance(id);

            if (sc.Message != null)
            {
                txtCBAL.Text    = sc.Message;
                txtCBAL.Enabled = false;
            }
            else
            {
                txtCBAL.Text = sc.Value.ToString();
            }
        }
Example #4
0
        public frmDebitPayment(int SupplierID)
        {
            InitializeComponent();
            txtPDT.DateTime = DateTime.Now.Date;
            sc = new Server2Client();
            s  = new Suppliers();
            sa = new SupplierAccounts();
            sc = s.getSuppliers();

            lueSNM.Properties.DataSource    = sc.dataTable;
            lueSNM.Properties.DisplayMember = "SupplierName";
            lueSNM.Properties.ValueMember   = "ID";

            lueSNM.EditValue = SupplierID;
            sc = sa.getSupplierBalance(SupplierID);

            txtCBAL.Text = sc.Value.ToString();

            txtAMNT.Text = "0";
            txtNBAL.Text = "0";
        }
Example #5
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            Server2Client sc   = new Server2Client();
            Purchases     purc = new Purchases();
            Purchase      prc  = new Purchase();
            Products      prd  = new Products();

            prc.InvoiceNo    = txtINV.Text;
            prc.PurchaseDate = dtpPDT.DateTime;
            prc.SupplierID   = Convert.ToInt32(lueSUP.EditValue);
            prc.Amount       = Convert.ToDouble(txtAMT.EditValue);
            prc.Payment      = Convert.ToDouble(txtPAM.EditValue);
            prc.Balance      = Convert.ToDouble(txtBAL.EditValue);

            sc = purc.addPurchase(prc);
            if (sc.Message != null)
            {
                XtraMessageBox.Show(sc.Message);
                return;
            }

            SupplierAccounts sac = new SupplierAccounts();
            SupplierAccount  sa  = new SupplierAccount();
            Supplier         sup = new Supplier();

            sa.SupplierID  = Convert.ToInt32(lueSUP.EditValue);
            sa.TransDate   = dtpPDT.DateTime;
            sa.Description = "Invoice No " + txtINV.Text;
            sa.Debit       = Convert.ToDouble(txtAMT.EditValue);
            sa.Credit      = Convert.ToDouble(txtPAM.EditValue);
            sa.Balance     = SupplierBalance + Convert.ToDouble(txtBAL.Text);
            sc             = sac.addTrans(sa);
            if (sc.Message != null)
            {
                XtraMessageBox.Show(sc.Message);
                return;
            }

            Guid g;

            for (int i = 0; i <= grv.RowCount - 1; i++)
            {
                int    cid = Convert.ToInt32(grv.GetRowCellValue(i, colCID));
                string pnm = grv.GetRowCellValue(i, colPNM).ToString();
                double bvl = Convert.ToDouble(grv.GetRowCellValue(i, colBVL));
                double svl = Convert.ToDouble(grv.GetRowCellValue(i, colSVL));
                int    qty = Convert.ToInt32(grv.GetRowCellValue(i, colQTY));
                double amt = Convert.ToDouble(grv.GetRowCellValue(i, colAMT));
                string bcd = grv.GetRowCellValue(i, colBCD).ToString();

                PurchaseDetail pdt = new PurchaseDetail();
                pdt.InvoiceNo    = txtINV.Text;
                g                = Guid.NewGuid();
                pdt.ProductCode  = g.ToString();
                pdt.BuyingValue  = bvl;
                pdt.SellingValue = svl;
                pdt.Quantity     = qty;
                pdt.Amount       = amt;
                sc               = purc.addPurchaseDetails(pdt);
                if (sc.Message != null)
                {
                    XtraMessageBox.Show(sc.Message);
                    return;
                }

                Product p = new Product();
                p.CategoryID   = cid;
                p.SupplierID   = Convert.ToInt32(lueSUP.EditValue);
                p.ProductCode  = g.ToString();
                p.ProductName  = pnm;
                p.BuyingValue  = bvl;
                p.SellingValue = svl;
                p.SupplierID   = Convert.ToInt32(lueSUP.EditValue);
                p.Quantity     = qty;
                p.BarCode      = bcd;

                sc = prd.AddProduct(p);
                if (sc.Message != null)
                {
                    XtraMessageBox.Show(sc.Message);
                    return;
                }
            }

            XtraMessageBox.Show("Product(s) purchased successfully!");
            InitInvoice();
            dtpPDT.DateTime = DateTime.Now.Date;
            dt = new DataTable();
            InitDataTable();
            InitSuppliers();
            InitCategories();
            grd.DataSource = null;
        }
Example #6
0
        private void bDebitPayment_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //frmSelectSupplier frm = new frmSelectSupplier();
            //if (frm.ShowDialog() == DialogResult.OK)
            //{
            //    Server2Client sc = new Server2Client();
            //    SupplierAccounts sa = new SupplierAccounts();

            //    sc = sa.getTransactionDetails(frm.SupplierID);

            //    rptDebitPayment rpt = new rptDebitPayment() { DataSource = sc.dataTable };

            //    rpt.lbSNM.DataBindings.Add("Text", null, "SupplierName");
            //    rpt.lbADR.DataBindings.Add("Text", null, "Address");
            //    rpt.lbPHN.DataBindings.Add("Text", null, "Phone");
            //    rpt.lbEML.DataBindings.Add("Text", null, "Email");

            //    rpt.lbTDT.DataBindings.Add("Text", null, "TransDate", "{0:dd-MM-yyyy}");
            //    rpt.lbRMK.DataBindings.Add("Text", null, "Description");
            //    rpt.lbTDR.DataBindings.Add("Text", null, "Debit", "{0:c}");
            //    rpt.lbTCR.DataBindings.Add("Text", null, "Credit", "{0:c}");
            //    rpt.lbBAL.DataBindings.Add("Text", null, "Balance", "{0:c}");

            //    dv.PrintingSystem = rpt.PrintingSystem;
            //    rpt.CreateDocument(true);

            frmSelectSupplier frm = new frmSelectSupplier();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                Server2Client    sc  = new Server2Client();
                SupplierAccounts ca  = new SupplierAccounts();
                Suppliers        cc  = new Suppliers();
                Supplier         c   = new Supplier();
                double           bal = 0;
                c = cc.getSupplier(frm.SupplierID);
                rptDebitPayment rpt = new rptDebitPayment();

                XRSummary tdr = new XRSummary();
                XRSummary tcr = new XRSummary();

                rpt.lbSNM.Text = c.SupplierName;
                rpt.lbADR.Text = c.Address;
                rpt.lbPHN.Text = c.Phone;
                rpt.lbEML.Text = c.Email;

                if (!frm.DateSelected)
                {
                    sc             = ca.getSupplierBalance(frm.SupplierID);
                    bal            = sc.Value;
                    sc             = ca.getTransactionDetails(frm.SupplierID);
                    rpt.DataSource = sc.dataTable;
                }
                else
                {
                    sc             = ca.getSupplierBalance(frm.SupplierID, frm.DateFrom, frm.DateTo);
                    bal            = sc.Value;
                    sc             = ca.AccountStatement(frm.SupplierID, frm.DateFrom, frm.DateTo);
                    rpt.DataSource = sc.dataTable;
                }
                rpt.lbTDT.DataBindings.Add("Text", null, "TransDate", "{0:dd-MM-yyyy}");
                rpt.lbRMK.DataBindings.Add("Text", null, "Description");
                rpt.lbTDR.DataBindings.Add("Text", null, "Debit", "{0:c}");
                rpt.lbTCR.DataBindings.Add("Text", null, "Credit", "{0:c}");
                rpt.lbBAL.DataBindings.Add("Text", null, "Balance", "{0:c}");
                rpt.lblTDR.DataBindings.Add("Text", null, "Debit", "{0:C2}");
                rpt.lblTCR.DataBindings.Add("Text", null, "Credit", "{0:C2}");
                rpt.lblTBL.Text    = bal.ToString("c2");
                tdr.FormatString   = "{0:C2}";
                tcr.FormatString   = "{0:C2}";
                tdr.Running        = SummaryRunning.Report;
                tcr.Running        = SummaryRunning.Report;
                rpt.lblTCR.Summary = tdr;
                rpt.lblTDR.Summary = tcr;

                dv.PrintingSystem = rpt.PrintingSystem;
                rpt.CreateDocument(true);
            }
        }