Пример #1
0
        private void Save_Click(object sender, EventArgs e)
        {
            try
            {
                _a.InsertPaymentDetails("Customer", txt_Amount.Text, cmb_PaymentType.Text, lbl_id.Text, dtp_Date.Value.ToString("dd/MM/yyyy"), txt_ReceiptNo.Text);
                MessageBox.Show("Payment Saved");
            }
            catch (Exception ex)
            {
                _e.AddException(ex, "Customer Payment");
            }

            try
            {
                DialogResult dr = MessageBox.Show("Do You want to print Receipt", "", MessageBoxButtons.YesNo);
                if (dr == DialogResult.Yes)
                {
                    Report.CrystalReport.frm_ReportViewer _objfrm_ReportViewer = new Report.CrystalReport.frm_ReportViewer();
                    SendData _obj = new SendData(_objfrm_ReportViewer.PaymentReceipt);
                    _obj(txt_ReceiptNo.Text, "Customer");
                }
            }
            catch (Exception ex)
            {
                _e.AddException(ex, "Customer Payment/Print");
            }
            MessageBox.Show("Done");
            Clear();
        }
Пример #2
0
        private void bttn_Sale_Click(object sender, EventArgs e)
        {
            string BillNo = txt_BillNo.Text;

            MessageBox.Show("Do you Want to Continue With Bill Amount of ₹ " + txt_NetAmt.Text.ToString());
            if (cmb_Name.Text != "" || txt_ContactNo.Text != "")
            {
                if (!_Cust.checkCustomerAccount(cmb_Name.Text))
                {
                    txt_AccNo.Text = _objSQLHelper.gmGetMstID("C", "0");
                    _Cust.AddCustomerDetails(txt_AccNo.Text, cmb_Name.Text, txt_Address.Text, txt_MobileNo.Text, txt_ContactNo.Text);
                }
            }
            try
            {
                for (int i = 0; i < dgv_ItemInfo.Rows.Count; i++)
                {
                    string Category    = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["Category"].Value);
                    string SubCategory = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SubCategory"].Value);
                    string Amount      = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["SellingAmt"].Value);
                    //string narration = Convert.ToString(dgv_ItemInfo.Rows[i].Cells[" "].Value);
                    BillNo = Convert.ToString(txt_BillNo.Text);
                    string AccNo = Convert.ToString(txt_AccNo.Text);
                    string size  = Convert.ToString(dgv_ItemInfo.Rows[i].Cells["size"].Value);

                    if (dgv_ItemInfo.Rows[i].Cells["BarcodeNo"].Value == "" || dgv_ItemInfo.Rows[i].Cells["BarcodeNo"].Value == string.Empty)

                    {
                        _Sale.AddItemDetails(Category, SubCategory, Amount, size, " ", BillNo, AccNo, dtp_Date.Value.ToString("dd/MM/yyyy"), "Sale");
                    }

                    else
                    {
                        _Sale.UpdateItem(Convert.ToString(dgv_ItemInfo.Rows[i].Cells["BarcodeNo"].Value), txt_BillNo.Text);
                    }
                }
                _Sale.AddBillDetails(txt_BillNo.Text, txt_AccNo.Text, txt_TotalAmt.Text, txt_Vat.Text, txt_NetAmt.Text, " ", dtp_Date.Value.ToString("dd/MM/yyyy"));
            }
            catch (Exception ex)
            {
                _error.AddException(ex, "Sale");
            }

            _Sale.PrintBill(BillNo);
            MessageBox.Show("Sale Successfully Done");
            Masterclear();
            this.BringToFront();
        }
Пример #3
0
        private void bttn_Edit_Click(object sender, EventArgs e)
        {
            string BillNo = dgv_Bill.Rows[dgv_Bill.CurrentRow.Index].Cells["BillNo"].Value.ToString();
            string type   = dgv_Bill.Rows[dgv_Bill.CurrentRow.Index].Cells["Type"].Value.ToString();
            string SrNo   = dgv_Bill.Rows[dgv_Bill.CurrentRow.Index].Cells["SrNo"].Value.ToString();

            _sale.DeleteBillRecord(SrNo, BillNo);

            try
            {
                if (type == "GST")
                {
                    frm_SaleForm _form = new frm_SaleForm(BillNo, "Deleted");
                    _form.ShowDialog();
                }

                if (type == "Estimate")
                {
                    frm_SaleEstimate _form = new frm_SaleEstimate(BillNo, "Deleted");
                    _form.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                _error.AddException(ex, "ChangeBill");
                MessageBox.Show(ex.Message);
            }
        }
Пример #4
0
        private void Calculate()
        {
            double total   = 0;
            double CGSTAmt = 0;
            double SGSTAmt = 0;
            double IGSTAmt = 0;

            try
            {
                for (int i = 0; i < dgv_ItemInfo.Rows.Count; i++)
                {
                    total   += Math.Round(Convert.ToDouble(dgv_ItemInfo.Rows[i].Cells["TotalAmt"].Value), 2);
                    CGSTAmt += Math.Round(Convert.ToDouble(dgv_ItemInfo.Rows[i].Cells["CGST"].Value), 2);
                    SGSTAmt += Math.Round(Convert.ToDouble(dgv_ItemInfo.Rows[i].Cells["SGST"].Value), 2);
                    IGSTAmt += Math.Round(Convert.ToDouble(dgv_ItemInfo.Rows[i].Cells["IGST"].Value), 2);
                }

                txt_TotalAmt.Text  = total.ToString();
                lbl_CGSTValue.Text = CGSTAmt.ToString();
                lbl_SGSTValue.Text = SGSTAmt.ToString();
                lbl_IGSTValue.Text = IGSTAmt.ToString();

                txt_NetAmt.Text = txt_BillAmt.Text = Convert.ToString(_common.sumGridViewColumn(dgv_ItemInfo, "TotalPrice"));
            }
            catch (Exception ex)
            {
                _error.AddException(ex, "Purchase");
            }
        }
Пример #5
0
        private void Masterclear()
        {
            cmb_Name.ResetText();
            txt_Address.ResetText();
            txt_BillNo.ResetText();
            txt_City.ResetText();
            txt_ContactNo.ResetText();
            txt_MobileNo.ResetText();
            txt_PaidAmt.Text  = "0";
            txt_VatValue.Text = Convert.ToString(dtsett.Rows[0]["TaxPer"]);
            txt_Vat.ResetText();
            txt_Qty.Text         = "1";
            txt_SellingAmt.Text  = "0";
            txt_PurchaseAmt.Text = "0";
            txt_Vat.Text         = "0";
            txt_TotalAmt.Text    = "0";
            txt_BalAmt.Text      = "0";
            dgv_ItemInfo.Rows.Clear();
            txt_NetAmt.Text = "0";


            try
            {
                txt_AccNo.Text = _objSQLHelper.gmGetMstID("P", "0");
            }
            catch (Exception ex)
            {
                _error.AddException(ex, "Purchase");
            }
            chbk_barcode.Checked = true;
        }
Пример #6
0
 private void Save_Click(object sender, EventArgs e)
 {
     try
     {
         _a.InsertPaymentDetails("Supplier", txt_Amount.Text, cmb_PaymentType.Text, lbl_id.Text, dtp_Date.Value.ToString("dd/MM/yyyy"), txt_ReceiptNo.Text);
         MessageBox.Show("Payment Saved");
         Clear();
     }
     catch (Exception ex)
     {
         _e.AddException(ex, "Supplier Payment");
     }
 }
Пример #7
0
 private void bttn_Print_Click(object sender, EventArgs e)
 {
     try
     {
         Report.CrystalReport.frm_ReportViewer _objfrm_ReportViewer = new Report.CrystalReport.frm_ReportViewer();
         SendData _obj = new SendData(_objfrm_ReportViewer.GSTReport);
         _obj(GST, "Supplier", dtp_From.Value.ToString("dd/MM/yyyy"), dtp_to.Value.ToString("dd/MM/yyyy"));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         _error.AddException(ex, "Supplier GST Report");
     }
 }
Пример #8
0
 private void bttn_print_Click(object sender, EventArgs e)
 {
     try
     {
         Report.CrystalReport.frm_ReportViewer _objfrm_ReportViewer = new Report.CrystalReport.frm_ReportViewer();
         SendData _obj = new SendData(_objfrm_ReportViewer.MonthlyGST);
         _obj(Sale, Purchase, cmb_month.Text);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         _error.AddException(ex, "Supplier GST Report");
     }
 }
Пример #9
0
 private void bttn_yes_Click(object sender, EventArgs e)
 {
     try
     {
         string script = File.ReadAllText(Environment.CurrentDirectory + "/Scripts/" + "Delete Query.sql");
         _sql.ExecuteScalar(script);
         MessageBox.Show("Data Deleted Succesfully");
         this.Close();
     }
     catch (Exception ex)
     {
         _error.AddException(ex, "Delete Data");
         MessageBox.Show(ex.Message);
     }
 }
Пример #10
0
        private void GetReport()
        {
            int j = 0;

            try
            {
                DataTable Bill = _sale.GetCustomerReport(dtp_from.Value.ToString("dd/MM/yyyy"), dtp_to.Value.ToString("dd/MM/yyyy"), "GST");
                if (Bill.Rows.Count > 0)
                {
                    for (j = 0; j < Bill.Rows.Count; j++)
                    {
                        string HSNAll = _sale.GetAllHSNSale(Bill.Rows[j]["BillNo"].ToString());
                        if (Bill.Rows.Count != 0)
                        {
                            dgv_SupplierBill.Rows.Add();
                            dgv_SupplierBill.Rows[j].Cells["SrNo"].Value         = Convert.ToString(j + 1);
                            dgv_SupplierBill.Rows[j].Cells["BillNo"].Value       = Bill.Rows[j]["BillNo"].ToString();
                            dgv_SupplierBill.Rows[j].Cells["Date"].Value         = Bill.Rows[j]["Date"].ToString();
                            dgv_SupplierBill.Rows[j].Cells["SupplierName"].Value = Bill.Rows[j]["CustomerName"].ToString();
                            dgv_SupplierBill.Rows[j].Cells["GSTIN"].Value        = Bill.Rows[j]["GSTIN"].ToString();
                            dgv_SupplierBill.Rows[j].Cells["HSNCode"].Value      = HSNAll;
                            dgv_SupplierBill.Rows[j].Cells["BillAmt"].Value      = Bill.Rows[j]["Amount"].ToString();
                            dgv_SupplierBill.Rows[j].Cells["CGST"].Value         = Bill.Rows[j]["CGST"].ToString();
                            dgv_SupplierBill.Rows[j].Cells["SGST"].Value         = Bill.Rows[j]["SGST"].ToString();
                            dgv_SupplierBill.Rows[j].Cells["IGST"].Value         = Bill.Rows[j]["IGST"].ToString();
                            dgv_SupplierBill.Rows[j].Cells["TotalAmt"].Value     = Bill.Rows[j]["GrandAmt"].ToString();
                        }
                        else
                        {
                            MessageBox.Show("Customer Details Missing");
                        }
                    }
                }
                j = j + 1;
                dgv_SupplierBill.Rows.Add(2);
                dgv_SupplierBill.Rows[j].Cells["HSNCode"].Value  = "Total";
                dgv_SupplierBill.Rows[j].Cells["BillAmt"].Value  = _common.sumGridViewColumn(dgv_SupplierBill, "BillAmt");
                dgv_SupplierBill.Rows[j].Cells["CGST"].Value     = _common.sumGridViewColumn(dgv_SupplierBill, "CGST");
                dgv_SupplierBill.Rows[j].Cells["SGST"].Value     = _common.sumGridViewColumn(dgv_SupplierBill, "SGST");
                dgv_SupplierBill.Rows[j].Cells["IGST"].Value     = _common.sumGridViewColumn(dgv_SupplierBill, "IGST");
                dgv_SupplierBill.Rows[j].Cells["TotalAmt"].Value = _common.sumGridViewColumn(dgv_SupplierBill, "TotalAmt");
            }
            catch (Exception ex)
            {
                _error.AddException(ex, "CustomerGSTReport");
            }
        }
Пример #11
0
 private void dgv_Category_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         bttn_Update.Enabled = true;
         bttn_Delete.Enabled = true;
         bttn_Add.Enabled    = false;
         if (e.RowIndex > -1 && e.ColumnIndex >= -1)
         {
             lbl_SrNo.Text     = dgv_Category.Rows[dgv_Category.CurrentRow.Index].Cells["SrNo"].Value.ToString();
             txt_Category.Text = dgv_Category.Rows[dgv_Category.CurrentRow.Index].Cells["Category"].Value.ToString();
         }
     }
     catch (Exception ex)
     {
         _e.AddException(ex, "Category");
     }
 }
Пример #12
0
        private void Calculate()
        {
            double total = 0;

            try
            {
                for (int i = 0; i < dgv_ItemInfo.Rows.Count; i++)
                {
                    total += Math.Round(Convert.ToDouble(dgv_ItemInfo.Rows[i].Cells["TotalAmt"].Value), 2);
                }

                txt_TotalAmt.Text = total.ToString();

                txt_NetAmt.Text = txt_BillAmt.Text = Convert.ToString(_common.sumGridViewColumn(dgv_ItemInfo, "TotalPrice"));
            }
            catch (Exception ex)
            {
                _error.AddException(ex, "Sale");
            }
        }
Пример #13
0
        private void bttn_print_Click(object sender, EventArgs e)
        {
            try
            {
                if (txt_type.Text == "GST")
                {
                    frm_SaleForm _form = new frm_SaleForm(bill.Text, "Update");
                    _form.ShowDialog();
                }

                if (txt_type.Text == "Estimate")
                {
                    frm_SaleEstimate _form = new frm_SaleEstimate(bill.Text, "Update");
                    _form.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                _error.AddException(ex, "ChangeBill");
                MessageBox.Show(ex.Message);
            }
            //_s.PrintBillThermal(cmb_BillNo.Text);
        }
Пример #14
0
        /// <summary>



        public void CustomerBill(string BillNo, string Type)
        {
            string    company        = "SELECT * from CompanyMaster";
            DataTable dt_CompanyInfo = _objsqlhelper.GetDataTable(company);

            string    BillingDetails    = "Select * from CustomerBill Where BillNo='" + BillNo + "' and (PermanentDelete = 0 or PermanentDelete is Null) ";
            DataTable dt_BillingDetails = _objsqlhelper.GetDataTable(BillingDetails);


            string BillType, PayType;

            if (dt_BillingDetails.Rows[0]["State"].ToString() == dt_CompanyInfo.Rows[0]["State"].ToString())
            {
                BillType = "GST_Interstate";
            }
            else
            {
                BillType = "GST_OtherState";
            }

            string         crname     = "Select SaleBill from CrystalReport Where Type='" + BillType + "'";
            string         str_crname = _objsqlhelper.ExecuteScalar(crname);
            ReportDocument _objReport = new ReportDocument();

            _objReport.Load(Environment.CurrentDirectory + "\\" + str_crname);



            _objReport.Database.Tables["CompanyInfo"].SetDataSource(dt_CompanyInfo);


            _objReport.Database.Tables["CustomerBill"].SetDataSource(dt_BillingDetails);

            DataTable dt_CustomerInfo = _sales.GetCustomerByBill(BillNo);

            _objReport.Database.Tables["CustomerDetails"].SetDataSource(dt_CustomerInfo);

            DataTable dt_ItemsDetails = _sales.GetBillItem(BillNo, "Sale");

            _objReport.Database.Tables["BillItem"].SetDataSource(dt_ItemsDetails);
            string qty = Convert.ToString(_common.sumDataTableColumn(dt_ItemsDetails, "Qty"));

            DataTable dt_Payment = _a.getpaymentByBill(BillNo, "Sale", "0");

            _objReport.Database.Tables["Payment"].SetDataSource(dt_Payment);

            try
            {
                string Balance = Convert.ToString(_sales.GetBalance(dt_CustomerInfo.Rows[0]["CustId"].ToString(), "Sale"));
                _objReport.SetParameterValue("Balance", Balance);
            }
            catch (Exception ex)
            {
                _error.AddException(ex, "ReportViewer");
                MessageBox.Show(ex.ToString());
            }

            try
            {
                PayType = "Cash";
                if (dt_Payment.Rows.Count > 0)
                {
                    if (dt_BillingDetails.Rows[0]["BillAmount"] == dt_Payment.Rows[0]["Amt"])
                    {
                        PayType = "Cash";
                    }
                    else
                    {
                        PayType = "Credit";
                    }
                }
                _objReport.SetParameterValue("Type", PayType);
            }
            catch (Exception ex)
            {
                _error.AddException(ex, "ReportViewer");
            }

            try
            {
                double inword = Convert.ToDouble(dt_BillingDetails.Rows[0]["BillAmount"].ToString());
                inword = Math.Round(inword);
                int    number        = Convert.ToInt32(inword);
                string inwordsString = _objCommon.NumberToWords(number);
                _objReport.SetParameterValue("inwords", inwordsString);
            }
            catch (Exception ex)
            {
                _error.AddException(ex, "ReportViewer");
            }

            try
            {
                _objReport.SetParameterValue("Qty", qty);
            }
            catch (Exception ex)
            {
                _error.AddException(ex, "ReportViewer");
            }

            if (Type == "Print")
            {
                if (_objPrinterSetting.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        int Copies = _objPrinterSetting.copies;

                        _objReport.PrintOptions.PrinterName = _objPrinterSetting.PrinterName;
                        _objReport.PrintToPrinter(Copies, true, 0, 0);
                        printresult = true;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                    if (printresult == true)
                    {
                        printresult = false;
                    }
                }
                else
                {
                    crReportViewer.ReportSource = _objReport;
                    crReportViewer.Show();
                    return;
                }
            }
            else
            {
                crReportViewer.ReportSource = _objReport;
                crReportViewer.Show();
                return;
            }
        }
Пример #15
0
        private void btn_Save_Click(object sender, EventArgs e)
        {
            if (check())
            {
                try
                {
                    string VouchertypeID = _objCommon.getALLTableDetails(sTableName: TableNames.VoucherType, sColomnName: "VoucherTypeName", sColumnValue: "Receipt Voucher").Rows[0]["VoucherTypeID"].ToString();

                    string TransactionLedgerID = null;
                    bool   Payformstatus       = true;
                    if (Convert.ToDouble(txtAmount.Text) > 0)
                    {
                        DialogResult dr = MessageBox.Show("Amount to be Payed :" + txtAmount.Text + "\n\n Do You Want To Continue", "JMS Says ", MessageBoxButtons.YesNo);
                        if (dr == DialogResult.Yes)
                        {
                            if (datasv.PaymentForm == "1")
                            {
                                frm_PaymentOptionForReceiptVoucher form = new frm_PaymentOptionForReceiptVoucher
                                                                          (
                                    Amountpaid: txtAmount.Text,
                                    billno: txtReceiptNo.Text,
                                    Accountno: "",
                                    Date: txtDate.Text,
                                    CustomerType: CustomerType.ReceiptVoucher,
                                    OperationType: OperationType.Create
                                                                          );

                                form.ShowDialog();
                                Payformstatus       = true;
                                TransactionLedgerID = form.TransactionLedgerID;
                                PaymentIDs          = form.PaymentIDs;
                                if (form.ReturnStatus == false)
                                {
                                    Payformstatus = false;
                                }
                            }
                            else if (datasv.PaymentForm == "0")
                            {
                                Payformstatus = true;
                            }
                        }
                        else if (dr == DialogResult.No)
                        {
                            Payformstatus = false;
                        }
                    }

                    int ReceiptMasterID = _objCreditDebit.addReceiptVoucher
                                          (
                        ReceiptNo: txtReceiptNo.Text,
                        Date: txtDate.Text,
                        CashOrBankID: TransactionLedgerID.ToString(),
                        AccountLedgerID: CmbAccountLedger.SelectedValue.ToString(),
                        Amount: txtAmount.Text,
                        Narration: txtNarration.Text
                                          );


                    if (txtAmount.Text != "" && txtAmount.Text != "0")
                    {
                        _objCommon.updatePaymentDetailByPaymentID(ColumnName: "VoucherTypeId", columnValue: VouchertypeID, paymentid: PaymentIDs[0]);
                        _objCommon.updatePaymentDetailByPaymentID(ColumnName: "VoucherId", columnValue: ReceiptMasterID.ToString(), paymentid: PaymentIDs[0]);

                        if (PaymentIDs[1] != 0)
                        {
                            _objCommon.updatePaymentDetailByPaymentID(ColumnName: "VoucherTypeId", columnValue: VouchertypeID, paymentid: PaymentIDs[1]);
                            _objCommon.updatePaymentDetailByPaymentID(ColumnName: "VoucherId", columnValue: ReceiptMasterID.ToString(), paymentid: PaymentIDs[1]);
                        }

                        //acount ledger creditdebit  With payment by cash /bank
                        _ObjSalesCommon.insertcreditDebitWithPayment(customerLedgerID: CmbAccountLedger.SelectedValue.ToString(), VouchertypeID: VouchertypeID, sbillno: ReceiptMasterID.ToString(), transactionLedgerID: TransactionLedgerID, AmountPaid: txtAmount.Text, Narration: "", Date: txtDate.Text, name: CmbAccountLedger.Text.Trim());
                    }

                    MessageBox.Show("Data Inserted...!");
                    MasterClear();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    _error.AddException(ex, FormName);
                }
            }
            else
            {
            }
        }
Пример #16
0
        private void Masterclear()
        {
            cmb_Name.ResetText();
            cmb_State.SelectedIndex = 26;
            txt_Address.ResetText();
            txt_City.ResetText();
            txt_ContactNo.ResetText();
            txt_BillNo.ResetText();
            txt_PAN.ResetText();
            txt_GSTIN.ResetText();
            txt_TotalAmt.Text         = "0";
            txt_CGSTValue.Text        = "";
            txt_SGSTValue.Text        = "";
            txt_IGSTValue.Text        = "";
            txt_NetAmt.Text           = "0";
            txt_PaidAmt.Text          = "0";
            txt_BalAmt.Text           = "0";
            txt_OtherCharges.Text     = "0";
            cmb_PayMode.SelectedIndex = 0;
            dgv_ItemInfo.Rows.Clear();
            Clear();
            cmb_Name.DataSource    = _objCustmor.getSupplierName();
            cmb_Name.SelectedIndex = -1;
            txt_PurchaseRef.Text   = _objSQLHelper.GetMaxID("PR", "0");

            try
            {
                lbl_AccNo1.Text = _objSQLHelper.GetMaxID("P", "0");
            }
            catch (Exception ex)
            {
                _error.AddException(ex, "Purchase");
            }
        }