Example #1
0
        private void bttn_save_Click(object sender, EventArgs e)
        {
            try
            {
                if (check())
                {
                    int finalcialYearId = _onjFinancialYear.getSelectedFinancialYearId();

                    string transaction_type;

                    if (rdcredit.Checked == true)
                    {
                        transaction_type = rdcredit.Text;
                    }
                    else
                    {
                        transaction_type = rdDebit.Text;
                    }
                    //_objga.insertAccountLedger(txt_name.Text, dtAccGroup.Rows[0]["srno"].ToString(),txt_OpeningBal.Text, transaction_type);
                    _objBalanceSheet.insertAccountLedger(txt_name.Text, cmb_AccountGroup.SelectedValue.ToString(), txt_OpeningBal.Text, transaction_type, txt_Nar.Text, txt_NOB.Text, txt_ChequeId.Text, dateTimePicker_addDate.Text, finalcialYearId);

                    MessageBox.Show("Saved Successfully");
                    fillgrid();
                    clearall();
                }
                else
                {
                    MessageBox.Show("Add Each Detail");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        private void bttn_save_Click(object sender, EventArgs e)
        {
            try
            {
                int finalcialYearId = _onjFinancialYear.getSelectedFinancialYearId();


                string masterid = _objCredit.insertCreditDebitmaster(txt_amount.Text, txt_narration.Text, dtp_date.Text, finalcialYearId);


                DataTable dt       = _objCredit.getallAccountLedgerDetails();
                int       ledgerid = 0;
                for (int j = 0; j < dt.Rows.Count; j++)
                {
                    if (dt.Rows[j]["Name"].ToString().Trim() == "Cash")
                    {
                        ledgerid = Convert.ToInt32(dt.Rows[j][0]);
                    }
                }


                _objCredit.insertCreditDebitDetails(masterid, ledgerid.ToString(), "0", txt_amount.Text, txt_chequeNo.Text, dtp_chequeDate.Text, dtp_date.Text, "Dr", cmb_AcountLedger.Text);
                _objCredit.insertCreditDebitDetails(masterid, cmb_AcountLedger.SelectedValue.ToString(), txt_amount.Text, "0", txt_chequeNo.Text, txt_chequeNo.Text, dtp_date.Text, "Cr", cmb_AcountLedger.Text);

                MessageBox.Show("Data Saved Successfully");
                clearAllFields();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void bttn_Update_Click(object sender, EventArgs e)
        {
            //  string receipt_no;

            if (txt_pavtiNoAdd.Text != "" && txt_pavtiNoRelease.Text != "")
            {
                int    finalcialYearId = _onjFinancialYear.getSelectedFinancialYearId();
                string gn = _objGirviAdd.get_InvoiceNo();

                //receipt_no  = _objGirviAdd.getReceiptNo("GRT-" + _objFinancialYear.getSelectedFinancialYear().Rows[0]["startyear"].ToString().Substring(8) + "/" + _objFinancialYear.getSelectedFinancialYear().Rows[0]["endyear"].ToString().Substring(8) + "%");
                //receipt_no = "GRT-" + _objFinancialYear.getSelectedFinancialYear().Rows[0]["startyear"].ToString().Substring(8) + "/" + _objFinancialYear.getSelectedFinancialYear().Rows[0]["endyear"].ToString().Substring(8) + "-" + receipt_no;



                DataTable OldDetails     = _objGirviAdd.getGirviByInvoiceNo(txt_Srno.Text);
                string    olddetailsdata = OldDetails.Rows[0]["updated_girvi_no"].ToString();
                string    newdetails;
                if (OldDetails.Rows[0]["updated_girvi_no"].ToString() != "")
                {
                    newdetails = OldDetails.Rows[0]["updated_girvi_no"].ToString() + "." + OldDetails.Rows[0]["receipt_no"].ToString() + "," + OldDetails.Rows[0]["GirviRecordNo"].ToString() + "," + OldDetails.Rows[0]["Amount"].ToString() + "," + OldDetails.Rows[0]["Date_of_deposit"].ToString();
                }
                else
                {
                    newdetails = OldDetails.Rows[0]["receipt_no"].ToString() + "," + OldDetails.Rows[0]["GirviRecordNo"].ToString() + "," + OldDetails.Rows[0]["Amount"].ToString() + "," + OldDetails.Rows[0]["Date_of_deposit"].ToString();
                }

                //  string receipt_norelease = _objGirviAdd.getReceiptNoRelease("GRS-" + _objFinancialYear.getSelectedFinancialYear().Rows[0]["startyear"].ToString().Substring(8) + "/" + _objFinancialYear.getSelectedFinancialYear().Rows[0]["endyear"].ToString().Substring(8) + "%");
                // receipt_norelease = "GRS-" + _objFinancialYear.getSelectedFinancialYear().Rows[0]["startyear"].ToString().Substring(8) + "/" + _objFinancialYear.getSelectedFinancialYear().Rows[0]["endyear"].ToString().Substring(8) + "-" + receipt_norelease;


                _objGirviRelease.updateGirviMasterData(txt_Srno.Text, gn, dtp_DateOfRelease.Text);
                _objGirviRelease.SetReleasemaster(txt_khatawaniNo.Text, txt_Srno.Text, txt_Loanamount.Text, no_of_days, int_rate, txt_TotalAmount.Text, dtp_DateOfRelease.Text, txt_InterestAmount.Text, txt_pavtiNoRelease.Text, finalcialYearId, "");

                _objGirviAdd.addGirviMaster(gn, txt_khatawaniNo.Text, int_rate, dtp_DateOfRelease.Text, txt_PayAmount.Text, dtp_Duration.Text, newdetails, Actual_int_rate, reason, "", txt_pavtiNoAdd.Text, purpose_of_loan, loantype, finalcialYearId, "");

                DataTable dt = _objGirviRelease.getGirviData(txt_Srno.Text);

                for (int i = 0; i < dgv_ItemDetail.Rows.Count; i++)
                {
                    _objGirviAdd.addGirviItemMaster(gn, dt.Rows[i]["metal_type"].ToString(), dt.Rows[i]["metal_type"].ToString(), dt.Rows[i]["item_type"].ToString(), dt.Rows[i]["gross_wt"].ToString(), dt.Rows[i]["reduce_wt"].ToString(), dt.Rows[i]["net_wt"].ToString(), dt.Rows[i]["wt_in_percent"].ToString(), dt.Rows[i]["fine_wt"].ToString(), dt.Rows[i]["Total_Quantity"].ToString(), dt.Rows[i]["current_rate"].ToString(), dt.Rows[i]["amount"].ToString(), "");
                }

                _objGirviAdd.updateGirviNumber(gn);
                MessageBox.Show("Girvi No: " + txt_Srno.Text + " Updated to " + gn);
                this.Close();
            }
        }