protected void SaveButton_Click(object sender, EventArgs e) { int Error_Count = 0; try { commonGatewayObj.BeginTransaction(); DataTable dtMPDSE = (DataTable)Session["dtMPDSE"]; // Hashtable htInsertMP = new Hashtable(); Hashtable htUpdateMP = new Hashtable(); if (!pfolioBLObj.getMPUpdateStatus(marketPriceDateTextBox.Text.ToString(), "DSE")) { for (int loop = 0; loop < dtMPDSE.Rows.Count; loop++) { if (Convert.ToInt32(dtMPDSE.Rows[loop]["COMP_CD"].ToString()) > 0) { string high = dtMPDSE.Rows[loop]["HIGH"].ToString(); htUpdateMP.Add("RT_UPD_DT", marketPriceDateTextBox.Text.ToString()); htUpdateMP.Add("AVG_RT", Convert.ToDecimal(dtMPDSE.Rows[loop]["CLOSE"].ToString())); if (dtMPDSE.Rows[loop]["HIGH"].ToString() != "") { htUpdateMP.Add("DSE_HIGH", Convert.ToDecimal(dtMPDSE.Rows[loop]["HIGH"].ToString())); } if (dtMPDSE.Rows[loop]["LOW"].ToString() != "") { htUpdateMP.Add("DSE_LOW", Convert.ToDecimal(dtMPDSE.Rows[loop]["LOW"].ToString())); } if (dtMPDSE.Rows[loop]["OPEN"].ToString() != "") { htUpdateMP.Add("DSE_OPEN", Convert.ToDecimal(dtMPDSE.Rows[loop]["OPEN"].ToString())); } commonGatewayObj.Update(htUpdateMP, "COMP", "COMP_CD=" + Convert.ToInt32(dtMPDSE.Rows[loop]["COMP_CD"].ToString())); htUpdateMP = new Hashtable(); } Error_Count = loop; } commonGatewayObj.CommitTransaction(); dvGridDSEMPInfo.Visible = false; dsePriceLabel.Text = "Price Save Successfully"; dsePriceLabel.Style.Add("color", "#009933"); } else { dsePriceLabel.Text = "Price Already Saved On That Date"; dsePriceLabel.Style.Add("color", "red"); } } catch (Exception ex) { int errrrr = Error_Count; // dvGridDSEMPInfo.Visible = false; commonGatewayObj.RollbackTransaction(); dsePriceLabel.Text = "Price Save failed Error:" + ex.Message.ToString(); dsePriceLabel.Style.Add("color", "red"); } }
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); } }
protected void SubmitButton_Click(object sender, EventArgs e) { Hashtable htUpdate = new Hashtable(); try { bool isDupliacteDRF = unitSaleBLObj.CheckDuplicateSaleRelatedInfo(" AND SALE.REG_BK='" + fundCode + "' AND SALE.DRF_ACCEPT_NO='" + DRFNoTextBox.Text + "'"); bool isDupliacteDRN = unitSaleBLObj.CheckDuplicateSaleRelatedInfo(" AND SALE.REG_BK='" + fundCode + "' AND SALE.DRF_DRN ='" + DRNTextBox.Text + "'"); if (isDupliacteDRF) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to Duplicate DRF No');", true); } else if (isDupliacteDRN) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to Duplicate DRN');", true); } else { commonGatewayObj.BeginTransaction(); htUpdate = new Hashtable(); htUpdate.Add("DRF_ACCEPT_ENTRY_BY", userObj.UserID.ToString()); htUpdate.Add("DRF_ACCEPT_ENTRY_DATE", DateTime.Now); htUpdate.Add("DRF_ACCEPT_NO", DRFNoTextBox.Text.Trim().ToString()); htUpdate.Add("DRF_DRN", DRNTextBox.Text.Trim().ToString()); htUpdate.Add("DRF_ACCEPT_DATE", DamateDateTextBox.Text.Trim().ToString()); commonGatewayObj.Update(htUpdate, "SALE", "REG_BK='" + fundCode.ToUpper().ToString() + "' AND REG_BR='" + branchCode.ToUpper().ToString() + "' AND SALE.DRF_REF_NO=" + DRRefNoDropDownList.SelectedValue.ToString()); commonGatewayObj.CommitTransaction(); DRRefNoDropDownList.DataSource = unitSaleBLObj.dtDRRefNoListForDRN("AND SALE.REG_BK='" + fundCode + "'"); DRRefNoDropDownList.DataTextField = "NAME"; DRRefNoDropDownList.DataValueField = "ID"; DRRefNoDropDownList.DataBind(); DRFNoTextBox.Text = ""; DRNTextBox.Text = ""; DamateDateTextBox.Text = ""; FolioNoLabel.Text = ""; CertNoLabel.Text = ""; DistinctNoToLabel.Text = ""; DistNoFromLabel.Text = ""; TotalUnitLabel.Text = ""; DataTable dtSaleInfoForDRF = unitSaleBLObj.dtGetSaleInfoForDemate(" AND SALE.REG_BK='" + fundCode + "' AND SALE.REG_BR='" + branchCode + "' AND SALE.DRF_REF_NO=0"); SaleListGridView.DataSource = dtSaleInfoForDRF; SaleListGridView.DataBind(); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save Successfully');", true); } } catch (Exception ex) { commonGatewayObj.RollbackTransaction(); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to Error:" + ex.Message.ToString() + "');", true); } }
protected void SubmitButton_Click(object sender, EventArgs e) { int countCheck = 0; int countUpdateRow = 0; bool isDupliacteDRRefNo = unitSaleBLObj.CheckDuplicateSaleRelatedInfo(" AND SALE.REG_BK='" + fundCode + "' AND DRF_REF_NO=" + Convert.ToInt64(DRFRefNoTextBox.Text.ToString())); if (!isDupliacteDRRefNo) { Hashtable htUpdate = new Hashtable(); try { commonGatewayObj.BeginTransaction(); foreach (GridViewRow Drv in SaleListGridView.Rows) { CheckBox leftCheckBox = (CheckBox)SaleListGridView.Rows[countCheck].FindControl("leftCheckBox"); if (leftCheckBox.Checked) { htUpdate = new Hashtable(); htUpdate.Add("DRF_REQ_BY", userObj.UserID.ToString()); htUpdate.Add("DRF_REQ_DATE", DateTime.Now); htUpdate.Add("HOLDER_BO", Drv.Cells[6].Text.ToUpper().ToString()); htUpdate.Add("DRF_REF_NO", Convert.ToInt64(DRFRefNoTextBox.Text.ToString())); commonGatewayObj.Update(htUpdate, "SALE", "REG_BK='" + Drv.Cells[1].Text.ToUpper().ToString() + "' AND REG_BR='" + Drv.Cells[2].Text.ToUpper().ToString() + "' AND REG_NO=" + Convert.ToInt32(Drv.Cells[3].Text.ToString()) + " AND SL_NO=" + Convert.ToInt32(Drv.Cells[4].Text.ToString())); countUpdateRow++; } countCheck++; } if (countUpdateRow == 0) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due No Sale Selection ');", true); } else { commonGatewayObj.CommitTransaction(); DataTable dtSaleInfoForDRF = unitSaleBLObj.dtGetSaleInfoForDRF(" AND SALE.REG_BK='" + fundCode + "' AND SALE.REG_BR='" + branchCode + "' AND SALE.SL_NO BETWEEN 0 AND 0"); SaleListGridView.DataSource = dtSaleInfoForDRF; SaleListGridView.DataBind(); DRFRefNoTextBox.Text = ""; toSaleNoTextBox.Text = ""; fromSaleNoTextBox.Text = ""; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save Successfully');", true); } } catch (Exception ex) { commonGatewayObj.RollbackTransaction(); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed:" + ex.Message.ToString() + "');", true); } } else { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed:Duplicate DR Reference Number ');", true); } }
protected void SubmitButton_Click(object sender, EventArgs e) { int countCheck = 0; Hashtable htUpdate = new Hashtable(); try { foreach (GridViewRow Drv in SaleListGridView.Rows) { TextBox TRSeqNoTextBox = (TextBox)SaleListGridView.Rows[countCheck].FindControl("TRSeqNoTextBox"); bool isDupliacteTrSeqNo = unitSaleBLObj.CheckDuplicateSaleRelatedInfo(" AND SALE.REG_BK='" + fundCode + "' AND SALE.DRF_TR_SEQ_NO='" + TRSeqNoTextBox.Text + "'"); if (isDupliacteTrSeqNo) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to Duplicate Transfer Sequence Number:" + TRSeqNoTextBox.Text + "');", true); break; } else { commonGatewayObj.BeginTransaction(); htUpdate = new Hashtable(); htUpdate.Add("DRF_TR_ENTRY_BY", userObj.UserID.ToString()); htUpdate.Add("DRF_TR_ENTRY_DATE", DateTime.Now); htUpdate.Add("DRF_TR_SEQ_NO", TRSeqNoTextBox.Text.Trim().ToString()); htUpdate.Add("DRF_TR_DATE", TransferDateTextBox.Text.Trim().ToString()); commonGatewayObj.Update(htUpdate, "SALE", "REG_BK='" + fundCode.ToUpper().ToString() + "' AND REG_BR='" + branchCode.ToUpper().ToString() + "' AND SALE.DRF_REF_NO=" + DRRefNoDropDownList.SelectedValue.ToString()); } commonGatewayObj.CommitTransaction(); DRRefNoDropDownList.DataSource = unitSaleBLObj.dtDRRefNoListForFolioTransfer("AND SALE.REG_BK='" + fundCode + "'"); DRRefNoDropDownList.DataTextField = "NAME"; DRRefNoDropDownList.DataValueField = "ID"; DRRefNoDropDownList.DataBind(); TRSeqFromNoTextBox.Text = ""; TransferDateTextBox.Text = ""; DataTable dtSaleInfoForDRF = unitSaleBLObj.dtGetSaleInfoForDemate(" AND SALE.REG_BK='" + fundCode + "' AND SALE.REG_BR='" + branchCode + "' AND SALE.DRF_REF_NO=0"); SaleListGridView.DataSource = dtSaleInfoForDRF; SaleListGridView.DataBind(); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save Successfully');", true); countCheck++; } } catch (Exception ex) { commonGatewayObj.RollbackTransaction(); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to Error:" + ex.Message.ToString() + "');", true); } }
protected void SaveButton_Click(object sender, EventArgs e) { try { commonGatewayObj.BeginTransaction(); Hashtable htDeliveryInfo = new Hashtable(); DataTable dtDividendLedger = (DataTable)Session["dtDividendLedger"]; int countRow = 0; if (dtDividendLedger.Rows.Count > 0) { foreach (DataGridItem gridRow in dgLedger.Items) { CheckBox leftCheckBox = (CheckBox)gridRow.FindControl("leftCheckBox"); if (leftCheckBox.Checked) { htDeliveryInfo.Add("WAR_DELEVARY_DT", Convert.ToDateTime(dateTextBox.Text.Trim()).ToString("dd-MMM-yyyy")); htDeliveryInfo.Add("WAR_BK_PAY_USER", userObj.UserID.ToString()); if (selfRadioButton.Checked) { htDeliveryInfo.Add("WARR_RECPT_BY", "SELF"); } else { htDeliveryInfo.Add("WARR_RECPT_BY", authorizeTextBox.Text.Trim().ToString()); } commonGatewayObj.Update(htDeliveryInfo, "DIVIDEND", "REG_BK='" + fundCodeDDL.SelectedValue.ToString() + "' AND DIVI_NO=" + Convert.ToInt32(dtDividendLedger.Rows[countRow]["DIVI_NO"]) + " AND REG_NO=" + Convert.ToInt32(regNoTextBox.Text.Trim()) + " AND WAR_NO=" + Convert.ToInt32(dtDividendLedger.Rows[countRow]["WAR_NO"])); } htDeliveryInfo = new Hashtable(); countRow++; } commonGatewayObj.CommitTransaction(); dvLedger.Visible = false; totalRowCountLabel.Text = "0"; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save Successfully');", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('No Data Found to Save');", true); } } catch (Exception ex) { // dvGridAttendenceInfo.Visible = false; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('" + msgObj.Error().ToString() + " " + ex.Message.Replace("'", "").ToString() + "');", true); } }
protected void AuditButton_Click(object sender, EventArgs e) { int countCheck = 0; Hashtable htUpdate = new Hashtable(); try { commonGatewayObj.BeginTransaction(); foreach (GridViewRow Drv in SurrenderListGridView.Rows) { CheckBox leftCheckBox = (CheckBox)SurrenderListGridView.Rows[countCheck].FindControl("leftCheckBox"); if (leftCheckBox.Checked) { htUpdate = new Hashtable(); htUpdate.Add("AUDITED_BY", userObj.UserID.ToString()); htUpdate.Add("AUDITED_DATE", DateTime.Now); 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())); } countCheck++; } commonGatewayObj.CommitTransaction(); if (fundNameDropDownList.SelectedValue.ToString() != "0") { DataTable dtChequeData = unitRepBLObj.dtGetChequePaymentData("AND A.AUDITED_BY IS NULL AND FUND_INFO.FUND_CD='" + fundNameDropDownList.SelectedValue.ToString() + "'"); SurrenderListGridView.DataSource = dtChequeData; SurrenderListGridView.DataBind(); } else { DataTable dtChequeData = unitRepBLObj.dtGetChequePaymentData("AND A.AUDITED_BY IS NULL "); SurrenderListGridView.DataSource = dtChequeData; SurrenderListGridView.DataBind(); } ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save Successfully');", true); } catch (Exception ex) { commonGatewayObj.RollbackTransaction(); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed');", true); } }
protected void processButton_Click(object sender, EventArgs e) { DataTable dtBankBranchInfo = commonGatewayObj.Select("SELECT * FROM BANK_BRANCH_BB WHERE BANK_CODE=" + Convert.ToInt16(bankNameDropDownList.SelectedValue.ToString()) + " AND IS_PROCE_COMP IS NULL ORDER BY BRANC_NAME"); if (dtBankBranchInfo.Rows.Count > 0) { try { Hashtable htInsertBankBranch = new Hashtable(); Hashtable htUpdateBankBranch = new Hashtable(); Hashtable htUpdateBankBranchBB = new Hashtable(); string branchName = ""; int Bank_code = 0; for (int loop = 0; loop < dtBankBranchInfo.Rows.Count; loop++) { branchName = dtBankBranchInfo.Rows[loop]["BRANC_NAME"].ToString(); Bank_code = Convert.ToInt32(dtBankBranchInfo.Rows[loop]["BANK_CODE"].ToString()); if (ISBranchExist(branchName, Bank_code)) { htUpdateBankBranch = new Hashtable(); htUpdateBankBranch.Add("BANK_CODE_BB", dtBankBranchInfo.Rows[loop]["BANK_CODE_BB"].ToString()); htUpdateBankBranch.Add("BRANCH_CODE_BB", dtBankBranchInfo.Rows[loop]["BRANCH_CODE_BB"].ToString()); htUpdateBankBranch.Add("DIST_CODE", dtBankBranchInfo.Rows[loop]["DIST_CODE"].ToString()); htUpdateBankBranch.Add("ROUTING_NO", dtBankBranchInfo.Rows[loop]["ROUTING_NO"].ToString()); htUpdateBankBranch.Add("BRANCH_DISTRICT", dtBankBranchInfo.Rows[loop]["DISTRICT"].ToString()); commonGatewayObj.Update(htUpdateBankBranch, "BANK_BRANCH", "BRANCH_NAME='" + branchName.ToString() + "' AND BANK_CODE=" + Bank_code); } else { htInsertBankBranch = new Hashtable(); htInsertBankBranch.Add("BANK_CODE", Bank_code); htInsertBankBranch.Add("BRANCH_CODE", getMaxBranchCode(Bank_code)); htInsertBankBranch.Add("BRANCH_NAME", dtBankBranchInfo.Rows[loop]["BRANC_NAME"].ToString()); htInsertBankBranch.Add("BANK_CODE_BB", dtBankBranchInfo.Rows[loop]["BANK_CODE_BB"].ToString()); htInsertBankBranch.Add("BRANCH_CODE_BB", dtBankBranchInfo.Rows[loop]["BRANCH_CODE_BB"].ToString()); htInsertBankBranch.Add("DIST_CODE", dtBankBranchInfo.Rows[loop]["DIST_CODE"].ToString()); htInsertBankBranch.Add("ROUTING_NO", dtBankBranchInfo.Rows[loop]["ROUTING_NO"].ToString()); htInsertBankBranch.Add("BRANCH_DISTRICT", dtBankBranchInfo.Rows[loop]["DISTRICT"].ToString()); commonGatewayObj.Insert(htInsertBankBranch, "BANK_BRANCH"); } htUpdateBankBranchBB = new Hashtable(); htUpdateBankBranchBB.Add("IS_PROCE_COMP", "Y"); commonGatewayObj.Update(htUpdateBankBranchBB, "BANK_BRANCH_BB", "BRANC_NAME='" + branchName.ToString() + "' AND BANK_CODE=" + Bank_code); } commonGatewayObj.CommitTransaction(); ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert ('Complete Successfylly');", true); } catch (Exception ex) { commonGatewayObj.RollbackTransaction(); //errorMassege = msgObj.ExceptionErrorMessageString(ex.Message.ToString()); ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert ('Error');", true); } } else { ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert ('No Data Found or Process is completed');", 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; } }
public void SaveSaleEditInfo(UnitHolderRegistration unitRegObj, UnitSale unitSaleObj, DataTable dtDinomination, UnitUser unitUserObj) { Hashtable htUnitSale = new Hashtable(); Hashtable htUnitSaleCert = new Hashtable(); Hashtable htCertNoTemp = new Hashtable(); string certificate = ""; try { commonGatewayObj.BeginTransaction(); //htUnitSale.Add("REG_BK", unitRegObj.FundCode.ToString().ToUpper()); //htUnitSale.Add("REG_BR", unitRegObj.BranchCode.ToString()); htUnitSale.Add("REG_NO", unitRegObj.RegNumber.ToString()); //htUnitSaleCert.Add("REG_BK", unitRegObj.FundCode.ToString().ToUpper()); //htUnitSaleCert.Add("REG_BR", unitRegObj.BranchCode.ToString()); htUnitSaleCert.Add("REG_NO", unitRegObj.RegNumber.ToString()); //htUnitSale.Add("SL_NO", Convert.ToInt32(unitSaleObj.SaleNo.ToString())); htUnitSale.Add("SL_DT", Convert.ToDateTime(unitSaleObj.SaleDate).ToString("dd-MMM-yyyy")); htUnitSale.Add("SL_PRICE", Convert.ToDecimal(unitSaleObj.SaleRate.ToString())); htUnitSale.Add("QTY", Convert.ToInt32(unitSaleObj.SaleUnitQty.ToString())); htUnitSale.Add("SL_TYPE", unitSaleObj.SaleType.ToString().ToUpper()); htCertNoTemp.Add("REG_BK", unitRegObj.FundCode.ToString().ToUpper()); htCertNoTemp.Add("REG_BR", unitRegObj.BranchCode.ToString()); htCertNoTemp.Add("REG_NO", unitRegObj.RegNumber.ToString()); htCertNoTemp.Add("SL_NO", Convert.ToInt32(unitSaleObj.SaleNo.ToString())); htCertNoTemp.Add("SL_DT", Convert.ToDateTime(unitSaleObj.SaleDate).ToString("dd-MMM-yyyy")); htCertNoTemp.Add("SL_PRICE", Convert.ToDecimal(unitSaleObj.SaleRate.ToString())); htCertNoTemp.Add("QTY", Convert.ToInt32(unitSaleObj.SaleUnitQty.ToString())); htCertNoTemp.Add("SL_TYPE", unitSaleObj.SaleType.ToString().ToUpper()); //htUnitSale.Add("USER_NM", unitUserObj.UserID.ToString()); //htUnitSale.Add("ENT_TM", DateTime.Now.ToShortTimeString().ToString()); //htUnitSale.Add("ENT_DT", DateTime.Now.ToString()); if (!(unitSaleObj.MoneyReceiptNo.ToString() == "0")) { htUnitSale.Add("MONY_RECT_NO", Convert.ToInt32(unitSaleObj.MoneyReceiptNo)); htCertNoTemp.Add("MONY_RECT_NO", Convert.ToInt32(unitSaleObj.MoneyReceiptNo)); } else { htUnitSale.Add("MONY_RECT_NO", DBNull.Value); htCertNoTemp.Add("MONY_RECT_NO", DBNull.Value); } if (!((unitSaleObj.MoneyReceiptNo.ToString() == "0") && unitSaleObj.PaymentType.ToString() == "CHQ" && unitSaleObj.ChequeNo == null && unitSaleObj.ChequeDate == null)) { htUnitSale.Add("PAY_TYPE", unitSaleObj.PaymentType); htCertNoTemp.Add("PAY_TYPE", unitSaleObj.PaymentType); } else { htUnitSale.Add("PAY_TYPE", DBNull.Value); htCertNoTemp.Add("PAY_TYPE", DBNull.Value); } if (unitSaleObj.ChequeNo != null) { htUnitSale.Add("CHQ_DD_NO", unitSaleObj.ChequeNo); htCertNoTemp.Add("CHQ_DD_NO", unitSaleObj.ChequeNo); } else { htUnitSale.Add("CHQ_DD_NO", DBNull.Value); htCertNoTemp.Add("CHQ_DD_NO", DBNull.Value); } if (unitSaleObj.ChequeDate == null) { htUnitSale.Add("CHEQUE_DT", DBNull.Value); htCertNoTemp.Add("CHEQUE_DT", DBNull.Value); } else { htUnitSale.Add("CHEQUE_DT", unitSaleObj.ChequeDate); htCertNoTemp.Add("CHEQUE_DT", unitSaleObj.ChequeDate); } if (!(unitSaleObj.BankCode.ToString() == "0")) { htUnitSale.Add("BANK_CODE", Convert.ToInt16(unitSaleObj.BankCode)); htCertNoTemp.Add("BANK_CODE", Convert.ToInt16(unitSaleObj.BankCode)); } else { htUnitSale.Add("BANK_CODE", DBNull.Value); htCertNoTemp.Add("BANK_CODE", DBNull.Value); } if (!(unitSaleObj.BranchCode.ToString() == "0")) { htUnitSale.Add("BRANCH_CODE", Convert.ToInt16(unitSaleObj.BranchCode)); htCertNoTemp.Add("BRANCH_CODE", Convert.ToInt16(unitSaleObj.BranchCode)); } else { htUnitSale.Add("BRANCH_CODE", DBNull.Value); htCertNoTemp.Add("BRANCH_CODE", DBNull.Value); } if (!(unitSaleObj.CashAmount.ToString() == "0")) { htUnitSale.Add("CASH_AMT", Convert.ToDecimal(unitSaleObj.CashAmount)); htCertNoTemp.Add("CASH_AMT", Convert.ToDecimal(unitSaleObj.CashAmount)); } else { htUnitSale.Add("CASH_AMT", DBNull.Value); htCertNoTemp.Add("CASH_AMT", DBNull.Value); } if (unitSaleObj.MultiPayType != null) { htUnitSale.Add("MULTI_PAY_REMARKS", unitSaleObj.MultiPayType); htCertNoTemp.Add("MULTI_PAY_REMARKS", unitSaleObj.MultiPayType); } else { htUnitSale.Add("MULTI_PAY_REMARKS", DBNull.Value); htCertNoTemp.Add("MULTI_PAY_REMARKS", DBNull.Value); } //update sale table commonGatewayObj.Update(htUnitSale, "SALE", "SL_NO=" + Convert.ToInt32(unitSaleObj.SaleNo.ToString()) + " AND REG_BK='" + unitRegObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + unitRegObj.BranchCode.ToString() + "' "); //update sale_cert table if reg_no is change commonGatewayObj.Update(htUnitSaleCert, "SALE_CERT", "SL_NO=" + Convert.ToInt32(unitSaleObj.SaleNo.ToString()) + " AND REG_BK='" + unitRegObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + unitRegObj.BranchCode.ToString() + "' "); htUnitSaleCert = new Hashtable(); if (dtDinomination.Rows.Count > 0)//Update certificate change information { for (int looper = 0; looper < dtDinomination.Rows.Count; looper++) { // htUnitSaleCert.Add("SL_NO", Convert.ToInt32(unitSaleObj.SaleNo.ToString())); // htUnitSaleCert.Add("STATUS_FLAG", dtDinomination.Rows[looper]["status"].ToString().ToUpper()); htUnitSaleCert.Add("CERT_TYPE", dtDinomination.Rows[looper]["dino"].ToString().ToUpper()); htUnitSaleCert.Add("CERT_NO", Convert.ToInt32(dtDinomination.Rows[looper]["cert_no"].ToString())); htUnitSaleCert.Add("CERTIFICATE", SaleCertNo(Convert.ToInt32(dtDinomination.Rows[looper]["cert_no"].ToString()), dtDinomination.Rows[looper]["dino"].ToString().ToUpper())); htUnitSaleCert.Add("QTY", Convert.ToInt32(dtDinomination.Rows[looper]["cert_weight"].ToString())); // htUnitSaleCert.Add("USER_NM", unitUserObj.UserID.ToString()); //htUnitSaleCert.Add("ENT_TM", DateTime.Now.ToShortTimeString().ToString()); //htUnitSaleCert.Add("ENT_DT", DateTime.Now.ToString()); commonGatewayObj.Update(htUnitSaleCert, "SALE_CERT", "SL_NO=" + Convert.ToInt32(unitSaleObj.SaleNo.ToString()) + " AND ROWID='" + dtDinomination.Rows[looper]["ROWID"].ToString() + "'"); htUnitSaleCert = new Hashtable(); if (certificate == "") { certificate = SaleCertNo(Convert.ToInt32(dtDinomination.Rows[looper]["cert_no"].ToString()), dtDinomination.Rows[looper]["dino"].ToString().ToUpper()); } else { certificate = certificate + "," + SaleCertNo(Convert.ToInt32(dtDinomination.Rows[looper]["cert_no"].ToString()), dtDinomination.Rows[looper]["dino"].ToString().ToUpper()); } } } if (certificate != "") { htCertNoTemp.Add("CERTIFICATE", certificate); } else { htCertNoTemp.Add("CERTIFICATE", DBNull.Value); } htCertNoTemp.Add("USER_NM", unitUserObj.UserID.ToString()); htCertNoTemp.Add("ENT_TM", DateTime.Now.ToShortTimeString().ToString()); htCertNoTemp.Add("ENT_DT", DateTime.Now.ToString()); htCertNoTemp.Add("EDIT_TYPE", "E"); commonGatewayObj.Insert(htCertNoTemp, "SALE_ED_INFO"); commonGatewayObj.CommitTransaction(); } catch (Exception ex) { commonGatewayObj.RollbackTransaction(); throw ex; } }
public void SaveUnitRenewal(UnitHolderRegistration unitRegObj, DataTable dtTransferSaleCert, UnitRenewal renwalObj, DataTable dtDinomination, UnitUser unitUserObj) { Hashtable htUnitSaleCert = new Hashtable(); Hashtable htRenwal = new Hashtable(); Hashtable htRenewalIN = new Hashtable(); Hashtable htRenewalOUT = new Hashtable(); UnitTransferBL unitTransferBLObj = new UnitTransferBL(); int SL_TR_RN = 0; int CertNo = 0; string certType = ""; string[] saleNoArray; string[] certArray; string valid = "N"; string remarks = "RENEWAL NO:" + renwalObj.RenewalNo.ToString(); string Old_SL_TR_RN = ""; string FORM_CODE = ""; if (renwalObj.RenewalType.ToString().ToUpper() == "S" || renwalObj.RenewalType.ToString().ToUpper() == "C") { FORM_CODE = "UNIT-UMA"; } else if (renwalObj.RenewalType.ToString().ToUpper() == "S") { FORM_CODE = "UNIT-CHA"; } try { commonGatewayObj.BeginTransaction(); for (int loop = 0; loop < dtTransferSaleCert.Rows.Count; loop++) { if (dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().ToUpper().IndexOf('S') >= 0) { htUnitSaleCert = new Hashtable(); htUnitSaleCert.Add("VALID", valid); htUnitSaleCert.Add("REMARKS", remarks); saleNoArray = dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().Split('S'); SL_TR_RN = Convert.ToInt32(saleNoArray[1].ToString()); certArray = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-'); CertNo = Convert.ToInt32(certArray[1].ToString()); certType = certArray[0].ToString().ToUpper(); commonGatewayObj.Update(htUnitSaleCert, "SALE_CERT", "REG_NO=" + Convert.ToInt32(unitRegObj.RegNumber) + " AND REG_BK='" + unitRegObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + unitRegObj.BranchCode.ToString().ToUpper() + "' AND SL_NO=" + SL_TR_RN + " AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'"); Old_SL_TR_RN = "S" + SL_TR_RN.ToString(); } else if (dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().ToUpper().IndexOf('T') >= 0) { htUnitSaleCert = new Hashtable(); htUnitSaleCert.Add("VALID", valid); htUnitSaleCert.Add("REMARKS", remarks); saleNoArray = dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().Split('T'); SL_TR_RN = Convert.ToInt32(saleNoArray[1].ToString()); certArray = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-'); CertNo = Convert.ToInt32(certArray[1].ToString()); certType = certArray[0].ToString().ToUpper(); commonGatewayObj.Update(htUnitSaleCert, "TRANS_CERT", "F_CD='" + unitRegObj.FundCode.ToString().ToUpper() + "' AND TR_NO=" + SL_TR_RN + " AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'"); // commonGatewayObj.Update(htUnitSaleCert, "SALE_CERT", " REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "' AND SL_NO=" + SL_TR_RN + " AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'"); // commonGatewayObj.Update(htUnitSaleCert, "RENEWAL_OUT", "REN_NO='" + SL_TR_RN + "' AND REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "' AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'"); Old_SL_TR_RN = "T" + SL_TR_RN.ToString(); } else if (dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().ToUpper().IndexOf('R') >= 0) { htUnitSaleCert = new Hashtable(); htUnitSaleCert.Add("VALID", valid); htUnitSaleCert.Add("REMARKS", remarks); saleNoArray = dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().Split('R'); SL_TR_RN = Convert.ToInt32(saleNoArray[1].ToString()); certArray = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-'); CertNo = Convert.ToInt32(certArray[1].ToString()); certType = certArray[0].ToString().ToUpper(); commonGatewayObj.Update(htUnitSaleCert, "RENEWAL_OUT", "REN_NO='" + SL_TR_RN + "' AND REG_BK='" + unitRegObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + unitRegObj.BranchCode.ToString().ToUpper() + "' AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'"); Old_SL_TR_RN = "R" + SL_TR_RN.ToString(); } htRenewalIN = new Hashtable(); htRenewalIN.Add("REG_BK", unitRegObj.FundCode.ToString().ToUpper()); htRenewalIN.Add("REG_BR", unitRegObj.BranchCode.ToString().ToUpper()); htRenewalIN.Add("REG_NO", Convert.ToInt32(unitRegObj.RegNumber.ToString())); htRenewalIN.Add("REN_NO", renwalObj.RenewalNo.ToString()); certArray = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-'); htRenewalIN.Add("CERT_TYPE", certArray[0].ToString().ToUpper()); htRenewalIN.Add("CERT_NO", Convert.ToInt32(certArray[1].ToString())); htRenewalIN.Add("CERTIFICATE", dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().ToUpper()); htRenewalIN.Add("QTY", Convert.ToInt32(dtTransferSaleCert.Rows[loop]["QTY"].ToString())); htRenewalIN.Add("SL_TR_NO", Old_SL_TR_RN.ToString().ToUpper()); commonGatewayObj.Insert(htRenewalIN, "RENEWAL_IN"); } DataTable dtTransfer = unitTransferBLObj.dtTrnasfer(dtTransferSaleCert); for (int i = 0; i < dtTransfer.Rows.Count; i++) //Insert Into Renewal Table { htRenwal = new Hashtable(); htRenwal.Add("REN_NO", renwalObj.RenewalNo.ToString()); htRenwal.Add("REN_DT", Convert.ToDateTime(renwalObj.RenewalDate).ToString("dd-MMM-yyyy")); htRenwal.Add("REG_BK", unitRegObj.FundCode.ToString().ToUpper()); htRenwal.Add("REG_BR", unitRegObj.BranchCode.ToString()); htRenwal.Add("REG_NO", Convert.ToInt32(unitRegObj.RegNumber.ToString())); htRenwal.Add("FORM_CODE", FORM_CODE); htRenwal.Add("SL_TR_NO", dtTransfer.Rows[i]["SL_NO"].ToString()); htRenwal.Add("REN_TYPE", renwalObj.RenewalType.ToString().ToUpper()); htRenwal.Add("QTY", Convert.ToInt32(dtTransfer.Rows[i]["QTY"].ToString())); htRenwal.Add("USER_NM", unitUserObj.UserID.ToString()); htRenwal.Add("ENT_DT", DateTime.Now.ToString()); htRenwal.Add("ENT_TM", DateTime.Now.ToShortTimeString().ToString()); commonGatewayObj.Insert(htRenwal, "RENEWAL"); } for (int looper = 0; looper < dtDinomination.Rows.Count; looper++)//Insert Into RenewalOut Table { htRenewalOUT = new Hashtable(); htRenewalOUT.Add("REG_BK", unitRegObj.FundCode.ToString().ToUpper()); htRenewalOUT.Add("REG_BR", unitRegObj.BranchCode.ToString()); htRenewalOUT.Add("REG_NO", Convert.ToInt32(unitRegObj.RegNumber.ToString())); htRenewalOUT.Add("REN_NO", renwalObj.RenewalNo.ToString()); htRenewalOUT.Add("CERT_TYPE", dtDinomination.Rows[looper]["dino"].ToString().ToUpper()); htRenewalOUT.Add("CERT_NO", Convert.ToInt32(dtDinomination.Rows[looper]["cert_no"].ToString())); htRenewalOUT.Add("CERTIFICATE", SaleCertNo(Convert.ToInt32(dtDinomination.Rows[looper]["cert_no"].ToString()), dtDinomination.Rows[looper]["dino"].ToString().ToUpper())); htRenewalOUT.Add("QTY", Convert.ToInt32(dtDinomination.Rows[looper]["cert_weight"].ToString())); commonGatewayObj.Insert(htRenewalOUT, "RENEWAL_OUT"); } commonGatewayObj.CommitTransaction(); } catch (Exception ex) { commonGatewayObj.RollbackTransaction(); throw ex; } }
public void saveTransfer(DataTable dtTransferSaleCert, UnitHolderRegistration regObj, UnitTransfer transferObj, UnitUser unitUserObj) { try { commonGatewayObj.BeginTransaction(); Hashtable htTransferRegInfo = new Hashtable(); Hashtable htTransCertNoTemp = new Hashtable(); int SL_TR_RN = 0; int CertNo = 0; string certType = ""; string[] saleNoArray; string[] certArray; string statusFlag = "T"; string Old_SL_TR_RN = ""; for (int loop = 0; loop < dtTransferSaleCert.Rows.Count; loop++) { if (dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().ToUpper().IndexOf('S') >= 0) { htTransferRegInfo = new Hashtable(); htTransferRegInfo.Add("CURR_REG_BK", regObj.FundCode.ToString().ToUpper()); htTransferRegInfo.Add("CURR_REG_BR", transferObj.TfereeBranchCode.ToString().ToUpper()); htTransferRegInfo.Add("CURR_REG_NO", transferObj.TransfereeRegNo.ToString()); htTransferRegInfo.Add("STATUS_FLAG", statusFlag.ToUpper().ToString()); saleNoArray = dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().Split('S'); SL_TR_RN = Convert.ToInt32(saleNoArray[1].ToString()); certArray = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-'); CertNo = Convert.ToInt32(certArray[1].ToString()); certType = certArray[0].ToString().ToUpper(); commonGatewayObj.Update(htTransferRegInfo, "SALE_CERT", "REG_NO=" + Convert.ToInt32(regObj.RegNumber) + " AND REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "' AND SL_NO=" + SL_TR_RN + " AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'"); Old_SL_TR_RN = "S" + SL_TR_RN.ToString(); } else if (dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().ToUpper().IndexOf('T') >= 0) { htTransferRegInfo = new Hashtable(); htTransferRegInfo.Add("CURR_REG_BK", regObj.FundCode.ToString()); htTransferRegInfo.Add("CURR_REG_BR", transferObj.TfereeBranchCode.ToString().ToUpper()); htTransferRegInfo.Add("CURR_REG_NO", transferObj.TransfereeRegNo.ToString()); htTransferRegInfo.Add("STATUS_FLAG", statusFlag.ToUpper().ToString()); saleNoArray = dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().Split('T'); SL_TR_RN = Convert.ToInt32(saleNoArray[1].ToString()); certArray = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-'); CertNo = Convert.ToInt32(certArray[1].ToString()); certType = certArray[0].ToString().ToUpper(); commonGatewayObj.Update(htTransferRegInfo, "TRANS_CERT", "F_CD='" + regObj.FundCode.ToString().ToUpper() + "' AND TR_NO=" + SL_TR_RN + " AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'"); commonGatewayObj.Update(htTransferRegInfo, "SALE_CERT", "REG_NO=" + Convert.ToInt32(regObj.RegNumber) + " AND REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "' AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'"); commonGatewayObj.Update(htTransferRegInfo, "RENEWAL_OUT", "REG_NO=" + Convert.ToInt32(regObj.RegNumber) + " AND REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "' AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'"); Old_SL_TR_RN = "T" + SL_TR_RN.ToString(); } else if (dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().ToUpper().IndexOf('R') >= 0) { htTransferRegInfo = new Hashtable(); htTransferRegInfo.Add("CURR_REG_BK", regObj.FundCode.ToString().ToUpper()); htTransferRegInfo.Add("CURR_REG_BR", transferObj.TfereeBranchCode.ToString().ToUpper()); htTransferRegInfo.Add("CURR_REG_NO", transferObj.TransfereeRegNo.ToString()); htTransferRegInfo.Add("STATUS_FLAG", statusFlag.ToUpper().ToString()); saleNoArray = dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().Split('R'); SL_TR_RN = Convert.ToInt32(saleNoArray[1].ToString()); certArray = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-'); CertNo = Convert.ToInt32(certArray[1].ToString()); certType = certArray[0].ToString().ToUpper(); commonGatewayObj.Update(htTransferRegInfo, "RENEWAL_OUT", "REG_NO=" + Convert.ToInt32(regObj.RegNumber) + " AND REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "' AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'"); Old_SL_TR_RN = "R" + SL_TR_RN.ToString(); } htTransferRegInfo = new Hashtable(); htTransferRegInfo.Add("F_CD", regObj.FundCode.ToString().ToUpper()); htTransferRegInfo.Add("BR_CODE", regObj.FundCode.ToString().ToUpper() + "_" + transferObj.TfereeBranchCode.ToString().ToUpper()); htTransferRegInfo.Add("TR_NO", Convert.ToInt32(transferObj.TransferNo.ToString())); certArray = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-'); htTransferRegInfo.Add("CERT_TYPE", certArray[0].ToString().ToUpper()); htTransferRegInfo.Add("CERT_NO", Convert.ToInt32(certArray[1].ToString())); htTransferRegInfo.Add("CERTIFICATE", dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().ToUpper()); htTransferRegInfo.Add("QTY", Convert.ToInt32(dtTransferSaleCert.Rows[loop]["QTY"].ToString())); htTransferRegInfo.Add("CURR_REG_BK", regObj.FundCode.ToString().ToUpper()); htTransferRegInfo.Add("CURR_REG_BR", transferObj.TfereeBranchCode.ToString().ToUpper()); htTransferRegInfo.Add("CURR_REG_NO", Convert.ToInt32(transferObj.TransfereeRegNo.ToString())); htTransferRegInfo.Add("OLD_SL_TR_NO", Old_SL_TR_RN.ToString().ToUpper()); commonGatewayObj.Insert(htTransferRegInfo, "TRANS_CERT"); } DataTable dtTransfer = dtTrnasfer(dtTransferSaleCert); for (int i = 0; i < dtTransfer.Rows.Count; i++) { //htTransCertNoTemp = new Hashtable(); //htTransCertNoTemp.Add("F_CD", regObj.FundCode.ToString().ToUpper()); //htTransCertNoTemp.Add("BR_CODE", regObj.FundCode.ToString().ToUpper() + "_" + transferObj.TfereeBranchCode.ToString().ToUpper()); //htTransCertNoTemp.Add("TR_NO", Convert.ToInt32(transferObj.TransferNo.ToString())); //htTransCertNoTemp.Add("CERTIFICATE", dtTransfer.Rows[i]["CERTIFICATE"].ToString()); //htTransCertNoTemp.Add("OLD_SL_TR_NO", dtTransfer.Rows[i]["SL_NO"].ToString()); // commonGatewayObj.Insert(htTransCertNoTemp, "TRANS_CERT_NO_TEMP"); htTransferRegInfo = new Hashtable(); htTransferRegInfo.Add("F_CD", regObj.FundCode.ToString().ToUpper()); htTransferRegInfo.Add("BR_CODE", regObj.FundCode.ToString().ToUpper() + "_" + transferObj.TfereeBranchCode.ToString().ToUpper()); htTransferRegInfo.Add("TR_NO", Convert.ToInt32(transferObj.TransferNo.ToString())); htTransferRegInfo.Add("TR_DT", Convert.ToDateTime(transferObj.TransferDate.ToString()).ToString("dd-MMM-yyyy")); htTransferRegInfo.Add("REG_BK_O", regObj.FundCode.ToString().ToUpper()); htTransferRegInfo.Add("REG_BR_O", transferObj.TferorBranchCode.ToString().ToUpper()); htTransferRegInfo.Add("REG_NO_O", Convert.ToInt32(transferObj.TransferorRegNo.ToString())); htTransferRegInfo.Add("QTY", Convert.ToInt32(dtTransfer.Rows[i]["QTY"].ToString())); htTransferRegInfo.Add("REG_BK_I", regObj.FundCode.ToString().ToUpper()); htTransferRegInfo.Add("REG_BR_I", transferObj.TfereeBranchCode.ToString().ToUpper()); htTransferRegInfo.Add("REG_NO_I", Convert.ToInt32(transferObj.TransfereeRegNo.ToString())); htTransferRegInfo.Add("USER_NM", unitUserObj.UserID.ToString()); htTransferRegInfo.Add("ENT_DT", DateTime.Now.ToString()); htTransferRegInfo.Add("ENT_TM", DateTime.Now.ToShortTimeString().ToString()); htTransferRegInfo.Add("OLD_SL_TR_NO", dtTransfer.Rows[i]["SL_NO"].ToString()); commonGatewayObj.Insert(htTransferRegInfo, "TRANSFER"); } 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(); 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); } }
public void saveRepurchase(DataTable dtTransferSaleCert, UnitHolderRegistration regObj, UnitRepurchase repObj, UnitUser unitUserObj) { try { UnitTransferBL unitTransferBLObj = new UnitTransferBL(); commonGatewayObj.BeginTransaction(); Hashtable htRepurchaseRegInfo = new Hashtable(); Hashtable htCertNoTemp = new Hashtable(); int SL_TR_RN = 0; int CertNo = 0; string certType = ""; string[] saleNoArray; string[] certArray; string statusFlag = "R"; string Old_SL_TR_RN = ""; for (int loop = 0; loop < dtTransferSaleCert.Rows.Count; loop++) { if (dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().ToUpper().IndexOf('S') >= 0) { htRepurchaseRegInfo = new Hashtable(); htRepurchaseRegInfo.Add("CURR_REG_BK", regObj.FundCode.ToString().ToUpper()); htRepurchaseRegInfo.Add("CURR_REG_BR", regObj.BranchCode.ToString().ToUpper()); htRepurchaseRegInfo.Add("CURR_REG_NO", regObj.RegNumber.ToString()); htRepurchaseRegInfo.Add("STATUS_FLAG", statusFlag.ToUpper().ToString()); saleNoArray = dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().Split('S'); SL_TR_RN = Convert.ToInt32(saleNoArray[1].ToString()); certArray = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-'); CertNo = Convert.ToInt32(certArray[1].ToString()); certType = certArray[0].ToString().ToUpper(); commonGatewayObj.Update(htRepurchaseRegInfo, "SALE_CERT", "REG_NO=" + Convert.ToInt32(regObj.RegNumber) + " AND REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "' AND SL_NO=" + SL_TR_RN + " AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'"); Old_SL_TR_RN = "S" + SL_TR_RN.ToString(); } else if (dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().ToUpper().IndexOf('T') >= 0) { htRepurchaseRegInfo = new Hashtable(); htRepurchaseRegInfo.Add("CURR_REG_BK", regObj.FundCode.ToString().ToUpper()); htRepurchaseRegInfo.Add("CURR_REG_BR", regObj.BranchCode.ToString().ToUpper()); htRepurchaseRegInfo.Add("CURR_REG_NO", regObj.RegNumber.ToString()); htRepurchaseRegInfo.Add("STATUS_FLAG", statusFlag.ToUpper().ToString()); saleNoArray = dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().Split('T'); SL_TR_RN = Convert.ToInt32(saleNoArray[1].ToString()); certArray = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-'); CertNo = Convert.ToInt32(certArray[1].ToString()); certType = certArray[0].ToString().ToUpper(); commonGatewayObj.Update(htRepurchaseRegInfo, "TRANS_CERT", "F_CD='" + regObj.FundCode.ToString().ToUpper() + "' AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'"); commonGatewayObj.Update(htRepurchaseRegInfo, "SALE_CERT", "REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "' AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'"); commonGatewayObj.Update(htRepurchaseRegInfo, "RENEWAL_OUT", "REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "' AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'"); Old_SL_TR_RN = "T" + SL_TR_RN.ToString(); } else if (dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().ToUpper().IndexOf('R') >= 0) { htRepurchaseRegInfo = new Hashtable(); htRepurchaseRegInfo.Add("CURR_REG_BK", regObj.FundCode.ToString().ToUpper()); htRepurchaseRegInfo.Add("CURR_REG_BR", regObj.BranchCode.ToString().ToUpper()); htRepurchaseRegInfo.Add("CURR_REG_NO", regObj.RegNumber.ToString()); htRepurchaseRegInfo.Add("STATUS_FLAG", statusFlag.ToUpper().ToString()); saleNoArray = dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().Split('R'); SL_TR_RN = Convert.ToInt32(saleNoArray[1].ToString()); certArray = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-'); CertNo = Convert.ToInt32(certArray[1].ToString()); certType = certArray[0].ToString().ToUpper(); commonGatewayObj.Update(htRepurchaseRegInfo, "RENEWAL_OUT", "REG_NO=" + Convert.ToInt32(regObj.RegNumber) + " AND REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "' AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'"); Old_SL_TR_RN = "R" + SL_TR_RN.ToString(); } htRepurchaseRegInfo = new Hashtable(); htRepurchaseRegInfo.Add("REG_BK", regObj.FundCode.ToString().ToUpper()); htRepurchaseRegInfo.Add("REG_BR", regObj.BranchCode.ToString().ToUpper()); htRepurchaseRegInfo.Add("REP_NO", Convert.ToInt32(repObj.RepurchaseNo.ToString())); htRepurchaseRegInfo.Add("REG_NO", Convert.ToInt32(regObj.RegNumber.ToString())); certArray = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-'); htRepurchaseRegInfo.Add("CERT_TYPE", certArray[0].ToString().ToUpper()); htRepurchaseRegInfo.Add("CERT_NO", Convert.ToInt32(certArray[1].ToString())); htRepurchaseRegInfo.Add("CERTIFICATE", dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().ToUpper()); htRepurchaseRegInfo.Add("QTY", Convert.ToInt32(dtTransferSaleCert.Rows[loop]["QTY"].ToString())); htRepurchaseRegInfo.Add("SL_TR_NO", Old_SL_TR_RN.ToString().ToUpper()); commonGatewayObj.Insert(htRepurchaseRegInfo, "REP_CERT_NO"); } DataTable dtTransfer = unitTransferBLObj.dtTrnasfer(dtTransferSaleCert); for (int i = 0; i < dtTransfer.Rows.Count; i++) { htRepurchaseRegInfo = new Hashtable(); htRepurchaseRegInfo.Add("REP_NO", Convert.ToInt32(repObj.RepurchaseNo.ToString())); htRepurchaseRegInfo.Add("REP_DT", Convert.ToDateTime(repObj.RepurchaseDate.ToString()).ToString("dd-MMM-yyyy")); htRepurchaseRegInfo.Add("SL_TR_NO", dtTransfer.Rows[i]["SL_NO"].ToString()); htRepurchaseRegInfo.Add("REG_BK", regObj.FundCode.ToString().ToUpper()); htRepurchaseRegInfo.Add("REG_BR", regObj.BranchCode.ToString().ToUpper()); htRepurchaseRegInfo.Add("REG_NO", regObj.RegNumber.ToString()); htRepurchaseRegInfo.Add("REP_PRICE", decimal.Parse(repObj.RepurchaseRate.ToString())); htRepurchaseRegInfo.Add("QTY", Convert.ToInt32(dtTransfer.Rows[i]["QTY"].ToString())); htRepurchaseRegInfo.Add("PAY_TYPE", repObj.PayType.ToString().ToUpper()); htRepurchaseRegInfo.Add("USER_NM", unitUserObj.UserID.ToString()); htRepurchaseRegInfo.Add("ENT_DT", DateTime.Now.ToString()); htRepurchaseRegInfo.Add("ENT_TM", DateTime.Now.ToShortTimeString().ToString()); if (repObj.ChequeIssueTo == null) { htRepurchaseRegInfo.Add("CHQ_ISSUE_TO", DBNull.Value); } else { htRepurchaseRegInfo.Add("CHQ_ISSUE_TO", repObj.ChequeIssueTo.ToString()); } commonGatewayObj.Insert(htRepurchaseRegInfo, "REPURCHASE"); } commonGatewayObj.CommitTransaction(); } catch (Exception ex) { commonGatewayObj.RollbackTransaction(); throw ex; } }
protected void updateButton_Click(object sender, EventArgs e) { Hashtable httable = new Hashtable(); httable.Add("comp_cd", Convert.ToInt16(companyCodeTextBox.Text)); httable.Add("fy", financialYearTextBox.Text.ToString()); if (!recordDateTextBox.Text.Equals("")) { httable.Add("RECORD_DT", Convert.ToDateTime(recordDateTextBox.Text.ToString()).ToString("dd-MMM-yyyy")); } else { httable.Add("RECORD_DT", DBNull.Value); } if (!bookToTextBox.Text.Equals("")) { httable.Add("BOOK_TO", Convert.ToDateTime(bookToTextBox.Text.ToString()).ToString("dd-MMM-yyyy")); } else { httable.Add("BOOK_TO", DBNull.Value); } if (!stockTextBox.Text.Equals("")) { httable.Add("BONUS", Convert.ToDecimal(stockTextBox.Text)); } else { httable.Add("BONUS", DBNull.Value); } if (!rightApprovalDateTextBox.Text.Equals("")) { httable.Add("RIGHT_APPR_DT", Convert.ToDateTime(rightApprovalDateTextBox.Text.ToString()).ToString("dd-MMM-yyyy")); } else { httable.Add("RIGHT_APPR_DT", DBNull.Value); } if (!rightTextBox.Text.Equals("")) { httable.Add("RIGHT", Convert.ToDecimal(rightTextBox.Text)); } else { httable.Add("RIGHT", DBNull.Value); } if (!cashTextBox.Text.Equals("")) { httable.Add("CASH", Convert.ToDecimal(cashTextBox.Text)); } else { httable.Add("CASH", DBNull.Value); } if (!agmDateTextBox.Text.Equals("")) { httable.Add("AGM", Convert.ToDateTime(agmDateTextBox.Text.ToString()).ToString("dd-MMM-yyyy")); } else { httable.Add("AGM", DBNull.Value); } if (!remarksTextBox.Text.Equals("")) { httable.Add("REMARKS", remarksTextBox.Text.ToString()); } else { httable.Add("REMARKS", null); } if (!postedTextBox.Text.Equals("")) { httable.Add("POSTED", postedTextBox.Text.ToString()); } else { httable.Add("POSTED", null); } if (!postedDateTextBox.Text.Equals("")) { httable.Add("PDATE", Convert.ToDateTime(postedDateTextBox.Text.ToString()).ToString("dd-MMM-yyyy")); } else { httable.Add("PDATE", DBNull.Value); } commonGatewayObj.Update(httable, "book_cl", "comp_cd = " + companyCodeTextBox.Text + "and fy = '" + financialYearTextBox.Text.ToString() + "'"); ClearFields(); //ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('Data Updated Successfully');", true); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Data Updated Successfully.');", 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 PrintButton_Click(object sender, EventArgs e) { string certType = ""; int lineNumber = 0; if (SaleNoRadioButton.Checked) { certType = "SALE"; } else if (RenNoRadioButton.Checked) { certType = "RENE"; } else if (TrNoRadioButton.Checked) { certType = "TRAN"; lineNumber = Convert.ToInt16(LineNoTextBox.Text.ToString().Trim()); } DataTable dtSaleCertPrintReport = (DataTable)Session["dtHolderInfo"]; if (dtSaleCertPrintReport.Rows.Count > 0) { Hashtable htPrint = new Hashtable(); htPrint.Add("CERT_PRINT_BY", userObj.UserID.ToString()); htPrint.Add("CERT_PRINT_TIME", DateTime.Now); if (certType == "SALE") { commonGatewayObj.CommitTransaction(); commonGatewayObj.Update(htPrint, "SALE", "REG_BK='" + fundCode + "' AND REG_BR='" + branchCode + "' AND SL_NO=" + Convert.ToInt32(SaleNoTextBox.Text.Trim().ToString())); commonGatewayObj.CommitTransaction(); } else if (certType == "RENE") { commonGatewayObj.CommitTransaction(); commonGatewayObj.Update(htPrint, "RENEWAL", "REG_BK='" + fundCode + "' AND REG_BR='" + branchCode + "' AND REN_NO='" + RenNoTextBox.Text.Trim().ToString() + "'"); commonGatewayObj.CommitTransaction(); } if (certType == "TRAN") { Session["lineNumber"] = lineNumber; Session["dtSaleCertPrintReport"] = dtSaleCertPrintReport; Session["certType"] = certType; ClientScript.RegisterStartupScript(this.GetType(), "TransferCert", "window.open('ReportViewer/UnitTransCertPrintReportViewer.aspx')", true); } else { if (dtSaleCertPrintReport.Rows[0]["ID_FLAG"].ToString().ToUpper().ToString() == "Y" && certType.ToUpper().ToString() == "SALE") { if (dtSaleCertPrintReport.Rows[0]["ID_AC"].Equals(DBNull.Value) || dtSaleCertPrintReport.Rows[0]["ID_BK_NM_CD"].Equals(DBNull.Value) || dtSaleCertPrintReport.Rows[0]["ID_BK_BR_NM_CD"].Equals(DBNull.Value)) { ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('Please Update ID Account Information');", true); } else { Session["dtSaleCertPrintReport"] = dtSaleCertPrintReport; Session["certType"] = certType; Session["lineNumber"] = lineNumber; ClientScript.RegisterStartupScript(this.GetType(), "DividendWarrant", "window.open('ReportViewer/UnitSaleCertPrintReportViewer.aspx')", true); } } else { Session["dtSaleCertPrintReport"] = dtSaleCertPrintReport; Session["certType"] = certType; Session["lineNumber"] = lineNumber; ClientScript.RegisterStartupScript(this.GetType(), "DividendWarrant", "window.open('ReportViewer/UnitSaleCertPrintReportViewer.aspx')", true); } } } else { Session["dtSaleCertPrintReport"] = null; Session["certType"] = null; Session["lineNumber"] = null; ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('No Data Found');", 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(); 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 updateButton_Click(object sender, EventArgs e) { string LoginID = Session["UserID"].ToString(); string LoginName = Session["UserName"].ToString().ToUpper(); Hashtable httable = new Hashtable(); httable.Add("COMP_CD", Convert.ToInt16(companyNameDropDownList.SelectedValue)); if (!sectorDropDownList.SelectedValue.Equals("0")) { httable.Add("SECTOR_CD", Convert.ToInt16(sectorDropDownList.SelectedValue)); } if (!lastYearEndTextBox.Text.Equals("")) { httable.Add("FINANCIAL_YEAR", Convert.ToString(lastYearEndTextBox.Text)); } else { httable.Add("FINANCIAL_YEAR", null); } if (!authorizedCapitalTextBox.Text.Equals("")) { httable.Add("AUTHO_CAP", Convert.ToDecimal(authorizedCapitalTextBox.Text)); } else { httable.Add("AUTHO_CAP", DBNull.Value); } if (!paidupCapitalTextBox.Text.Equals("")) { httable.Add("PAIDUP_CAP", Convert.ToDecimal(paidupCapitalTextBox.Text)); } else { httable.Add("PAIDUP_CAP", DBNull.Value); } if (!reserveAndSurplusTextBox.Text.Equals("")) { httable.Add("RESERVE_SURPLUS", Convert.ToDecimal(reserveAndSurplusTextBox.Text)); } else { httable.Add("RESERVE_SURPLUS", DBNull.Value); } if (!faceValueTextBox.Text.Equals("")) { httable.Add("FACE_VAL", Convert.ToDecimal(faceValueTextBox.Text)); } else { httable.Add("FACE_VAL", DBNull.Value); } if (!totalNoOfSecuritiesTextBox.Text.Equals("")) { httable.Add("TOTAL_NO_SHARES", Convert.ToDecimal(totalNoOfSecuritiesTextBox.Text)); } else { httable.Add("TOTAL_NO_SHARES", DBNull.Value); } if (!marketLotTextBox.Text.Equals("")) { httable.Add("MARKET_LOT", Convert.ToDecimal(marketLotTextBox.Text)); } else { httable.Add("MARKET_LOT", DBNull.Value); } if (!marketCategoryDropDownList.SelectedValue.Equals("0")) { httable.Add("MARKET_CATEGORY", Convert.ToChar(marketCategoryDropDownList.SelectedValue)); } if (!electronicShareDropDownList.SelectedValue.Equals("0")) { httable.Add("ELECTRONIC_SHARE", Convert.ToChar(electronicShareDropDownList.SelectedValue)); } if (!firstQuarterEpsTextBox.Text.Equals("")) { httable.Add("Q1_EPS", Convert.ToDecimal(firstQuarterEpsTextBox.Text)); } else { httable.Add("Q1_EPS", DBNull.Value); } if (!secondQuarterTextBox.Text.Equals("")) { httable.Add("Q2_EPS", Convert.ToDecimal(secondQuarterTextBox.Text)); } else { httable.Add("Q2_EPS", DBNull.Value); } if (!thirdQuarterTextBox.Text.Equals("")) { httable.Add("Q3_EPS", Convert.ToDecimal(thirdQuarterTextBox.Text)); } else { httable.Add("Q3_EPS", DBNull.Value); } if (!fourthQuarterTextBox.Text.Equals("")) { httable.Add("Q4_EPS", Convert.ToDecimal(fourthQuarterTextBox.Text)); } else { httable.Add("Q4_EPS", DBNull.Value); } if (!navTextBox.Text.Equals("")) { httable.Add("NAV", Convert.ToDecimal(navTextBox.Text)); } else { httable.Add("NAV", DBNull.Value); } if (!stockDividendTextBox.Text.Equals("")) { httable.Add("STOCK_DIVIDEND", Convert.ToDecimal(stockDividendTextBox.Text)); } else { httable.Add("STOCK_DIVIDEND", DBNull.Value); } if (!cashDividendTextBox.Text.Equals("")) { httable.Add("CASH_DIVIDEND", Convert.ToDecimal(cashDividendTextBox.Text)); } else { httable.Add("CASH_DIVIDEND", DBNull.Value); } if (!recordDateFromTextBox.Text.Equals("")) { httable.Add("RECORD_DATE_FROM", Convert.ToDateTime(recordDateFromTextBox.Text.ToString()).ToString("dd-MMM-yyyy")); } else { httable.Add("RECORD_DATE_FROM", DBNull.Value); } if (!recordDateToTextBox.Text.Equals("")) { httable.Add("RECORD_DATE_TO", Convert.ToDateTime(recordDateToTextBox.Text.ToString()).ToString("dd-MMM-yyyy")); } else { httable.Add("RECORD_DATE_TO", DBNull.Value); } if (!agmDateTextBox.Text.Equals("")) { httable.Add("AGM_DATE", Convert.ToDateTime(agmDateTextBox.Text.ToString()).ToString("dd-MMM-yyyy")); } else { httable.Add("AGM_DATE", DBNull.Value); } if (!rightShareTextBox.Text.Equals("")) { httable.Add("RIGHT_SHARE", Convert.ToDecimal(rightShareTextBox.Text)); } else { httable.Add("RIGHT_SHARE", DBNull.Value); } if (!rightApprovalDateTextBox.Text.Equals("")) { httable.Add("RIGHT_APPROVAL_DATE", Convert.ToDateTime(rightApprovalDateTextBox.Text.ToString()).ToString("dd-MMM-yyyy")); } else { httable.Add("RIGHT_APPROVAL_DATE", DBNull.Value); } if (!rightRecordDateFromTextBox.Text.Equals("")) { httable.Add("RIGHT_RECORD_DATE_FROM", Convert.ToDateTime(rightRecordDateFromTextBox.Text.ToString()).ToString("dd-MMM-yyyy")); } else { httable.Add("RIGHT_RECORD_DATE_FROM", DBNull.Value); } if (!rightRecordDateToTextBox.Text.Equals("")) { httable.Add("RIGHT_RECORD_DATE_TO", Convert.ToDateTime(rightRecordDateToTextBox.Text.ToString()).ToString("dd-MMM-yyyy")); } else { httable.Add("RIGHT_RECORD_DATE_TO", DBNull.Value); } if (!cashEpsTextBox.Text.Equals("")) { httable.Add("CASH_EPS", Convert.ToDecimal(cashEpsTextBox.Text)); } else { httable.Add("CASH_EPS", DBNull.Value); } if (!interimStockDividendTextBox.Text.Equals("")) { httable.Add("INTERIM_STOCK_DIVIDEND", Convert.ToDecimal(interimStockDividendTextBox.Text)); } else { httable.Add("INTERIM_STOCK_DIVIDEND", DBNull.Value); } if (!interimCashDividendTextBox.Text.Equals("")) { httable.Add("INTERIM_CASH_DIVIDEND", Convert.ToDecimal(interimCashDividendTextBox.Text)); } else { httable.Add("INTERIM_CASH_DIVIDEND", DBNull.Value); } if (!interimRecordDateFromTextBox.Text.Equals("")) { httable.Add("INTERIM_RECORD_DATE_FROM", Convert.ToDateTime(interimRecordDateFromTextBox.Text.ToString()).ToString("dd-MMM-yyyy")); } else { httable.Add("INTERIM_RECORD_DATE_FROM", DBNull.Value); } if (!interimRecordDateToTextBox.Text.Equals("")) { httable.Add("INTERIM_RECORD_DATE_TO", Convert.ToDateTime(interimRecordDateToTextBox.Text.ToString()).ToString("dd-MMM-yyyy")); } else { httable.Add("INTERIM_RECORD_DATE_TO", DBNull.Value); } if (!shareOfDirectorTextBox.Text.Equals("")) { httable.Add("SHARE_HOLDER_DIR", Convert.ToDecimal(shareOfDirectorTextBox.Text)); } else { httable.Add("SHARE_HOLDER_DIR", DBNull.Value); } if (!shareOfPublicTextBox.Text.Equals("")) { httable.Add("SHARE_HOLDER_PUB", Convert.ToDecimal(shareOfPublicTextBox.Text)); } else { httable.Add("SHARE_HOLDER_PUB", DBNull.Value); } if (!shareOfGovtTextBox.Text.Equals("")) { httable.Add("SHARE_HOLDER_GOVT", Convert.ToDecimal(shareOfGovtTextBox.Text)); } else { httable.Add("SHARE_HOLDER_GOVT", DBNull.Value); } if (!shareOfForeignTextBox.Text.Equals("")) { httable.Add("SHARE_HOLDER_FOREIGN", Convert.ToDecimal(shareOfForeignTextBox.Text)); } else { httable.Add("SHARE_HOLDER_FOREIGN", DBNull.Value); } if (!shareOfInstitutionTextBox.Text.Equals("")) { httable.Add("SHARE_HOLDER_INSTITUTION", Convert.ToDecimal(shareOfInstitutionTextBox.Text)); } else { httable.Add("SHARE_HOLDER_INSTITUTION", DBNull.Value); } if (!percentageGrothEpsTextBox.Text.Equals("")) { httable.Add("PERCENTAGE_GROTH_EPS", Convert.ToDecimal(percentageGrothEpsTextBox.Text)); } else { httable.Add("PERCENTAGE_GROTH_EPS", DBNull.Value); } if (!percentageGrothCashEpsTextBox.Text.Equals("")) { httable.Add("PERCENTAGE_GROTH_CASH_EPS", Convert.ToDecimal(percentageGrothCashEpsTextBox.Text)); } else { httable.Add("PERCENTAGE_GROTH_CASH_EPS", DBNull.Value); } if (!netProfitTextBox.Text.Equals("")) { httable.Add("NET_PROFIT", Convert.ToDecimal(netProfitTextBox.Text)); } else { httable.Add("NET_PROFIT", DBNull.Value); } if (!totalEquityTextBox.Text.Equals("")) { httable.Add("TOTAL_EQUITY", Convert.ToDecimal(totalEquityTextBox.Text)); } else { httable.Add("TOTAL_EQUITY", DBNull.Value); } if (!longTermDebtTextBox.Text.Equals("")) { httable.Add("LONG_TERM_DEBT", Convert.ToDecimal(longTermDebtTextBox.Text)); } else { httable.Add("LONG_TERM_DEBT", DBNull.Value); } httable.Add("UPDATE_DATE", DateTime.Now); httable.Add("UPDATE_BY", LoginID); commonGatewayObj.Update(httable, "ANALYSIS_MST1", "comp_cd = " + companyNameDropDownList.SelectedValue); ClearFields(); ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('Data Updated Successfully');", true); }
protected void SubmitButton_Click(object sender, EventArgs e) { Hashtable htUpdate = new Hashtable(); try { bool isDupliacteDRFolioNo = unitSaleBLObj.CheckDuplicateSaleRelatedInfo(" AND SALE.REG_BK='" + fundCode + "' AND SALE.DRF_REG_FOLIO_NO='" + RegFolioNoTextBox.Text + "'"); bool isDupliacteDRCertNo = unitSaleBLObj.CheckDuplicateSaleRelatedInfo(" AND SALE.REG_BK='" + fundCode + "' AND SALE.DRF_CERT_NO ='" + CertNoTextBox.Text + "'"); bool isDupliacteDRDistinctiveNo = unitSaleBLObj.CheckDuplicateSaleRelatedInfo("AND ((SALE.DRF_DISTNCT_NO_FROM BETWEEN " + DistinctNoFromTextBox.Text.Trim().ToString() + " AND " + DistinctNoToTextBox.Text.Trim().ToString() + ") AND (SALE.REG_BK = '" + fundCode + "') OR (SALE.DRF_DISTNCT_NO_TO BETWEEN " + DistinctNoFromTextBox.Text.Trim().ToString() + " AND " + DistinctNoToTextBox.Text.Trim().ToString() + ") AND (SALE.REG_BK = '" + fundCode + "'))"); if (isDupliacteDRFolioNo) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to Duplicate Folio number');", true); } else if (isDupliacteDRCertNo) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to Duplicate Certificate number');", true); } else if (isDupliacteDRDistinctiveNo) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to Duplicate Distinctive number');", true); } else if (((Convert.ToInt64(DistinctNoToTextBox.Text.Trim().ToString()) - Convert.ToInt64(DistinctNoFromTextBox.Text.Trim().ToString()) + 1)) != Convert.ToInt64(TotalUnitsTextBox.Text.Trim().ToString())) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to Distinctive Range and Total Units is not Eqqaul');", true); } else { commonGatewayObj.BeginTransaction(); htUpdate = new Hashtable(); htUpdate.Add("DRF_CUST_REQ_BY", userObj.UserID.ToString()); htUpdate.Add("DRF_CUST_REQ_DATE", DateTime.Now); htUpdate.Add("DRF_REG_FOLIO_NO", RegFolioNoTextBox.Text.Trim().ToString()); htUpdate.Add("DRF_CERT_NO", CertNoTextBox.Text.Trim().ToString()); htUpdate.Add("DRF_DISTNCT_NO_FROM", DistinctNoFromTextBox.Text.Trim().ToString()); htUpdate.Add("DRF_DISTNCT_NO_TO", DistinctNoToTextBox.Text.Trim().ToString()); commonGatewayObj.Update(htUpdate, "SALE", "REG_BK='" + fundCode.ToUpper().ToString() + "' AND REG_BR='" + branchCode.ToUpper().ToString() + "' AND SALE.DRF_REF_NO=" + DRRefNoDropDownList.SelectedValue.ToString()); commonGatewayObj.CommitTransaction(); DRRefNoDropDownList.DataSource = unitSaleBLObj.dtDRRefNoListForCustodian("AND SALE.REG_BK='" + fundCode + "'"); DRRefNoDropDownList.DataTextField = "NAME"; DRRefNoDropDownList.DataValueField = "ID"; DRRefNoDropDownList.DataBind(); RegFolioNoTextBox.Text = ""; CertNoTextBox.Text = ""; DistinctNoFromTextBox.Text = ""; DistinctNoToTextBox.Text = ""; TotalUnitsTextBox.Text = ""; DataTable dtSaleInfoForDRF = unitSaleBLObj.dtGetSaleInfoForDemate(" AND SALE.REG_BK='" + fundCode + "' AND SALE.REG_BR='" + branchCode + "' AND SALE.DRF_REF_NO=0"); SaleListGridView.DataSource = dtSaleInfoForDRF; SaleListGridView.DataBind(); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save Successfully');", true); } } catch (Exception ex) { commonGatewayObj.RollbackTransaction(); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to Error:" + ex.Message.ToString() + "');", true); } }