Exemplo n.º 1
0
        private void bttn_Purchase_Click(object sender, EventArgs e)
        {
            int    p                   = 0;
            int    BarcodeCount        = Convert.ToInt32(dtsett.BarcodeCount);
            string TransactionLedgerID = null;


            if (checkData())
            {
                //if (!_objCustmor.SupplierDetail(cmb_Name.Text))
                try
                {
                    if (supplierexs == "No")
                    {
                        _purchase.InsertSupplierInfo(lbl_AccNo1.Text, cmb_Name.Text, cmb_State.Text, txt_Address.Text, txt_City.Text, txt_ContactNo.Text, txt_PAN.Text, txt_GSTIN.Text, dtp_Date.Value.ToString("dd/MM/yyyy"));
                    }
                }
                catch (Exception ex)
                {
                    _error.AddException(ex, "Purchase");
                }

                try
                {
                    for (int i = 0; i < dgv_ItemInfo.Rows.Count; i++)
                    {
                        if (_objCustmor.GetalooseItem(Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Category"].Value)))
                        {
                            string category    = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Category"].Value);
                            string subcategory = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SubCategory"].Value);
                            string HSN         = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["HSN"].Value);
                            string size        = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Size"].Value);
                            string purchaseamt = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["PurchaseAmt"].Value);
                            string Qty         = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Qty"].Value);
                            string TotalAmt    = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["TotalAmt"].Value);
                            string BatchNo     = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["BatchNo"].Value);
                            string SellingAmt  = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SellingAmt"].Value);
                            string CGSTper     = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["CGSTper"].Value);
                            string CGST        = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["CGST"].Value);
                            string SGSTper     = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SGSTper"].Value);
                            string SGST        = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SGST"].Value);
                            string IGSTper     = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["IGSTper"].Value);
                            string IGST        = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["IGST"].Value);
                            string PBillNo     = txt_BillNo.Text;

                            _purchase.InsertItem("", category, subcategory, size, PBillNo, "Purchase", Qty, CGSTper, CGST, SGSTper, SGST, IGSTper, IGST, purchaseamt, TotalAmt, BatchNo, SellingAmt, HSN, dtp_Date.Value.ToString("dd/MM/yyyy"), null, txt_PurchaseRef.Text);
                        }

                        else if (!_objCustmor.GetalooseItem(Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Category"].Value)))
                        {
                            string barcode;
                            if (dgv_ItemInfo.Rows[i].Cells["Barcode"].Value == "" || dgv_ItemInfo.Rows[i].Cells["Barcode"].Value == string.Empty)
                            {
                                barcode = _objSQLHelper.GetMaxID("B", "0");
                            }
                            else
                            {
                                barcode = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Barcode"].Value);
                            }

                            string subcategory  = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SubCategory"].Value);
                            string category     = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Category"].Value);
                            string size         = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Size"].Value);
                            string HSN          = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["HSN"].Value);
                            string purchaseamt  = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["PurchaseAmt"].Value);
                            string qty          = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Qty"].Value);
                            string TotalAmt     = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["TotalAmt"].Value);
                            string BatchNo      = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["BatchNo"].Value);
                            string SellingAmt   = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SellingAmt"].Value);
                            string CGSTper      = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["CGSTper"].Value);
                            string CGST         = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["CGST"].Value);
                            string SGSTper      = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SGSTper"].Value);
                            string SGST         = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SGST"].Value);
                            string IGSTper      = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["IGSTper"].Value);
                            string IGST         = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["IGST"].Value);
                            string BarcodePrint = dgv_ItemInfo.Rows[i].Cells["Chk"].Value.ToString();
                            string PBillNo      = txt_BillNo.Text;
                            _purchase.InsertItem(barcode, category, subcategory, size, PBillNo, "Purchase", qty, CGSTper, CGST, SGSTper, SGST, IGSTper, IGST, purchaseamt, TotalAmt, BatchNo, SellingAmt, HSN, dtp_Date.Value.ToString("dd/MM/yyyy"), BarcodePrint, txt_PurchaseRef.Text);
                        }
                    }
                }

                catch (Exception ex)
                {
                    _error.AddException(ex, "Purchase/InsetItem");
                }
                try
                {
                    if (dtsett.Barcode == "Yes")
                    {
                        //insert Into Temp Table
                        _Common.InsertIntoTemp(txt_PurchaseRef.Text);

                        if (dtsett.BarcodeType == "Thermal")
                        {
                            _Barcode.PrintBarcode(Convert.ToInt32(dtsett.BarcodeCount));
                        }
                        else if (dtsett.BarcodeType == "Laser")
                        {
                            _Barcode.PrintBarcodeA4(p = 0, Convert.ToInt32(dtsett.BarcodeCount));
                        }
                    }

                    _Common.DeleteTemp();
                }
                catch (Exception ex)
                {
                    _error.AddException(ex, "Purchase/PrintBarcode");
                }


                try
                {
                    _objCustmor.InsertBillDetail(lbl_AccNo1.Text, txt_BillNo.Text, dtp_Date.Value.ToString("dd/MM/yyyy"), txt_TotalAmt.Text, txt_CGSTValue.Text, txt_SGSTValue.Text, txt_IGSTValue.Text, txt_NetAmt.Text, cmb_State.Text, Type, txt_PurchaseRef.Text);
                    if (txt_PaidAmt.Text != "0" || txt_PaidAmt.Text != "" || txt_PaidAmt.Text != string.Empty)
                    {
                        _objCustmor.InsertPaymentDetails("Supplier", txt_PaidAmt.Text, cmb_PayMode.Text, lbl_AccNo1.Text, dtp_Date.Value.ToString("dd/MM/yyyy"), txt_BillNo.Text);
                    }
                }
                catch (Exception ex)
                {
                    _error.AddException(ex, "Purchse");
                }

                try
                {
                    CustomerLedgerID = _purchase.insertAcountLedgerDetailPurchase(Vouchertypeid: VouchertypeID, SupplierName: cmb_Name.Text, AccNo: lbl_AccNo1.Text, Date: dtp_Date.Text, narration: "");
                    string VouchertypeIDPayment = _Common.getALLTableDetails(sTableName: TableNames.VoucherType, sColomnName: "VoucherTypeName", sColumnValue: "Purchase Receipt Voucher").Rows[0]["VoucherTypeID"].ToString();
                    bool   Payformstatus        = true;
                    if (Convert.ToDouble(txt_PaidAmt.Text) == 0)
                    {
                        DialogResult dr1 = MessageBox.Show("Save with Zero Amount :" + txt_PaidAmt.Text + "\n\n Do You Want To Continue", "JMS Says ", MessageBoxButtons.YesNo);
                        if (dr1 == DialogResult.No)
                        {
                            Payformstatus = false;
                        }
                    }
                    else if (Convert.ToDouble(txt_PaidAmt.Text) > 0)
                    {
                        DialogResult dr = MessageBox.Show("Amount to be Payed : " + txt_PaidAmt.Text + "\n\n Do You Want To Continue", "JMS Says ", MessageBoxButtons.YesNo);
                        if (dr == DialogResult.Yes)
                        {
                            if (dtsett.PaymentForm == "1")
                            {
                                PaymentOption.frm_PaymentOptionForPaymentVoucher form = new PaymentOption.frm_PaymentOptionForPaymentVoucher(txt_PaidAmt.Text, txt_BillNo.Text, lbl_AccNo1.Text, dtp_Date.Text, CustomerType.SupplierPurchaseGST, OperationType.Create);
                                form.ShowDialog();
                                PaymentIDs          = form.PaymentIDs;
                                Payformstatus       = true;
                                TransactionLedgerID = form.TransactionLedgerID;
                                if (form.ReturnStatus == false)
                                {
                                    Payformstatus = false;
                                }
                            }
                            else if (dtsett.PaymentForm == "0")
                            {
                                Payformstatus = true;
                            }
                        }
                        else if (dr == DialogResult.No)
                        {
                            Payformstatus = false;
                        }
                    }
                    _purchase.InsertCreditDebitInPurchaseAccount(customerLedgerID: CustomerLedgerID, VouchertypeID: VouchertypeID, sbillno: txt_BillNo.Text, CurrentAmount: txt_PaidAmt.Text, date: dtp_Date.Text, Date: dtp_Date.Text, SupplierName: cmb_Name.Text, Narration: "");
                }
                catch (Exception ex)
                {
                    _error.AddException(ex, "Purchse");
                }
                try
                {
                    Report.CrystalReport.frm_ReportViewer _objfrm_ReportViewer = new Report.CrystalReport.frm_ReportViewer();
                    SendData _obj = new SendData(_objfrm_ReportViewer.SupplierBill);
                    _obj(txt_PurchaseRef.Text, "Print");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    _error.AddException(ex, "Purchacse/BillPrint");
                }
                Masterclear();
                MessageBox.Show("Purchased Done");
                cmb_Name.Select();
            }
        }
Exemplo n.º 2
0
        private void bttn_Sale_Click(object sender, EventArgs e)
        {
            string BillNo = txt_BillNo.Text;

            if (BillType == "Update")
            {
                _Sale.DeleteBillDetails(BillNo, "Sale");
                _Sale.DeleteBillItem(BillNo, "Sale");
            }

            MessageBox.Show("Do you Want to Continue With Bill Amount of ₹ " + txt_NetAmt.Text.ToString());

            if (BillType == "New")
            {
                if (cmb_Name.Text != "" || txt_ContactNo.Text != "")
                {
                    if (Customerexs == "No")
                    {
                        _Cust.AddCustomerDetails(txt_AccNo.Text, cmb_Name.Text, txt_Address.Text, txt_ContactNo.Text, txt_PanNo.Text, txt_GSTIN.Text, cmb_State.Text, txt_City.Text, "0");
                    }
                }
            }

            try
            {
                for (int i = 0; i < dgv_ItemInfo.Rows.Count; i++)
                {
                    string barcode     = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["BarcodeNo"].Value);
                    string category    = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Category"].Value);
                    string subcategory = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SubCategory"].Value);
                    string HSN         = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["HSN"].Value);
                    string BatchNo     = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["BatchNo"].Value);
                    string Qty         = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Qty"].Value);
                    string price       = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Rate"].Value);
                    string TotalAmount = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["TotalAmt"].Value);
                    string TotalPrice  = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["TotalPrice"].Value);
                    string SalesPerson = Convert.ToString(cmb_SalesPerson.SelectedIndex + 1);
                    string Maintain    = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Maintain"].Value);
                    string size        = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Size"].Value);
                    string PBillNo     = txt_BillNo.Text;

                    _Sale.AddItemDetails(category, subcategory, size, txt_BillNo.Text, "Sale", dtp_Date.Value.ToString("dd/MM/yyyy"), price, Qty, "0", "0", "0", "0", "0", "0", TotalAmount, BatchNo, HSN, TotalPrice, SalesPerson, Maintain, "0", "0", "0", "0", "0");
                }
            }

            catch (Exception ex)
            {
                _error.AddException(ex, "Sale/Item");
            }
            try
            {
                _Sale.AddBillDetails(txt_BillNo.Text, txt_AccNo.Text, dtp_Date.Value.ToString("dd/MM/yyyy"), DateTime.Now.ToString("HH:mm:ss"), txt_TotalAmt.Text, "0", "0", "0", txt_NetAmt.Text, cmb_State.Text, txt_BillAmt.Text, txt_Discount.Text, "Estimate", txt_Extra.Text, txt_Narration.Text, "0");


                //payment
                if (txt_PaidAmt.Text != null || txt_PaidAmt.Text != "")
                {
                    int paid = Convert.ToInt32(txt_PaidAmt.Text);

                    if (paid != 0)
                    {
                        _a.InsertPaymentDetails("Sale", txt_PaidAmt.Text, cmb_PayMode.Text, txt_AccNo.Text, dtp_Date.Value.ToString("dd/MM/yyyy"), txt_BillNo.Text);
                    }
                }
            }
            catch (Exception ex)
            {
                _error.AddException(ex, "Sale/BillDetails");
            }
            try
            {
                Report.CrystalReport.frm_ReportViewer _objfrm_ReportViewer = new Report.CrystalReport.frm_ReportViewer();
                SendData _obj = new SendData(_objfrm_ReportViewer.CustomerBillEst);
                _obj(txt_BillNo.Text, "Print");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                _error.AddException(ex, "Sale/Print");
            }
            //_Sale.PrintBillThermal(BillNo);

            MessageBox.Show("Sale Successfully Done");
            Masterclear();
            Clear();
            if (bttn_Sale.Text == "Update")
            {
                this.Close();
            }
        }
Exemplo n.º 3
0
        private void bttn_Sale_Click(object sender, EventArgs e)
        {
            string BillNo = txt_BillNo.Text;

            MessageBox.Show("Do you Want to Continue With Qoutation Amount of ₹ " + txt_NetAmt.Text.ToString());

            if (cmb_Name.Text != "" || txt_ContactNo.Text != "")
            {
                if (Customerexs == "No")
                {
                    _Cust.AddCustomerDetails(txt_AccNo.Text, cmb_Name.Text, txt_Address.Text, txt_ContactNo.Text, txt_PanNo.Text, txt_GSTIN.Text, cmb_State.Text, txt_City.Text, "");
                }
            }
            try
            {
                for (int i = 0; i < dgv_ItemInfo.Rows.Count; i++)
                {
                    string barcode     = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["BarcodeNo"].Value);
                    string category    = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Category"].Value);
                    string subcategory = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SubCategory"].Value);
                    string HSN         = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["HSN"].Value);
                    string BatchNo     = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["BatchNo"].Value);
                    string Qty         = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Qty"].Value);
                    string price       = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Rate"].Value);
                    string CGSTper     = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["CGSTper"].Value);
                    string CGST        = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["CGST"].Value);
                    string SGSTper     = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SGSTper"].Value);
                    string SGST        = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SGST"].Value);
                    string IGSTper     = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["IGSTper"].Value);
                    string IGST        = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["IGST"].Value);
                    string TotalAmount = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["TotalAmt"].Value);
                    string TotalPrice  = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["TotalPrice"].Value);
                    string SalesPerson = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Sales"].Value);
                    string Maintain    = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Maintain"].Value);
                    string size        = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Size"].Value);
                    string PBillNo     = txt_BillNo.Text;

                    _Sale.AddItemDetails(category, subcategory, size, txt_BillNo.Text, "Qoutation", dtp_Date.Value.ToString("dd/MM/yyyy"), price, Qty, CGSTper, CGST, SGSTper, SGST, IGSTper, IGST, TotalAmount, BatchNo, HSN, TotalPrice, SalesPerson, Maintain, "0", "0", "0", "0", "0");
                }
            }

            catch (Exception ex)
            {
                _error.AddException(ex, "Sale/Item");
            }
            try
            {
                _Sale.AddBillDetails(txt_BillNo.Text, txt_AccNo.Text, dtp_Date.Value.ToString("dd/MM/yyyy"), DateTime.Now.ToString("HH:mm:ss"), txt_TotalAmt.Text, lbl_CGSTValue.Text, lbl_SGSTValue.Text, lbl_IGSTValue.Text, txt_NetAmt.Text, cmb_State.Text, txt_BillAmt.Text, txt_Discount.Text, "Qoutation", txt_Extra.Text, txt_Narration.Text, "0");
            }
            catch (Exception ex)
            {
                _error.AddException(ex, "Sale/BillDetails");
            }
            try
            {
                Report.CrystalReport.frm_ReportViewer _objfrm_ReportViewer = new Report.CrystalReport.frm_ReportViewer();
                SendData _obj = new SendData(_objfrm_ReportViewer.Qoutation);
                _obj(txt_BillNo.Text, "Print");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                _error.AddException(ex, "Sale/Print");
            }

            MessageBox.Show("Qoutation Successfully Done");
            Masterclear();
            Clear();
            this.BringToFront();
        }