protected void DRRefNoDropDownList_SelectedIndexChanged(object sender, EventArgs e) { DataTable dtSaleInfoForDRF = unitSaleBLObj.dtGetSaleInfoForDemate(" AND SALE.REG_BK='" + fundCode + "' AND SALE.REG_BR='" + branchCode + "' AND SALE.DRF_REF_NO=" + DRRefNoDropDownList.SelectedValue.ToString()); long totalUnitsQty = unitSaleBLObj.getTotalUnitsForDRF(" AND SALE.REG_BK='" + fundCode + "' AND SALE.REG_BR='" + branchCode + "' AND SALE.DRF_REF_NO=" + DRRefNoDropDownList.SelectedValue.ToString()); long maxDistinctiveNo = commonGatewayObj.GetMaxNo("SALE", "DRF_DISTNCT_NO_TO", "SALE.REG_BK = '" + fundCode + "'"); if (dtSaleInfoForDRF.Rows.Count > 0) { SaleListGridView.DataSource = dtSaleInfoForDRF; SaleListGridView.DataBind(); DistinctNoFromTextBox.Text = Convert.ToString(maxDistinctiveNo + 1); DistinctNoToTextBox.Text = Convert.ToString(maxDistinctiveNo + totalUnitsQty); RegFolioNoTextBox.Text = Convert.ToString(commonGatewayObj.GetMaxNo("SALE", "TO_NUMBER(DRF_REG_FOLIO_NO)", "SALE.REG_BK = '" + fundCode + "'") + 1); CertNoTextBox.Text = Convert.ToString(commonGatewayObj.GetMaxNo("SALE", "TO_NUMBER(DRF_CERT_NO)", "SALE.REG_BK = '" + fundCode + "'") + 1); TotalUnitsTextBox.Text = totalUnitsQty.ToString(); } else { SaleListGridView.DataSource = dtSaleInfoForDRF; SaleListGridView.DataBind(); DistinctNoFromTextBox.Text = ""; DistinctNoToTextBox.Text = ""; RegFolioNoTextBox.Text = ""; CertNoTextBox.Text = ""; TotalUnitsTextBox.Text = ""; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('No Data Found');", true); } }
protected void AdviceButton_Click(object sender, EventArgs e) { DataTable dtBEFTNAdviceData = unitRepBLObj.dtGetBEFTNAdviceData("AND B.BEFTN_TRACKING_NO IS NULL AND B.BEFTN_DATE='" + BEFTNDateDropDownList.SelectedValue.ToString() + "' AND A.FUND_CD='" + fundNameDropDownList.SelectedValue.ToString() + "'"); if (dtBEFTNAdviceData.Rows.Count > 0) { try { long beftnTrackingNumber = commonGatewayObj.GetMaxNo("REPURCHASE", "BEFTN_TRACKING_NO") + 1; commonGatewayObj.BeginTransaction(); Hashtable htUpdate = new Hashtable(); htUpdate.Add("BEFTN_TRACKING_NO", beftnTrackingNumber); commonGatewayObj.Update(htUpdate, "REPURCHASE ", "REG_BK='" + fundNameDropDownList.SelectedValue.ToString() + "' AND BEFTN_TRACKING_NO IS NULL AND BEFTN_DATE='" + BEFTNDateDropDownList.SelectedValue.ToString() + "' "); commonGatewayObj.CommitTransaction(); // Session["dtBEFTNAdviceData"] = dtBEFTNAdviceData; Session["BEFTN_DATE"] = BEFTNDateDropDownList.SelectedValue.ToString(); Session["BEFTN_TRACKING_NO"] = beftnTrackingNumber.ToString(); Session["FUND_CD"] = fundNameDropDownList.SelectedValue.ToString(); ClientScript.RegisterStartupScript(this.GetType(), "UnitReportTaxCert", "window.open('ReportViewer/UnitReportRepurchaseBEFTNAdviceLetterReportViewer.aspx')", true); } catch (Exception ex) { commonGatewayObj.RollbackTransaction(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Popup", "alert ('Print Fail:" + ex.Message.Replace("'", "").ToString() + "');", true); } } else { Session["BEFTN_DATE"] = null; Session["BEFTN_TRACKING_NO"] = null; Session["FUND_CD"] = null; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('No Data Found');", true); } }
public void InsertCdblData(DataTable dtCDBLdata) { try { long SI = commonGatewayObj.GetMaxNo("CDBL_DATA", "ID") + 1; commonGatewayObj.BeginTransaction(); Hashtable htCdblData = new Hashtable(); for (int loop = 0; loop < dtCDBLdata.Rows.Count; loop++) { htCdblData.Add("ID", SI); htCdblData.Add("FUND_CODE", fundNameDropDownList.SelectedValue.ToString()); htCdblData.Add("DIVI_NO", ClosingDateDropDownList.SelectedValue.ToString()); htCdblData.Add("FY", DividendFYDropDownList.SelectedItem.Text); htCdblData.Add("RECORD_DATE", ClosingDateDropDownList.SelectedItem.Text); htCdblData.Add("BO", dtCDBLdata.Rows[loop]["BO"]); htCdblData.Add("NAME1", dtCDBLdata.Rows[loop]["NAME1"]); htCdblData.Add("BALANCE", dtCDBLdata.Rows[loop]["BALANCE"]); htCdblData.Add("BO_TYPE", dtCDBLdata.Rows[loop]["BO_TYPE"]); htCdblData.Add("BO_CATAGORY", dtCDBLdata.Rows[loop]["BO_CATAGORY"]); htCdblData.Add("ADDRESS1", dtCDBLdata.Rows[loop]["ADDRESS1"]); htCdblData.Add("ADDRESS2", dtCDBLdata.Rows[loop]["ADDRESS2"]); htCdblData.Add("ADDRESS3", dtCDBLdata.Rows[loop]["ADDRESS3"]); htCdblData.Add("CITY", dtCDBLdata.Rows[loop]["CITY"]); htCdblData.Add("COUNTRY", dtCDBLdata.Rows[loop]["COUNTRY"]); htCdblData.Add("POST_CODE", dtCDBLdata.Rows[loop]["POST_CODE"]); htCdblData.Add("PHONE1", dtCDBLdata.Rows[loop]["PHONE1"]); htCdblData.Add("PHONE2", dtCDBLdata.Rows[loop]["PHONE2"]); htCdblData.Add("RESIDENCY", dtCDBLdata.Rows[loop]["RESIDENCY"]); htCdblData.Add("BANK", dtCDBLdata.Rows[loop]["BANK_NAME"]); htCdblData.Add("BRANCH", dtCDBLdata.Rows[loop]["BRANCH_NAME"]); htCdblData.Add("BANK_ACC", dtCDBLdata.Rows[loop]["BANK_ACC_NO"]); htCdblData.Add("ROUTING_NO", dtCDBLdata.Rows[loop]["ROUTING_NO"]); htCdblData.Add("NAME2", dtCDBLdata.Rows[loop]["NAME2"]); htCdblData.Add("GENDER", dtCDBLdata.Rows[loop]["GENDER"]); htCdblData.Add("BO_NATIONALITY", dtCDBLdata.Rows[loop]["BO_NATIONALITY"]); htCdblData.Add("ETIN", dtCDBLdata.Rows[loop]["ETIN"]); htCdblData.Add("IS_VALID_ETIN", dtCDBLdata.Rows[loop]["IS_VALID_ETIN"]); htCdblData.Add("REG_BK", dtCDBLdata.Rows[loop]["REG_BK"]); htCdblData.Add("REG_BR", dtCDBLdata.Rows[loop]["REG_BR"]); htCdblData.Add("REG_NO", dtCDBLdata.Rows[loop]["REG_NO"]); htCdblData.Add("NO_OF_REGNO", dtCDBLdata.Rows[loop]["NO_OF_REGNO"]); commonGatewayObj.Insert(htCdblData, "CDBL_DATA"); htCdblData = new Hashtable(); SI++; } Hashtable htDividendParaUpdate = new Hashtable(); //htDividendParaUpdate.Add("IS_UPLOAD_CDBL_DATA", "Y"); // commonGatewayObj.Update(htDividendParaUpdate, "DIVIDEND_PARA", "FUND_CODE=" + Convert.ToInt32(fundNameDropDownList.SelectedValue.ToString()) + " AND FY='" + fyDropDownList.Text.ToString() + "'AND RECORD_DATE='" + recordDateDropDownList.Text.ToString() + "'"); commonGatewayObj.CommitTransaction(); ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('CDBL Data Save Successfully');", true); } catch (Exception ex) { commonGatewayObj.RollbackTransaction(); // ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert ('" + msgObj.Error().ToString() + " " + ex.ToString() + "');", true); } }
public void SaveAccountVoucherWithChequePayment(string accountSchema) { try { int countCheck = 0; long tranNumber = commonGatewayObj.GetMaxNo(accountSchema + ".GL_BASICINFO", "TRAN_ID"); long contrlNumber = commonGatewayObj.GetMaxNo(accountSchema + ".GL_BASICINFO", "TO_NUMBER(CTRLNO)") - 1; string acc_op_id = unitRepBLObj.getAcc_OP_ID(fundNameDropDownList.SelectedValue.ToString()); long acc_terminal_no = unitRepBLObj.getAcc_terminal_no(fundNameDropDownList.SelectedValue.ToString()); int faceValue = unitRepBLObj.getUnitFaceValue(fundNameDropDownList.SelectedValue.ToString()); string bankPaymentCode = unitRepBLObj.getUnitBankPaymentCode(fundNameDropDownList.SelectedValue.ToString()); string getUnitFundBankCode = unitRepBLObj.getUnitFundBankCode(fundNameDropDownList.SelectedValue.ToString()); Hashtable htInsert = new Hashtable(); Hashtable htUpdate = new Hashtable(); commonGatewayObj.BeginTransaction(); DataTable dtFundYearEndInfo = commonGatewayObj.Select("SELECT * FROM FUND_INFO WHERE FUND_CD='" + fundNameDropDownList.SelectedValue.ToString() + "'"); int year = Convert.ToDateTime(TranDateTextBox.Text.ToString()).Year; int month = Convert.ToDateTime(TranDateTextBox.Text.ToString()).Month; string yearStartDate = dtFundYearEndInfo.Rows[0]["YEAR_START_MONTH"].ToString(); string yearEndDate = dtFundYearEndInfo.Rows[0]["YEAR_END_MONTH"].ToString(); if (yearStartDate == "01-JUL") { if (month < 6) { yearEndDate = yearEndDate + "-" + year.ToString(); year--; yearStartDate = yearStartDate + "-" + year.ToString(); } else { yearStartDate = yearStartDate + "-" + year.ToString(); year++; yearEndDate = yearEndDate + "-" + year.ToString(); } } else { yearStartDate = yearStartDate + "-" + year.ToString(); yearEndDate = yearEndDate + "-" + year.ToString(); } if (unitRepBLObj.IsDuplicateAccVoucherNo(accountSchema, VoucherNoTexBox.Text.Trim(), "1", yearStartDate, yearEndDate)) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save Failed Duplicate Payment Voucher Number');", true); } else { foreach (GridViewRow Drv in SurrenderListGridView.Rows) { CheckBox leftCheckBox = (CheckBox)SurrenderListGridView.Rows[countCheck].FindControl("leftCheckBox"); //TextBox VoucherNoTexBox = (TextBox)SurrenderListGridView.Rows[countCheck].FindControl("VoucherNumberTextBox"); TextBox ChequeNoTexBox = (TextBox)SurrenderListGridView.Rows[countCheck].FindControl("ChequeNumberTextBox"); if (leftCheckBox.Checked) { decimal unitFaceValue = Convert.ToDecimal(faceValue); decimal unitSaleQty = Convert.ToDecimal(Drv.Cells[8].Text.ToString()); decimal unitSaleRate = Convert.ToDecimal(Drv.Cells[9].Text.ToString()); decimal unitSaleTotalValue = Convert.ToDecimal(Drv.Cells[10].Text.ToString()); DataTable dtHolderBankInfo = unitRepBLObj.dtGetHolderBankInfo(Drv.Cells[2].Text.ToUpper().ToString(), Drv.Cells[3].Text.ToUpper().ToString(), Convert.ToInt32(Drv.Cells[4].Text.ToString())); htUpdate = new Hashtable(); if (dtHolderBankInfo.Rows.Count > 0) { htUpdate.Add("HOLDER_AC_NO", dtHolderBankInfo.Rows[0]["BK_AC_NO"].ToString()); htUpdate.Add("HOLDER_ROUTING_NO", dtHolderBankInfo.Rows[0]["ROUTING_NO"].ToString()); } htUpdate.Add("CHEQUE_DATE", ChequeDateTextBox.Text.ToString()); htUpdate.Add("CHEQUE_POSTED_BY", userObj.UserID.ToString()); htUpdate.Add("CHEQUE_POSTED_DATE", DateTime.Now.ToString()); htUpdate.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString()); htUpdate.Add("CHEQUE_NO", ChequeNoTexBox.Text.Trim().ToString()); if (unitRepBLObj.IsValidMobileNumber(regObj)) { htUpdate.Add("SMS_CREATE_DATE", DateTime.Now.ToString()); } htUpdate.Add("SIGNATORY1_ID", Signatory1DropDownList.SelectedValue.ToUpper().ToString()); htUpdate.Add("SIGANTORY2_ID", Signatory2DropDownList.SelectedValue.ToUpper().ToString()); htUpdate.Add("FUND_INFO_BANK_CODE", getUnitFundBankCode); commonGatewayObj.Update(htUpdate, "REPURCHASE ", "REG_BK='" + Drv.Cells[2].Text.ToUpper().ToString() + "' AND REG_BR='" + Drv.Cells[3].Text.ToUpper().ToString() + "' AND REG_NO=" + Convert.ToInt32(Drv.Cells[4].Text.ToString()) + " AND REP_NO=" + Convert.ToInt32(Drv.Cells[5].Text.ToString())); contrlNumber++; htInsert = new Hashtable(); htInsert.Add("TRAN_ID", tranNumber + 1); htInsert.Add("ACCCODE", "101010000"); htInsert.Add("BANKACNO", "101010000"); htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString()); htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim()); htInsert.Add("REMARKS", unitSaleQty.ToString() + " unit surrendered @tk." + unitSaleRate.ToString() + " per unit "); htInsert.Add("TRAN_TYPE", "D"); htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString()); htInsert.Add("TOTAL_AMNT", Convert.ToDecimal(unitFaceValue * unitSaleQty)); htInsert.Add("CTRLNO", contrlNumber); htInsert.Add("OP_ID", userObj.UserID.ToString()); htInsert.Add("VOUCHER_TYPE", "1"); htInsert.Add("TERMINAL_NO", acc_terminal_no); htInsert.Add("RECENT", "y"); htInsert.Add("LATESTDEL", "m"); htInsert.Add("ISOUT", "N"); htInsert.Add("ISREV", "N"); htInsert.Add("OLDDATA", "N"); commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN"); if (unitSaleRate < unitFaceValue) { contrlNumber++; htInsert = new Hashtable(); htInsert.Add("TRAN_ID", tranNumber + 1); htInsert.Add("ACCCODE", "101020000"); htInsert.Add("BANKACNO_CONTRA", "101020000"); htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString()); htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim()); htInsert.Add("REMARKS", unitSaleQty.ToString() + " unit surrendered @tk." + unitSaleRate.ToString() + " per unit "); htInsert.Add("TRAN_TYPE", "C"); htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString()); htInsert.Add("TOTAL_AMNT", Convert.ToDecimal((unitFaceValue * unitSaleQty) - unitSaleTotalValue)); htInsert.Add("CTRLNO", contrlNumber); htInsert.Add("OP_ID", userObj.UserID.ToString()); htInsert.Add("VOUCHER_TYPE", "1"); htInsert.Add("TERMINAL_NO", acc_terminal_no); htInsert.Add("RECENT", "y"); htInsert.Add("LATESTDEL", "m"); htInsert.Add("ISOUT", "N"); htInsert.Add("ISREV", "N"); htInsert.Add("OLDDATA", "N"); commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN"); } else if (unitSaleRate > unitFaceValue) { contrlNumber++; htInsert = new Hashtable(); htInsert.Add("TRAN_ID", tranNumber + 1); htInsert.Add("ACCCODE", "101020000"); htInsert.Add("BANKACNO", "101020000"); htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString()); htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim()); htInsert.Add("REMARKS", unitSaleQty.ToString() + " unit surrendered @tk." + unitSaleRate.ToString() + " per unit "); htInsert.Add("TRAN_TYPE", "D"); htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString()); htInsert.Add("TOTAL_AMNT", Convert.ToDecimal(unitSaleTotalValue - ((unitFaceValue * unitSaleQty)))); htInsert.Add("CTRLNO", contrlNumber); htInsert.Add("OP_ID", userObj.UserID.ToString()); htInsert.Add("VOUCHER_TYPE", "1"); htInsert.Add("TERMINAL_NO", acc_terminal_no); htInsert.Add("RECENT", "y"); htInsert.Add("LATESTDEL", "m"); htInsert.Add("ISOUT", "N"); htInsert.Add("ISREV", "N"); htInsert.Add("OLDDATA", "N"); commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN"); } contrlNumber++; htInsert = new Hashtable(); htInsert.Add("TRAN_ID", tranNumber + 1); htInsert.Add("ACCCODE", bankPaymentCode); htInsert.Add("BANKACNO_CONTRA", bankPaymentCode); htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString()); htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim()); htInsert.Add("REMARKS", unitSaleQty.ToString() + " unit surrendered @tk." + unitSaleRate.ToString() + " per unit "); htInsert.Add("TRAN_TYPE", "C"); htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString()); htInsert.Add("TOTAL_AMNT", Convert.ToDecimal(unitSaleTotalValue)); htInsert.Add("CTRLNO", contrlNumber); htInsert.Add("OP_ID", userObj.UserID.ToString()); htInsert.Add("VOUCHER_TYPE", "1"); htInsert.Add("CHEQUENO", ChequeNoTexBox.Text.Trim().ToString()); htInsert.Add("CHEQUE_DATE", ChequeDateTextBox.Text.Trim()); htInsert.Add("TERMINAL_NO", acc_terminal_no); htInsert.Add("RECENT", "y"); htInsert.Add("LATESTDEL", "m"); htInsert.Add("ISOUT", "N"); htInsert.Add("ISREV", "N"); htInsert.Add("OLDDATA", "N"); commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN"); } countCheck++; } contrlNumber++; tranNumber++; commonGatewayObj.ExecuteNonQuery(" UPDATE " + accountSchema + ".GL_BASICINFO SET TRAN_ID=" + tranNumber + " , CTRLNO='" + contrlNumber + "' WHERE 1=1"); commonGatewayObj.CommitTransaction(); } } catch (Exception ex) { commonGatewayObj.RollbackTransaction(); throw ex; } }
protected void PrintSaveButton_Click(object sender, EventArgs e) { UnitHolderRegistration regObj = new UnitHolderRegistration(); long money_Receipt_ID = 0; Hashtable htInsertMoneyReceipt = new Hashtable(); try { regObj.FundCode = fundCodeDDL.SelectedValue.ToString(); regObj.BranchCode = branchCodeDDL.SelectedValue.ToString(); if (unitSaleBLObj.CheckDuplicateMoneyReceiptNo(regObj, "TR", Convert.ToInt64(ReceiptNoTextBox.Text.Trim()))) { ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('" + msgObj.Duplicate().ToString() + " " + "Receipt Number " + "');", true); } else { money_Receipt_ID = commonGatewayObj.GetMaxNo("MONEY_RECEIPT", "ID") + 1; commonGatewayObj.BeginTransaction(); htInsertMoneyReceipt.Add("ID", money_Receipt_ID); htInsertMoneyReceipt.Add("RECEIPT_NO", ReceiptNoTextBox.Text.Trim()); htInsertMoneyReceipt.Add("RECEIPT_TYPE", "TR"); htInsertMoneyReceipt.Add("RECEIPT_DATE", ReceiptDateTextBox.Text.Trim()); htInsertMoneyReceipt.Add("REG_BK", fundCodeDDL.SelectedValue.ToString()); htInsertMoneyReceipt.Add("REG_BR", branchCodeDDL.SelectedValue.ToString()); htInsertMoneyReceipt.Add("REG_NO", regNoTextBox.Text.Trim()); if (holderBOTextBox.Text.Trim() != "") { htInsertMoneyReceipt.Add("BO", holderBOTextBox.Text.Trim()); } htInsertMoneyReceipt.Add("HNAME", NameTextBox.Text.Trim()); htInsertMoneyReceipt.Add("ADDRESS", addressTextBox.Text.Trim()); htInsertMoneyReceipt.Add("REG_BK_I", fundCodeDDL.SelectedValue.ToString()); htInsertMoneyReceipt.Add("REG_BR_I", branchCodeDDL.SelectedValue.ToString()); htInsertMoneyReceipt.Add("REG_NO_I", regNoTextBox.Text.Trim()); if (holderBOTextBox.Text.Trim() != "") { htInsertMoneyReceipt.Add("BO_I", holderBOTextBox.Text.Trim()); } htInsertMoneyReceipt.Add("HNAME_I", NameTextBox.Text.Trim()); htInsertMoneyReceipt.Add("ADDRESS_I", addressTextBox.Text.Trim()); htInsertMoneyReceipt.Add("UNIT_QTY", QtyTextBox.Text.Trim()); htInsertMoneyReceipt.Add("TR_CERT_DELIVERY_DT", DeliveryDateTextBox.Text.Trim()); htInsertMoneyReceipt.Add("SL_TR_RN_NO", SaleTRRNNoTextBox.Text.Trim().ToUpper()); htInsertMoneyReceipt.Add("RECEIPT_ENTRY_BY", userObj.UserID.ToString()); htInsertMoneyReceipt.Add("RECEIPT_ENTRY_DATE", DateTime.Today.ToString("dd-MMM-yyyy")); commonGatewayObj.Insert(htInsertMoneyReceipt, "MONEY_RECEIPT"); commonGatewayObj.CommitTransaction(); ClearText(); Session["MONEY_RECEIPT_ID"] = money_Receipt_ID.ToString(); Session["MONEY_RECEIPT_TYPE"] = "REP"; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "window.open('ReportViewer/UnitReportMoneyReceiptReportViewer.aspx');", true); } } catch (Exception ex) { commonGatewayObj.RollbackTransaction(); Session["MONEY_RECEIPT_ID"] = null; Session["MONEY_RECEIPT_TYPE"] = null; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save and print Failed');", true); } }
public void SaveSaleUniAccountVoucher(string accountSchema) { try { int countCheck = 0; long tranNumber = commonGatewayObj.GetMaxNo(accountSchema + ".GL_BASICINFO", "TRAN_ID"); long contrlNumber = commonGatewayObj.GetMaxNo(accountSchema + ".GL_BASICINFO", "TO_NUMBER(CTRLNO)") - 1; string acc_op_id = unitRepBLObj.getAcc_OP_ID(fundNameDropDownList.SelectedValue.ToString()); long acc_terminal_no = unitRepBLObj.getAcc_terminal_no(fundNameDropDownList.SelectedValue.ToString()); int faceValue = unitRepBLObj.getUnitFaceValue(fundNameDropDownList.SelectedValue.ToString()); string bankPaymentCode = unitRepBLObj.getUnitBankPaymentCode(fundNameDropDownList.SelectedValue.ToString()); string getUnitFundBankCode = unitRepBLObj.getUnitFundBankCode(fundNameDropDownList.SelectedValue.ToString()); string shareCapitalCode = "101010000"; string premiumReserveCode = "101020000"; string premiumIncomeCode = "302010000"; Hashtable htInsert = new Hashtable(); Hashtable htUpdate = new Hashtable(); commonGatewayObj.BeginTransaction(); DataTable dtFundYearEndInfo = commonGatewayObj.Select("SELECT * FROM FUND_INFO WHERE FUND_CD='" + fundNameDropDownList.SelectedValue.ToString() + "'"); int year = Convert.ToDateTime(TranDateTextBox.Text.ToString()).Year; int month = Convert.ToDateTime(TranDateTextBox.Text.ToString()).Month; string yearStartDate = dtFundYearEndInfo.Rows[0]["YEAR_START_MONTH"].ToString(); string yearEndDate = dtFundYearEndInfo.Rows[0]["YEAR_END_MONTH"].ToString(); if (yearStartDate == "01-JUL") { if (month < 6) { yearEndDate = yearEndDate + "-" + year.ToString(); year--; yearStartDate = yearStartDate + "-" + year.ToString(); } else { yearStartDate = yearStartDate + "-" + year.ToString(); year++; yearEndDate = yearEndDate + "-" + year.ToString(); } } else { yearStartDate = yearStartDate + "-" + year.ToString(); yearEndDate = yearEndDate + "-" + year.ToString(); } if (unitRepBLObj.IsDuplicateAccVoucherNo(accountSchema, VoucherNoTexBox.Text.Trim(), "2", yearStartDate, yearEndDate)) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save Failed Duplicate Payment Voucher Number');", true); } else { decimal unitSaleQtyCash = 0; decimal unitSaleTotalValueCash = 0; string moneyReceiptID = ""; foreach (GridViewRow Drv in SaleListGridView.Rows) { decimal unitFaceValue = Convert.ToDecimal(faceValue); decimal unitSaleQty = Convert.ToDecimal(Drv.Cells[5].Text.ToString()); decimal unitSaleRate = Convert.ToDecimal(Drv.Cells[6].Text.ToString()); decimal unitSaleTotalValue = Convert.ToDecimal(Drv.Cells[7].Text.ToString()); decimal unitRateDiffernceValue = Convert.ToDecimal(Drv.Cells[10].Text.ToString()); decimal totalBankPayment = Convert.ToDecimal(unitSaleRate * unitSaleQty); decimal totalShareCapital = Convert.ToDecimal(unitFaceValue * unitSaleQty); decimal totalPremiumIncome = Convert.ToDecimal(unitRateDiffernceValue * unitSaleQty); decimal totalPremiumReserve = (totalShareCapital + totalPremiumIncome) - totalBankPayment; if (Drv.Cells[11].Text.ToString().ToUpper() == "CASH") { unitSaleQtyCash = unitSaleQtyCash + Convert.ToDecimal(Drv.Cells[5].Text.ToString()); unitSaleTotalValueCash = unitSaleTotalValueCash + Convert.ToDecimal(Drv.Cells[7].Text.ToString()); if (moneyReceiptID == "") { moneyReceiptID = moneyReceiptID + Drv.Cells[0].Text.ToString(); } else { moneyReceiptID = moneyReceiptID + "," + Drv.Cells[0].Text.ToString(); } } else { htUpdate = new Hashtable(); htUpdate.Add("ACC_VOUCHER_ENTRY_BY", userObj.UserID.ToString()); htUpdate.Add("ACC_VOUCHER_ENTRY_DATE", TranDateTextBox.Text.Trim()); htUpdate.Add("ACC_VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString()); commonGatewayObj.Update(htUpdate, "MONEY_RECEIPT ", "ID=" + Convert.ToInt64(Drv.Cells[0].Text.ToString())); //Bank Payment contrlNumber++; htInsert = new Hashtable(); htInsert.Add("TRAN_ID", tranNumber + 1); htInsert.Add("ACCCODE", bankPaymentCode); htInsert.Add("BANKACNO", bankPaymentCode); htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString()); htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim()); htInsert.Add("REMARKS", unitSaleQty.ToString() + " Unit sold @tk." + unitSaleRate.ToString() + " per unit "); htInsert.Add("TRAN_TYPE", "D"); htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString()); htInsert.Add("TOTAL_AMNT", totalBankPayment); htInsert.Add("CTRLNO", contrlNumber); htInsert.Add("OP_ID", userObj.UserID.ToString()); htInsert.Add("VOUCHER_TYPE", "2"); if (Drv.Cells[11].Text.ToString().ToUpper() == "BOTH") { htInsert.Add("CHEQUENO", Drv.Cells[8].Text.Trim().ToString() + " ,CASH"); htInsert.Add("CHEQUE_DATE", Drv.Cells[9].Text.Trim().ToString()); } else if (Drv.Cells[11].Text.ToString().ToUpper() == "MULT") { } else { htInsert.Add("CHEQUENO", Drv.Cells[8].Text.Trim().ToString()); htInsert.Add("CHEQUE_DATE", Drv.Cells[9].Text.Trim().ToString()); } htInsert.Add("TERMINAL_NO", acc_terminal_no); htInsert.Add("RECENT", "y"); htInsert.Add("LATESTDEL", "m"); htInsert.Add("ISOUT", "N"); htInsert.Add("ISREV", "N"); htInsert.Add("OLDDATA", "N"); commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN"); //ShareCapital contrlNumber++; htInsert = new Hashtable(); htInsert.Add("TRAN_ID", tranNumber + 1); htInsert.Add("ACCCODE", shareCapitalCode); htInsert.Add("BANKACNO_CONTRA", shareCapitalCode); htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString()); htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim()); htInsert.Add("REMARKS", unitSaleQty.ToString() + " Unit sold @tk." + unitSaleRate.ToString() + " per unit "); htInsert.Add("TRAN_TYPE", "C"); htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString()); htInsert.Add("TOTAL_AMNT", totalShareCapital); htInsert.Add("CTRLNO", contrlNumber); htInsert.Add("OP_ID", userObj.UserID.ToString()); htInsert.Add("VOUCHER_TYPE", "2"); htInsert.Add("TERMINAL_NO", acc_terminal_no); htInsert.Add("RECENT", "y"); htInsert.Add("LATESTDEL", "m"); htInsert.Add("ISOUT", "N"); htInsert.Add("ISREV", "N"); htInsert.Add("OLDDATA", "N"); commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN"); //Premimum Income contrlNumber++; htInsert = new Hashtable(); htInsert.Add("TRAN_ID", tranNumber + 1); htInsert.Add("ACCCODE", premiumIncomeCode); htInsert.Add("BANKACNO_CONTRA", premiumIncomeCode); htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString()); htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim()); htInsert.Add("REMARKS", unitSaleQty.ToString() + " Unit sold @tk." + unitSaleRate.ToString() + " per unit "); htInsert.Add("TRAN_TYPE", "C"); htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString()); htInsert.Add("TOTAL_AMNT", totalPremiumIncome); htInsert.Add("CTRLNO", contrlNumber); htInsert.Add("OP_ID", userObj.UserID.ToString()); htInsert.Add("VOUCHER_TYPE", "2"); htInsert.Add("TERMINAL_NO", acc_terminal_no); htInsert.Add("RECENT", "y"); htInsert.Add("LATESTDEL", "m"); htInsert.Add("ISOUT", "N"); htInsert.Add("ISREV", "N"); htInsert.Add("OLDDATA", "N"); commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN"); //premium reserve if (totalPremiumReserve > 0) { contrlNumber++; htInsert = new Hashtable(); htInsert.Add("TRAN_ID", tranNumber + 1); htInsert.Add("ACCCODE", premiumReserveCode); htInsert.Add("BANKACNO", premiumReserveCode); htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString()); htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim()); htInsert.Add("REMARKS", unitSaleQty.ToString() + " unit sold @tk." + unitSaleRate.ToString() + " per unit "); htInsert.Add("TRAN_TYPE", "D"); htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString()); htInsert.Add("TOTAL_AMNT", totalPremiumReserve); htInsert.Add("CTRLNO", contrlNumber); htInsert.Add("OP_ID", userObj.UserID.ToString()); htInsert.Add("VOUCHER_TYPE", "2"); htInsert.Add("TERMINAL_NO", acc_terminal_no); htInsert.Add("RECENT", "y"); htInsert.Add("LATESTDEL", "m"); htInsert.Add("ISOUT", "N"); htInsert.Add("ISREV", "N"); htInsert.Add("OLDDATA", "N"); commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN"); } else if (totalPremiumReserve < 0) { contrlNumber++; htInsert = new Hashtable(); htInsert.Add("TRAN_ID", tranNumber + 1); htInsert.Add("ACCCODE", premiumReserveCode); htInsert.Add("BANKACNO_CONTRA", premiumReserveCode); htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString()); htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim()); htInsert.Add("REMARKS", unitSaleQty.ToString() + " unit sold @tk." + unitSaleRate.ToString() + " per unit "); htInsert.Add("TRAN_TYPE", "C"); htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString()); htInsert.Add("TOTAL_AMNT", totalPremiumReserve * (-1)); htInsert.Add("CTRLNO", contrlNumber); htInsert.Add("OP_ID", userObj.UserID.ToString()); htInsert.Add("VOUCHER_TYPE", "2"); htInsert.Add("TERMINAL_NO", acc_terminal_no); htInsert.Add("RECENT", "y"); htInsert.Add("LATESTDEL", "m"); htInsert.Add("ISOUT", "N"); htInsert.Add("ISREV", "N"); htInsert.Add("OLDDATA", "N"); commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN"); } } countCheck++; if (countCheck == SaleListGridView.Rows.Count && unitSaleQtyCash > 0 && unitSaleTotalValueCash > 0) { decimal totalBankPaymentCash = Convert.ToDecimal(unitSaleRate * unitSaleQtyCash); decimal totalShareCapitalCash = Convert.ToDecimal(unitFaceValue * unitSaleQtyCash); decimal totalPremiumIncomeCash = Convert.ToDecimal(unitRateDiffernceValue * unitSaleQtyCash); decimal totalPremiumReserveCash = (totalShareCapitalCash + totalPremiumIncomeCash) - totalBankPaymentCash; htUpdate = new Hashtable(); htUpdate.Add("ACC_VOUCHER_ENTRY_BY", userObj.UserID.ToString()); htUpdate.Add("ACC_VOUCHER_ENTRY_DATE", TranDateTextBox.Text.Trim()); htUpdate.Add("ACC_VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString()); commonGatewayObj.Update(htUpdate, "MONEY_RECEIPT ", "ID IN (" + moneyReceiptID + ")"); //Bank Payment contrlNumber++; htInsert = new Hashtable(); htInsert.Add("TRAN_ID", tranNumber + 1); htInsert.Add("ACCCODE", bankPaymentCode); htInsert.Add("BANKACNO", bankPaymentCode); htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString()); htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim()); htInsert.Add("REMARKS", unitSaleQtyCash.ToString() + " Unit sold @tk." + unitSaleRate.ToString() + " per unit "); htInsert.Add("TRAN_TYPE", "D"); htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString()); htInsert.Add("TOTAL_AMNT", totalBankPaymentCash); htInsert.Add("CTRLNO", contrlNumber); htInsert.Add("OP_ID", userObj.UserID.ToString()); htInsert.Add("VOUCHER_TYPE", "2"); htInsert.Add("CHEQUENO", "CASH"); htInsert.Add("TERMINAL_NO", acc_terminal_no); htInsert.Add("RECENT", "y"); htInsert.Add("LATESTDEL", "m"); htInsert.Add("ISOUT", "N"); htInsert.Add("ISREV", "N"); htInsert.Add("OLDDATA", "N"); commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN"); //ShareCapital contrlNumber++; htInsert = new Hashtable(); htInsert.Add("TRAN_ID", tranNumber + 1); htInsert.Add("ACCCODE", shareCapitalCode); htInsert.Add("BANKACNO_CONTRA", shareCapitalCode); htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString()); htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim()); htInsert.Add("REMARKS", unitSaleQtyCash.ToString() + " Unit sold @tk." + unitSaleRate.ToString() + " per unit "); htInsert.Add("TRAN_TYPE", "C"); htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString()); htInsert.Add("TOTAL_AMNT", totalShareCapitalCash); htInsert.Add("CTRLNO", contrlNumber); htInsert.Add("OP_ID", userObj.UserID.ToString()); htInsert.Add("VOUCHER_TYPE", "2"); htInsert.Add("TERMINAL_NO", acc_terminal_no); htInsert.Add("RECENT", "y"); htInsert.Add("LATESTDEL", "m"); htInsert.Add("ISOUT", "N"); htInsert.Add("ISREV", "N"); htInsert.Add("OLDDATA", "N"); commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN"); //Premimum Income contrlNumber++; htInsert = new Hashtable(); htInsert.Add("TRAN_ID", tranNumber + 1); htInsert.Add("ACCCODE", premiumIncomeCode); htInsert.Add("BANKACNO_CONTRA", premiumIncomeCode); htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString()); htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim()); htInsert.Add("REMARKS", unitSaleQtyCash.ToString() + " Unit sold @tk." + unitSaleRate.ToString() + " per unit "); htInsert.Add("TRAN_TYPE", "C"); htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString()); htInsert.Add("TOTAL_AMNT", totalPremiumIncomeCash); htInsert.Add("CTRLNO", contrlNumber); htInsert.Add("OP_ID", userObj.UserID.ToString()); htInsert.Add("VOUCHER_TYPE", "2"); htInsert.Add("TERMINAL_NO", acc_terminal_no); htInsert.Add("RECENT", "y"); htInsert.Add("LATESTDEL", "m"); htInsert.Add("ISOUT", "N"); htInsert.Add("ISREV", "N"); htInsert.Add("OLDDATA", "N"); commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN"); //premium reserve if (totalPremiumReserve > 0) { contrlNumber++; htInsert = new Hashtable(); htInsert.Add("TRAN_ID", tranNumber + 1); htInsert.Add("ACCCODE", premiumReserveCode); htInsert.Add("BANKACNO", premiumReserveCode); htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString()); htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim()); htInsert.Add("REMARKS", unitSaleQtyCash.ToString() + " unit sold @tk." + unitSaleRate.ToString() + " per unit "); htInsert.Add("TRAN_TYPE", "D"); htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString()); htInsert.Add("TOTAL_AMNT", totalPremiumReserveCash); htInsert.Add("CTRLNO", contrlNumber); htInsert.Add("OP_ID", userObj.UserID.ToString()); htInsert.Add("VOUCHER_TYPE", "2"); htInsert.Add("TERMINAL_NO", acc_terminal_no); htInsert.Add("RECENT", "y"); htInsert.Add("LATESTDEL", "m"); htInsert.Add("ISOUT", "N"); htInsert.Add("ISREV", "N"); htInsert.Add("OLDDATA", "N"); commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN"); } else if (totalPremiumReserve < 0) { contrlNumber++; htInsert = new Hashtable(); htInsert.Add("TRAN_ID", tranNumber + 1); htInsert.Add("ACCCODE", premiumReserveCode); htInsert.Add("BANKACNO_CONTRA", premiumReserveCode); htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString()); htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim()); htInsert.Add("REMARKS", unitSaleQtyCash.ToString() + " unit sold @tk." + unitSaleRate.ToString() + " per unit "); htInsert.Add("TRAN_TYPE", "C"); htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString()); htInsert.Add("TOTAL_AMNT", totalPremiumReserveCash * (-1)); htInsert.Add("CTRLNO", contrlNumber); htInsert.Add("OP_ID", userObj.UserID.ToString()); htInsert.Add("VOUCHER_TYPE", "2"); htInsert.Add("TERMINAL_NO", acc_terminal_no); htInsert.Add("RECENT", "y"); htInsert.Add("LATESTDEL", "m"); htInsert.Add("ISOUT", "N"); htInsert.Add("ISREV", "N"); htInsert.Add("OLDDATA", "N"); commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN"); } } } contrlNumber++; tranNumber++; commonGatewayObj.ExecuteNonQuery(" UPDATE " + accountSchema + ".GL_BASICINFO SET TRAN_ID=" + tranNumber + " , CTRLNO='" + contrlNumber + "' WHERE 1=1"); commonGatewayObj.CommitTransaction(); } } catch (Exception ex) { commonGatewayObj.RollbackTransaction(); throw ex; } }
protected void PrintSaveButton_Click(object sender, EventArgs e) { UnitHolderRegistration regObj = new UnitHolderRegistration(); long money_Receipt_ID = 0; Hashtable htInsertMoneyReceipt = new Hashtable(); Hashtable htUpdateMoneyReceipt = new Hashtable(); try { regObj.FundCode = fundCodeDDL.SelectedValue.ToString(); regObj.BranchCode = branchCodeDDL.SelectedValue.ToString(); commonGatewayObj.BeginTransaction(); money_Receipt_ID = commonGatewayObj.GetMaxNo("MONEY_RECEIPT", "ID") + 1; htUpdateMoneyReceipt.Add("VALID", "N"); htUpdateMoneyReceipt.Add("RECEIPT_EDIT_TYPE", "E"); htUpdateMoneyReceipt.Add("RECEIPT_EDIT_BY", userObj.UserID.ToString()); htUpdateMoneyReceipt.Add("RECEIPT_EDIT_DATE", DateTime.Today.ToString("dd-MMM-yyyy")); commonGatewayObj.Update(htUpdateMoneyReceipt, "MONEY_RECEIPT", "ID=" + moneyReceipDropDownList.SelectedValue.ToString()); htInsertMoneyReceipt.Add("ID", money_Receipt_ID); htInsertMoneyReceipt.Add("RECEIPT_NO", moneyReceipDropDownList.SelectedItem.Text); htInsertMoneyReceipt.Add("RECEIPT_TYPE", "REP"); htInsertMoneyReceipt.Add("RECEIPT_DATE", ReceiptDateTextBox.Text.Trim()); htInsertMoneyReceipt.Add("REG_BK", fundCodeDDL.SelectedValue.ToString()); htInsertMoneyReceipt.Add("REG_BR", branchCodeDDL.SelectedValue.ToString()); htInsertMoneyReceipt.Add("REG_NO", regNoTextBox.Text.Trim()); if (holderBOTextBox.Text.Trim() != "") { htInsertMoneyReceipt.Add("BO", holderBOTextBox.Text.Trim()); } htInsertMoneyReceipt.Add("HNAME", NameTextBox.Text.Trim()); htInsertMoneyReceipt.Add("ADDRESS", addressTextBox.Text.Trim()); htInsertMoneyReceipt.Add("UNIT_QTY", QtyTextBox.Text.Trim()); htInsertMoneyReceipt.Add("RATE", RateTextBox.Text.Trim()); htInsertMoneyReceipt.Add("SL_TR_RN_NO", SaleTRRNNoTextBox.Text.Trim().ToUpper()); if (EFTRadioButton.Checked) { htInsertMoneyReceipt.Add("REP_PAY_TYPE", "EFT"); } else { htInsertMoneyReceipt.Add("REP_PAY_TYPE", "CHQ"); } htInsertMoneyReceipt.Add("REP_PAY_DATE", PayDateTextBox.Text.Trim()); htInsertMoneyReceipt.Add("RECEIPT_ENTRY_BY", userObj.UserID.ToString()); htInsertMoneyReceipt.Add("RECEIPT_ENTRY_DATE", DateTime.Today.ToString("dd-MMM-yyyy")); commonGatewayObj.Insert(htInsertMoneyReceipt, "MONEY_RECEIPT"); commonGatewayObj.CommitTransaction(); ClearText(); Session["MONEY_RECEIPT_ID"] = money_Receipt_ID.ToString(); Session["MONEY_RECEIPT_TYPE"] = "REP"; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "window.open('ReportViewer/UnitReportMoneyReceiptReportViewer.aspx');", true); } catch (Exception ex) { commonGatewayObj.RollbackTransaction(); Session["MONEY_RECEIPT_ID"] = null; Session["MONEY_RECEIPT_TYPE"] = null; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save and print Failed');", true); } }
protected void PrintSaveButton_Click(object sender, EventArgs e) { UnitHolderRegistration regObj = new UnitHolderRegistration(); long money_Receipt_ID = 0; Hashtable htInsertMoneyReceipt = new Hashtable(); Hashtable htUpdateMoneyReceipt = new Hashtable(); try { regObj.FundCode = fundCodeDDL.SelectedValue.ToString(); regObj.BranchCode = branchCodeDDL.SelectedValue.ToString(); money_Receipt_ID = commonGatewayObj.GetMaxNo("MONEY_RECEIPT", "ID") + 1; commonGatewayObj.BeginTransaction(); htUpdateMoneyReceipt.Add("VALID", "N"); htUpdateMoneyReceipt.Add("RECEIPT_EDIT_TYPE", "E"); htUpdateMoneyReceipt.Add("RECEIPT_EDIT_BY", userObj.UserID.ToString()); htUpdateMoneyReceipt.Add("RECEIPT_EDIT_DATE", DateTime.Today.ToString("dd-MMM-yyyy")); commonGatewayObj.Update(htUpdateMoneyReceipt, "MONEY_RECEIPT", "ID=" + moneyReceipDropDownList.SelectedValue.ToString()); htInsertMoneyReceipt.Add("ID", money_Receipt_ID); htInsertMoneyReceipt.Add("RECEIPT_NO", moneyReceipDropDownList.SelectedItem.Text); htInsertMoneyReceipt.Add("RECEIPT_TYPE", "SL"); htInsertMoneyReceipt.Add("RECEIPT_DATE", ReceiptDateTextBox.Text.Trim()); htInsertMoneyReceipt.Add("REG_BK", fundCodeDDL.SelectedValue.ToString()); htInsertMoneyReceipt.Add("REG_BR", branchCodeDDL.SelectedValue.ToString()); if (regNoTextBox.Text.Trim() != "") { htInsertMoneyReceipt.Add("REG_NO", regNoTextBox.Text.Trim()); } if (holderBOTextBox.Text.Trim() != "") { htInsertMoneyReceipt.Add("BO", holderBOTextBox.Text.Trim()); } if (NameTextBox.Text.Trim() != "") { htInsertMoneyReceipt.Add("HNAME", NameTextBox.Text.Trim()); } htInsertMoneyReceipt.Add("ADDRESS", addressTextBox.Text.Trim()); htInsertMoneyReceipt.Add("UNIT_QTY", QtyTextBox.Text.Trim()); htInsertMoneyReceipt.Add("RATE", RateTextBox.Text.Trim()); if (ChqRadioButton.Checked) { htInsertMoneyReceipt.Add("PAY_TYPE", "CHQ"); htInsertMoneyReceipt.Add("CHQ_TYPE", ChequeTypeDropDownList.SelectedValue.ToString()); } else if (CashRadioButton.Checked) { htInsertMoneyReceipt.Add("PAY_TYPE", "CASH"); } else if (BothRadioButton.Checked) { htInsertMoneyReceipt.Add("PAY_TYPE", "BOTH"); htInsertMoneyReceipt.Add("CHQ_TYPE", ChequeTypeDropDownList.SelectedValue.ToString()); } else if (MultiRadioButton.Checked) { htInsertMoneyReceipt.Add("PAY_TYPE", "MULT"); } if (CHQDDPONOTextBox.Text.Trim() != "") { htInsertMoneyReceipt.Add("CHQ_DD_NO", CHQDDPONOTextBox.Text.Trim()); } if (chequeDateTextBox.Text.Trim() != "") { htInsertMoneyReceipt.Add("CHQ_DD_DATE", chequeDateTextBox.Text.Trim()); } if (RoutingNoTextBox.Text.Trim() != "") { htInsertMoneyReceipt.Add("ROUTING_NO", RoutingNoTextBox.Text.Trim()); } if (BankInfoTextBox.Text.Trim() != "") { htInsertMoneyReceipt.Add("BANK_INFO", BankInfoTextBox.Text.Trim()); } if (CashAmountTextBox.Text.Trim() != "") { htInsertMoneyReceipt.Add("CASH_AMT", CashAmountTextBox.Text.Trim()); } if (MultiplePayTypeTextBox.Text.Trim() != "") { htInsertMoneyReceipt.Add("MULTI_PAY_REMARKS", MultiplePayTypeTextBox.Text.Trim()); } if (sellingAgentCodeTextBox.Text != "") { if (sellingAgentCodeTextBox.Text != "0") { if (sellingAgentCodeTextBox.Text == agentNameDDL.SelectedValue.ToString()) { htInsertMoneyReceipt.Add("SELLING_AGENT_ID", agentNameDDL.SelectedValue.ToString()); htInsertMoneyReceipt.Add("SELLING_AGENT_NAME", agentNameDDL.SelectedItem.Text.ToString()); } } } htInsertMoneyReceipt.Add("RECEIPT_ENTRY_BY", userObj.UserID.ToString()); htInsertMoneyReceipt.Add("RECEIPT_ENTRY_DATE", DateTime.Today.ToString("dd-MMM-yyyy")); commonGatewayObj.Insert(htInsertMoneyReceipt, "MONEY_RECEIPT"); commonGatewayObj.CommitTransaction(); ClearText(); moneyReceipDropDownList.DataSource = unitSaleBLObj.dtMoneyRecieptforDDL(" AND REG_BK = '" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR = '" + regObj.BranchCode.ToString().ToUpper() + "'AND RECEIPT_TYPE = 'SL' AND SL_REP_TR_RN_NO IS NULL AND ACC_VOUCHER_NO IS NULL ORDER BY RECEIPT_NO DESC "); moneyReceipDropDownList.DataTextField = "RECEIPT_NO"; moneyReceipDropDownList.DataValueField = "ID"; moneyReceipDropDownList.DataBind(); Session["MONEY_RECEIPT_ID"] = money_Receipt_ID.ToString(); Session["MONEY_RECEIPT_TYPE"] = "SL"; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "window.open('ReportViewer/UnitReportMoneyReceiptReportViewer.aspx');", true); } catch (Exception ex) { commonGatewayObj.RollbackTransaction(); Session["MONEY_RECEIPT_ID"] = null; Session["MONEY_RECEIPT_TYPE"] = null; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Edit and print Failed');", true); } }
protected void PrintSaveButton_Click(object sender, EventArgs e) { UnitHolderRegistration regObj = new UnitHolderRegistration(); long money_Receipt_ID = 0; Hashtable htInsertMoneyReceipt = new Hashtable(); try { regObj.FundCode = fundCodeDDL.SelectedValue.ToString(); regObj.BranchCode = branchCodeDDL.SelectedValue.ToString(); regObj.RegNumber = regNoTextBox.Text.Trim(); CDSStatus = opendMFDAO.getCDSStatus(fundCodeDDL.SelectedValue.ToString()); decimal TotalUnitsBalance = 0; if (CDSStatus == "Y") { TotalUnitsBalance = opendMFDAO.getTotalSaleUnitBalanceCDS(regObj); } else { TotalUnitsBalance = opendMFDAO.getTotalSaleUnitBalance(regObj); } decimal unitQty = Convert.ToDecimal(QtyTextBox.Text.Trim()); if (unitQty > TotalUnitsBalance) { ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('Save Failed: Insufficient Units');", true); } else if (unitSaleBLObj.CheckDuplicateMoneyReceiptNo(regObj, "REP", Convert.ToInt64(ReceiptNoTextBox.Text.Trim()))) { ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('" + msgObj.Duplicate().ToString() + " " + "Receipt Number " + "');", true); } else { money_Receipt_ID = commonGatewayObj.GetMaxNo("MONEY_RECEIPT", "ID") + 1; commonGatewayObj.BeginTransaction(); htInsertMoneyReceipt.Add("ID", money_Receipt_ID); htInsertMoneyReceipt.Add("RECEIPT_NO", ReceiptNoTextBox.Text.Trim()); htInsertMoneyReceipt.Add("RECEIPT_TYPE", "REP"); htInsertMoneyReceipt.Add("RECEIPT_DATE", ReceiptDateTextBox.Text.Trim()); htInsertMoneyReceipt.Add("REG_BK", fundCodeDDL.SelectedValue.ToString()); htInsertMoneyReceipt.Add("REG_BR", branchCodeDDL.SelectedValue.ToString()); htInsertMoneyReceipt.Add("REG_NO", regNoTextBox.Text.Trim()); if (holderBOTextBox.Text.Trim() != "") { htInsertMoneyReceipt.Add("BO", holderBOTextBox.Text.Trim()); } htInsertMoneyReceipt.Add("HNAME", NameTextBox.Text.Trim()); htInsertMoneyReceipt.Add("ADDRESS", addressTextBox.Text.Trim()); htInsertMoneyReceipt.Add("UNIT_QTY", QtyTextBox.Text.Trim()); htInsertMoneyReceipt.Add("RATE", RateTextBox.Text.Trim()); htInsertMoneyReceipt.Add("SL_TR_RN_NO", SaleTRRNNoTextBox.Text.Trim().ToUpper()); if (EFTRadioButton.Checked) { htInsertMoneyReceipt.Add("REP_PAY_TYPE", "EFT"); } else { htInsertMoneyReceipt.Add("REP_PAY_TYPE", "CHQ"); } htInsertMoneyReceipt.Add("REP_PAY_DATE", PayDateTextBox.Text.Trim()); htInsertMoneyReceipt.Add("RECEIPT_ENTRY_BY", userObj.UserID.ToString()); htInsertMoneyReceipt.Add("RECEIPT_ENTRY_DATE", DateTime.Today.ToString("dd-MMM-yyyy")); commonGatewayObj.Insert(htInsertMoneyReceipt, "MONEY_RECEIPT"); commonGatewayObj.CommitTransaction(); ClearText(); Session["MONEY_RECEIPT_ID"] = money_Receipt_ID.ToString(); Session["MONEY_RECEIPT_TYPE"] = "REP"; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "window.open('ReportViewer/UnitReportMoneyReceiptReportViewer.aspx');", true); } } catch (Exception ex) { commonGatewayObj.RollbackTransaction(); Session["MONEY_RECEIPT_ID"] = null; Session["MONEY_RECEIPT_TYPE"] = null; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save and print Failed');", true); } }