public async Task <List <JournalVoucherDTO> > GetJournalVoucherData(string ConnectionString) { await Task.Run(() => { pJournalVoucherList = new List <JournalVoucherDTO>(); List <PaymentsDTO> pPaymentList = new List <PaymentsDTO>(); try { using (NpgsqlDataReader dr = NPGSqlHelper.ExecuteReader(ConnectionString, CommandType.Text, "select t1.recordid,to_char(jvdate,'DD-MM-YYYY')as jvdate,t1.jvnumber," + "sum(ledgeramount)as Amount,t1.narration from tbltransjournalvoucher t1 join tbltransjournalvoucherdetails t2 on t1.jvnumber=t2.jvnumber where jvdate=current_date " + "and t2.accounttranstype='D' group by t1.recordid,t1.jvdate,t1.jvnumber,t1.narration order by t1.recordid desc ")) { while (dr.Read()) { JournalVoucherDTO _journalVoucherDTO = new JournalVoucherDTO { pjvdate = Convert.ToString(dr["jvdate"]), pjvnumber = Convert.ToString(dr["jvnumber"]), ptotalpaidamount = Convert.ToDecimal(dr["Amount"]), pnarration = Convert.ToString(dr["narration"]) }; pJournalVoucherList.Add(_journalVoucherDTO); } } } catch (Exception ex) { throw ex; } }); return(pJournalVoucherList); }
public IActionResult SaveJournalVoucher(JournalVoucherDTO _JournalVoucherDTO) { bool isSaved = false; List <string> lstdata = new List <string>(); try { string OldFolder = "Upload"; string NewFolder = "Original"; string webRootPath = _hostingEnvironment.ContentRootPath; string OldPath = Path.Combine(webRootPath, OldFolder); string newPath = Path.Combine(webRootPath, NewFolder); if (!Directory.Exists(newPath)) { Directory.CreateDirectory(newPath); } if (!string.IsNullOrEmpty(_JournalVoucherDTO.pFilepath)) { string OldFullPath = Path.Combine(OldPath, _JournalVoucherDTO.pFilepath); string NewFullPath = Path.Combine(newPath, _JournalVoucherDTO.pFilepath); _JournalVoucherDTO.pFilepath = NewFullPath; if (System.IO.File.Exists(OldFullPath)) { System.IO.File.Move(OldFullPath, NewFullPath); } } string Jvnumber = string.Empty; isSaved = _AccountingTransactionsDAL.SaveJournalVoucher_All(_JournalVoucherDTO, Con, out Jvnumber); lstdata.Add(isSaved.ToString().ToUpper()); lstdata.Add(Jvnumber); return(Ok(lstdata)); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError)); throw new FinstaAppException(ex.ToString()); } }
private ISimpleRepo <JournalVoucherDTO> GetRepo(JournalVoucherDTO dto) => GetSoloShard(dto.TransactionDate);
public bool IsValidForDelete(JournalVoucherDTO r, out string whyInvalid) => GetRepo(r).IsValidForDelete(r, out whyInvalid);
public bool Delete(JournalVoucherDTO r) => GetRepo(r).Delete(r);
public bool Update(JournalVoucherDTO r) => GetRepo(r).Update(r);
public int Insert(JournalVoucherDTO r) => GetRepo(r).Insert(r);
public bool CallsaveGeneralReceipt(GeneralreceiptDTO GeneralreceiptDTO, NpgsqlTransaction trans, out string pGeneralReceiptId) { StringBuilder sbGeneralReceipt = new StringBuilder(); bool Savedstatus = false; long Debitaccountid = 0; string Maxreceiptid = string.Empty; try { // Generate Next Receipt Id if (string.IsNullOrEmpty(GeneralreceiptDTO.preceiptid)) { GeneralreceiptDTO.preceiptid = NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "SELECT FN_GENERATENEXTID('GENERAL VOUCHER','" + ManageQuote(GeneralreceiptDTO.pmodofreceipt).Trim().ToUpper() + "','" + FormatDate(GeneralreceiptDTO.preceiptdate) + "')").ToString(); } pGeneralReceiptId = GeneralreceiptDTO.preceiptid; if (string.IsNullOrEmpty(GeneralreceiptDTO.preceiptdate)) { GeneralreceiptDTO.preceiptdate = "null"; } else { //GeneralreceiptDTO.preceiptdate = "'" + FormatDate(GeneralreceiptDTO.preceiptdate) + "'"; // Not Formats date here due to dependency in JV Save GeneralreceiptDTO.preceiptdate = GeneralreceiptDTO.preceiptdate; } if (string.IsNullOrEmpty(GeneralreceiptDTO.pchequedate)) { GeneralreceiptDTO.pchequedate = "null"; } else { GeneralreceiptDTO.pchequedate = "'" + FormatDate(GeneralreceiptDTO.pchequedate) + "'"; } GeneralreceiptDTO.ptotalreceivedamount = Convert.ToString(GeneralreceiptDTO.ptotalreceivedamount) == string.Empty ? 0 : GeneralreceiptDTO.ptotalreceivedamount < 0 ? 0 : GeneralreceiptDTO.ptotalreceivedamount; if (GeneralreceiptDTO.pmodofreceipt.Trim().ToUpper() == "CASH") { Debitaccountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select accountid from tblmstaccounts where upper(accountname)='CASH ON HAND' and statusid=" + Convert.ToInt32(Status.Active) + ";")); } else if (GeneralreceiptDTO.pmodofreceipt.Trim().ToUpper() == "BANK" || GeneralreceiptDTO.pmodofreceipt.Trim().ToUpper() == "WALLET") { Debitaccountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select accountid from tblmstaccounts where upper(accountname)='UNCLEARED CHEQUES A/C' and statusid=" + Convert.ToInt32(Status.Active) + ";")); } if (string.IsNullOrEmpty(GeneralreceiptDTO.ptypeofpayment)) { GeneralreceiptDTO.ptypeofpayment = GeneralreceiptDTO.ptranstype; } long GeneralReceiptRecordid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "INSERT INTO tbltransgeneralreceipt(receiptid, receiptdate, totalreceivedamount,narration, debitaccountid,contactid,statusid,createdby,createddate,istdsapplicable, modeofreceipt,tdssection, pannumber, tdscalculationtype,tdspercentage, tdsamount,contactname,contactreftype,contactrefid,filename,filepath,fileformat) VALUES ('" + ManageQuote(GeneralreceiptDTO.preceiptid) + "', '" + FormatDate(GeneralreceiptDTO.preceiptdate) + "', " + GeneralreceiptDTO.ptotalreceivedamount + ", '" + ManageQuote(GeneralreceiptDTO.pnarration) + "', " + Debitaccountid + ", " + GeneralreceiptDTO.ppartyid + ", " + Convert.ToInt32(Status.Active) + ", " + GeneralreceiptDTO.pCreatedby + ", current_timestamp, " + GeneralreceiptDTO.pistdsapplicable + ", '" + ManageQuote(GeneralreceiptDTO.pmodofreceipt) + "', '" + ManageQuote(GeneralreceiptDTO.pTdsSection) + "', '" + ManageQuote(GeneralreceiptDTO.ppartypannumber) + "', '" + ManageQuote(GeneralreceiptDTO.ptdscalculationtype) + "'," + GeneralreceiptDTO.pTdsPercentage + ", " + GeneralreceiptDTO.ptdsamount + ",'" + ManageQuote(GeneralreceiptDTO.ppartyname) + "','" + ManageQuote(GeneralreceiptDTO.ppartyreftype) + "','" + ManageQuote(GeneralreceiptDTO.ppartyreferenceid) + "','" + ManageQuote(GeneralreceiptDTO.pFilename) + "','" + ManageQuote(GeneralreceiptDTO.pFilepath) + "','" + ManageQuote(GeneralreceiptDTO.pFileformat) + "') returning recordid;")); if (GeneralreceiptDTO.preceiptslist != null && GeneralreceiptDTO.preceiptslist.Count > 0) { for (int i = 0; i < GeneralreceiptDTO.preceiptslist.Count; i++) { if (GeneralreceiptDTO.pistdsapplicable && GeneralreceiptDTO.ptdsamount > 0) { if (GeneralreceiptDTO.ptdscalculationtype == "INCLUDE") { GeneralreceiptDTO.preceiptslist[i].ptdsamountindividual = Math.Round((GeneralreceiptDTO.preceiptslist[i].pamount * GeneralreceiptDTO.pTdsPercentage) / (100 + GeneralreceiptDTO.pTdsPercentage)); GeneralreceiptDTO.preceiptslist[i].pamount = GeneralreceiptDTO.preceiptslist[i].pamount - GeneralreceiptDTO.preceiptslist[i].ptdsamountindividual; } else if (GeneralreceiptDTO.ptdscalculationtype == "EXCLUDE") { GeneralreceiptDTO.preceiptslist[i].ptdsamountindividual = Math.Round((GeneralreceiptDTO.preceiptslist[i].pamount * GeneralreceiptDTO.pTdsPercentage) / 100); } } else { GeneralreceiptDTO.preceiptslist[i].ptdsamountindividual = 0; } if (!string.IsNullOrEmpty(GeneralreceiptDTO.preceiptslist[i].pState) && GeneralreceiptDTO.preceiptslist[i].pState.Contains('-')) { string[] Stateandgst = GeneralreceiptDTO.preceiptslist[i].pState.Split('-'); GeneralreceiptDTO.preceiptslist[i].pState = Stateandgst[0].Trim(); GeneralreceiptDTO.preceiptslist[i].pgstno = Stateandgst[1].Trim(); } sbGeneralReceipt.AppendLine("INSERT INTO tbltransgeneralreceiptdetails( detailsid, receiptid, creditaccountid, ledgeramount,gsttype, gstcalculationtype, gstpercentage, igstamount, cgstamount, sgstamount, utgstamount,gstnumber,stateid,statename,isgstapplicable,tdssection,tdspercentage,tdsamount) VALUES (" + GeneralReceiptRecordid + ", '" + ManageQuote(GeneralreceiptDTO.preceiptid) + "', " + GeneralreceiptDTO.preceiptslist[i].psubledgerid + ", " + GeneralreceiptDTO.preceiptslist[i].pamount + ", '" + ManageQuote(GeneralreceiptDTO.preceiptslist[i].pgsttype) + "', '" + ManageQuote(GeneralreceiptDTO.preceiptslist[i].pgstcalculationtype) + "', " + GeneralreceiptDTO.preceiptslist[i].pgstpercentage + ", " + GeneralreceiptDTO.preceiptslist[i].pigstamount + ", " + GeneralreceiptDTO.preceiptslist[i].pcgstamount + ", " + GeneralreceiptDTO.preceiptslist[i].psgstamount + ", " + GeneralreceiptDTO.preceiptslist[i].putgstamount + ",'" + ManageQuote(GeneralreceiptDTO.preceiptslist[i].pgstno) + "'," + GeneralreceiptDTO.preceiptslist[i].pStateId + ",'" + ManageQuote(GeneralreceiptDTO.preceiptslist[i].pState) + "'," + GeneralreceiptDTO.preceiptslist[i].IsGstapplicable + ",'" + ManageQuote(GeneralreceiptDTO.pTdsSection) + "'," + GeneralreceiptDTO.pTdsPercentage + "," + GeneralreceiptDTO.preceiptslist[i].ptdsamountindividual + ");"); } } string particulars = ""; if (GeneralreceiptDTO.preceiptslist.Count > 0) { particulars = GeneralreceiptDTO.preceiptslist[0].pledgername.ToUpper() + "(" + GeneralreceiptDTO.ppartyreferenceid + "_" + GeneralreceiptDTO.ppartyname.ToUpper() + ")"; } if (GeneralreceiptDTO.pmodofreceipt.Trim().ToUpper() != "CASH" && !string.IsNullOrEmpty(GeneralreceiptDTO.pmodofreceipt)) { sbGeneralReceipt.AppendLine("INSERT INTO tbltransreceiptreference( receiptid,bankname,branchname,transtype,typeofpayment,referencenumber,particulars,depositeddate,totalreceivedamount,depositstatus, clearstatus,statusid, createdby, createddate,cardnumber,cleardate,upiid,upiname,chequedate) VALUES ('" + ManageQuote(GeneralreceiptDTO.preceiptid) + "', '" + ManageQuote(GeneralreceiptDTO.pbankname).Trim().ToUpper() + "', '" + ManageQuote(GeneralreceiptDTO.pbranchname).Trim().ToUpper() + "', '" + ManageQuote(GeneralreceiptDTO.ptranstype).Trim().ToUpper() + "', '" + ManageQuote(GeneralreceiptDTO.ptypeofpayment).Trim().ToUpper() + "', '" + ManageQuote(GeneralreceiptDTO.pChequenumber).Trim().ToUpper() + "', '" + ManageQuote(particulars).Trim().ToUpper() + "', " + GeneralreceiptDTO.pchequedate + ", " + GeneralreceiptDTO.ptotalreceivedamount + ",'N', 'N', " + Convert.ToInt32(Status.Active) + "," + GeneralreceiptDTO.pCreatedby + ",current_timestamp,'" + ManageQuote(GeneralreceiptDTO.pCardNumber) + "'," + GeneralreceiptDTO.pchequedate + ",'" + ManageQuote(GeneralreceiptDTO.pUpiid) + "','" + ManageQuote(GeneralreceiptDTO.pUpiname).Trim().ToUpper() + "'," + GeneralreceiptDTO.pchequedate + ");"); } if (GeneralreceiptDTO.pmodofreceipt.Trim().ToUpper() == "CASH") { // JV Insert for Main Cash if (GeneralreceiptDTO.pistdsapplicable && GeneralreceiptDTO.ptdsamount > 0) { if (GeneralreceiptDTO.preceiptslist != null) { for (int i = 0; i < GeneralreceiptDTO.preceiptslist.Count; i++) { if (GeneralreceiptDTO.preceiptslist[i].ptdsamountindividual > 0) { objJournalVoucherDTO = new JournalVoucherDTO(); List <PaymentsDTO> _Paymentslist = new List <PaymentsDTO>(); objJournalVoucherDTO.pjvdate = GeneralreceiptDTO.preceiptdate; objJournalVoucherDTO.pnarration = "BEING JV PASSED TOWARDS TDS AMOUNT"; objJournalVoucherDTO.pmodoftransaction = "AUTO"; objJournalVoucherDTO.pCreatedby = GeneralreceiptDTO.pCreatedby; objPaymentsDTO = new PaymentsDTO { ppartyid = GeneralreceiptDTO.ppartyid, ppartyname = GeneralreceiptDTO.ppartyname, ppartyreferenceid = GeneralreceiptDTO.ppartyreferenceid, ppartyreftype = GeneralreceiptDTO.ppartyreftype, ptranstype = "D", psubledgerid = GeneralreceiptDTO.preceiptslist[i].psubledgerid, pamount = GeneralreceiptDTO.preceiptslist[i].ptdsamountindividual }; _Paymentslist.Add(objPaymentsDTO); objPaymentsDTO = new PaymentsDTO { ptranstype = "C", ppartyid = GeneralreceiptDTO.ppartyid, ppartyname = GeneralreceiptDTO.ppartyname, ppartyreferenceid = GeneralreceiptDTO.ppartyreferenceid, ppartyreftype = GeneralreceiptDTO.ppartyreftype }; long creditaccountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select accountid from tblmstaccounts where upper(accountname)='CURRENT ASSETS' and statusid=" + Convert.ToInt32(Status.Active) + ";")); creditaccountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select insertaccounts('TDS-" + GeneralreceiptDTO.pTdsSection + " RECEIVABLE'," + creditaccountid + ",'2'," + GeneralreceiptDTO.pCreatedby + ")")); creditaccountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select insertaccounts('" + GeneralreceiptDTO.ppartyreferenceid + "_" + GeneralreceiptDTO.ppartyname.ToUpper() + "'," + creditaccountid + ",'3'," + GeneralreceiptDTO.pCreatedby + ")")); objPaymentsDTO.psubledgerid = creditaccountid; objPaymentsDTO.pamount = GeneralreceiptDTO.preceiptslist[i].ptdsamountindividual; _Paymentslist.Add(objPaymentsDTO); objJournalVoucherDTO.pJournalVoucherlist = _Paymentslist; string refjvnumber = ""; SaveJournalVoucher(objJournalVoucherDTO, trans, out refjvnumber); sbGeneralReceipt.AppendLine("update tbltransgeneralreceiptdetails set tdsrefjvnumber='" + refjvnumber + "',tdsaccountid=" + creditaccountid + " where receiptid='" + ManageQuote(GeneralreceiptDTO.preceiptid) + "' and creditaccountid=" + GeneralreceiptDTO.preceiptslist[i].psubledgerid + ";"); } } } } } else if (GeneralreceiptDTO.pmodofreceipt.Trim().ToUpper() == "BANK" || GeneralreceiptDTO.pmodofreceipt.Trim().ToUpper() == "WALLET") { if (!string.IsNullOrEmpty(GeneralreceiptDTO.ptranstype) && !string.IsNullOrEmpty(GeneralreceiptDTO.ptypeofpayment)) { sbGeneralReceipt.Append(SaveGeneralReceiptTransactions(trans, GeneralreceiptDTO)); } } if (!string.IsNullOrEmpty(GeneralreceiptDTO.preceiptid)) { sbGeneralReceipt.AppendLine("SELECT fntotaltransactions('" + GeneralreceiptDTO.preceiptid + "','GENERAL RECEIPT');"); // sbGeneralReceipt.AppendLine("select accountsupdate();"); } if (Convert.ToString(sbGeneralReceipt) != string.Empty) { NPGSqlHelper.ExecuteNonQuery(trans, CommandType.Text, sbGeneralReceipt.ToString()); Savedstatus = true; } } catch (Exception ex) { trans.Rollback(); throw ex; } return(Savedstatus); }
public string SaveGeneralReceiptTransactions_chequesclear(NpgsqlTransaction trans, GeneralreceiptDTO modelGeneralReceipt) { StringBuilder Sbbankonlinetrans = new StringBuilder(); try { long Bankaccountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select bankaccountid from tblmstbank where recordid=" + modelGeneralReceipt.pdepositbankid + " and statusid=" + Convert.ToInt32(Status.Active) + " ;")); Sbbankonlinetrans.AppendLine("update tbltransreceiptreference set depositstatus='P',clearstatus='Y',cleardate=" + modelGeneralReceipt.pchequedate + ", depositmodifiedby=" + modelGeneralReceipt.pCreatedby + ",depositmodifieddate=current_timestamp,clearedmodifiedby=" + modelGeneralReceipt.pCreatedby + ",clearedmodifieddate=current_timestamp where receiptid='" + ManageQuote(modelGeneralReceipt.preceiptid) + "';"); // Gen cheques Clear Transaction Id Generation if (modelGeneralReceipt.preceiptid.StartsWith("CHQ")) { string Genchequescleared_transactionno = NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "SELECT FN_GENERATENEXTID('CHEQUES IN BANK','','" + FormatDate(modelGeneralReceipt.preceiptdate) + "')").ToString(); long Genchequestransid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "insert into tbltransgenchequecleared(transactionno, transactiondate, receiptid, referencenumber, contactid, contactname, contactrefid, contactreftype, totalreceivedamount, tdssection, pannumber, tdscalculationtype, tdspercentage, tdsamount, tdsaccountid, statusid, createdby, createddate ) select '" + Genchequescleared_transactionno + "', " + modelGeneralReceipt.pchequedate + ", receiptid, '" + ManageQuote(modelGeneralReceipt.pChequenumber) + "', contactid, contactname, contactrefid, contactreftype, totalreceivedamount, tdssection, pannumber, tdscalculationtype, tdspercentage, tdsamount, tdsaccountid, " + Convert.ToInt32(Status.Active) + ", " + modelGeneralReceipt.pCreatedby + ", current_timestamp from tbltransgeneralreceipt where receiptid='" + ManageQuote(modelGeneralReceipt.preceiptid) + "' returning recordid;")); Sbbankonlinetrans.AppendLine("insert into tbltransgenchequecleareddetails( detailsid, transactionno, creditaccountid, ledgeramount, isgstapplicable, gsttype, gstcalculationtype, gstpercentage, gstnumber, stateid, statename, cgstaccountid, sgstaccountid, igstaccountid, utgstaccountid, igstamount, cgstamount, sgstamount, utgstamount,tdsaccountid, tdssection, tdspercentage, tdsamount) select " + Genchequestransid + ", '" + Genchequescleared_transactionno + "', creditaccountid, ledgeramount, isgstapplicable, gsttype, gstcalculationtype, gstpercentage, gstnumber, stateid, statename, cgstaccountid, sgstaccountid, igstaccountid, utgstaccountid, igstamount, cgstamount, sgstamount, utgstamount, tdsaccountid, tdssection, tdspercentage, tdsamount from tbltransgeneralreceiptdetails where receiptid='" + ManageQuote(modelGeneralReceipt.preceiptid) + "' ;"); if (!string.IsNullOrEmpty(Genchequescleared_transactionno)) { Sbbankonlinetrans.AppendLine("SELECT fntotaltransactions('" + Genchequescleared_transactionno + "','CHEQUESINBANK');"); } // JV Insert if (modelGeneralReceipt.pistdsapplicable && modelGeneralReceipt.ptdsamount > 0) { if (modelGeneralReceipt.preceiptslist != null) { for (int i = 0; i < modelGeneralReceipt.preceiptslist.Count; i++) { if (modelGeneralReceipt.preceiptslist[i].ptdsamountindividual > 0) { objJournalVoucherDTO = new JournalVoucherDTO(); List <PaymentsDTO> _Paymentslist = new List <PaymentsDTO>(); objJournalVoucherDTO.pjvdate = modelGeneralReceipt.preceiptdate; objJournalVoucherDTO.pCreatedby = modelGeneralReceipt.pCreatedby; objJournalVoucherDTO.pnarration = "BE JV PASSED TOWARDS TDS AMOUNT"; objJournalVoucherDTO.pmodoftransaction = "AUTO"; objPaymentsDTO = new PaymentsDTO { ppartyid = modelGeneralReceipt.ppartyid, ppartyname = modelGeneralReceipt.ppartyname, ppartyreferenceid = modelGeneralReceipt.ppartyreferenceid, ppartyreftype = modelGeneralReceipt.ppartyreftype, ptranstype = "D", psubledgerid = modelGeneralReceipt.preceiptslist[i].psubledgerid, pamount = modelGeneralReceipt.preceiptslist[i].ptdsamountindividual }; _Paymentslist.Add(objPaymentsDTO); objPaymentsDTO = new PaymentsDTO { ptranstype = "C", ppartyid = modelGeneralReceipt.ppartyid, ppartyname = modelGeneralReceipt.ppartyname, ppartyreferenceid = modelGeneralReceipt.ppartyreferenceid, ppartyreftype = modelGeneralReceipt.ppartyreftype }; long creditaccountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select accountid from tblmstaccounts where upper(accountname)='OTHER CURRENT LIABILITIES' and statusid=" + Convert.ToInt32(Status.Active) + ";")); creditaccountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select insertaccounts('TDS-" + modelGeneralReceipt.preceiptslist[i].ptdssection + " PAYABLE'," + creditaccountid + ",'2'," + modelGeneralReceipt.pCreatedby + ")")); creditaccountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select insertaccounts('" + modelGeneralReceipt.ppartyreferenceid + "_" + modelGeneralReceipt.ppartyname + "'," + creditaccountid + ",'3'," + modelGeneralReceipt.pCreatedby + ")")); objPaymentsDTO.psubledgerid = creditaccountid; objPaymentsDTO.pamount = modelGeneralReceipt.preceiptslist[i].ptdsamountindividual; _Paymentslist.Add(objPaymentsDTO); objJournalVoucherDTO.pJournalVoucherlist = _Paymentslist; string refjvnumber = ""; SaveJournalVoucher(objJournalVoucherDTO, trans, out refjvnumber); Sbbankonlinetrans.AppendLine("update tbltransgeneralreceiptdetails set tdsrefjvnumber='" + refjvnumber + "',tdsaccountid=" + creditaccountid + " where receiptid='" + ManageQuote(modelGeneralReceipt.preceiptid) + "'" + "and creditaccountid=" + modelGeneralReceipt.preceiptslist[i].psubledgerid + ";"); Sbbankonlinetrans.AppendLine("update tbltransgenchequecleareddetails set tdsaccountid=" + creditaccountid + " where transactionno='" + ManageQuote(Genchequescleared_transactionno) + "' and creditaccountid=" + modelGeneralReceipt.preceiptslist[i].psubledgerid + ";"); } } } } } return(Convert.ToString(Sbbankonlinetrans)); } catch (Exception ex) { throw ex; } }
public bool SavePaymentVoucher_ALL(PaymentVoucherDTO _PaymentVoucherDTO, NpgsqlTransaction trans, string TransType, out string _PaymentId) { bool IsSaved = false; StringBuilder sbQuery = new StringBuilder(); try { if (string.IsNullOrEmpty(_PaymentVoucherDTO.ppaymentid)) { _PaymentVoucherDTO.ppaymentid = Convert.ToString(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "SELECT FN_GENERATENEXTID('PAYMENT VOUCHER','CASH','" + FormatDate(_PaymentVoucherDTO.ppaymentdate) + "')")); } long creditaccountid = 0; long tdsaccountid = 0; string query = ""; long detailsid = 0; if (_PaymentVoucherDTO.pmodofPayment == "CASH") { if (TransType == "SAVE") { creditaccountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select accountid from tblmstaccounts where upper(accountname)='CASH ON HAND' and statusid=" + Convert.ToInt32(Status.Active) + ";")); } if (TransType == "CANCEL") { creditaccountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select accountid from tblmstaccounts where upper(accountname)='CHEQUE ON HAND' and statusid=" + Convert.ToInt32(Status.Active) + ";")); } } else { creditaccountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select bankaccountid from tblmstbank where recordid = " + _PaymentVoucherDTO.pbankid)); } if (string.IsNullOrEmpty(_PaymentVoucherDTO.ptypeofoperation)) { _PaymentVoucherDTO.ptypeofoperation = "CREATE"; } if (_PaymentVoucherDTO.ptypeofoperation.ToUpper() == "CREATE") { query = "insert into tbltranspaymentvoucher( paymentid, paymentdate, modeofpayment, totalpaidamount, narration, creditaccountid, statusid, createdby, createddate,filename,filepath,fileformat)values('" + _PaymentVoucherDTO.ppaymentid + "', '" + FormatDate(_PaymentVoucherDTO.ppaymentdate) + "', '" + ManageQuote(_PaymentVoucherDTO.pmodofPayment) + "', " + _PaymentVoucherDTO.ptotalpaidamount + ", '" + ManageQuote(_PaymentVoucherDTO.pnarration) + "', " + creditaccountid + ", " + Convert.ToInt32(Status.Active) + ", " + _PaymentVoucherDTO.pCreatedby + ", current_timestamp,'" + ManageQuote(_PaymentVoucherDTO.pFilename) + "','" + ManageQuote(_PaymentVoucherDTO.pFilepath) + "','" + ManageQuote(_PaymentVoucherDTO.pFileformat) + "') returning recordid"; detailsid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, query)); } if (_PaymentVoucherDTO.ppaymentslist != null) { for (int i = 0; i < _PaymentVoucherDTO.ppaymentslist.Count; i++) { if (string.IsNullOrEmpty(_PaymentVoucherDTO.ppaymentslist[i].ptypeofoperation)) { _PaymentVoucherDTO.ppaymentslist[i].ptypeofoperation = "CREATE"; } if (_PaymentVoucherDTO.ppaymentslist[i].ptypeofoperation.ToUpper() == "CREATE") { if (!string.IsNullOrEmpty(_PaymentVoucherDTO.ppaymentslist[i].pState)) { if (_PaymentVoucherDTO.ppaymentslist[i].pState.Contains('-')) { string[] details = _PaymentVoucherDTO.ppaymentslist[i].pState.Split('-'); _PaymentVoucherDTO.ppaymentslist[i].pState = details[0].Trim(); _PaymentVoucherDTO.ppaymentslist[i].pgstno = details[1].Trim(); } } if (_PaymentVoucherDTO.ppaymentslist[i].ptdsamount > 0) { objJournalVoucherDTO = new JournalVoucherDTO(); List <PaymentsDTO> _Paymentslist = new List <PaymentsDTO>(); objJournalVoucherDTO.pjvdate = _PaymentVoucherDTO.ppaymentdate; objJournalVoucherDTO.pnarration = "BEING JV PASSED TOWARDS TDS AMOUNT"; objJournalVoucherDTO.pmodoftransaction = "AUTO"; objJournalVoucherDTO.pCreatedby = _PaymentVoucherDTO.pCreatedby; objPaymentsDTO = new PaymentsDTO(); objPaymentsDTO.ppartyid = _PaymentVoucherDTO.ppaymentslist[i].ppartyid; objPaymentsDTO.ppartyname = _PaymentVoucherDTO.ppaymentslist[i].ppartyname; objPaymentsDTO.ppartyreferenceid = _PaymentVoucherDTO.ppaymentslist[i].ppartyreferenceid; objPaymentsDTO.ppartyreftype = _PaymentVoucherDTO.ppaymentslist[i].ppartyreftype; objPaymentsDTO.ptranstype = "C"; objPaymentsDTO.psubledgerid = _PaymentVoucherDTO.ppaymentslist[i].psubledgerid; objPaymentsDTO.pamount = _PaymentVoucherDTO.ppaymentslist[i].ptdsamount; _Paymentslist.Add(objPaymentsDTO); objPaymentsDTO = new PaymentsDTO(); objPaymentsDTO.ptranstype = "D"; objPaymentsDTO.ppartyid = _PaymentVoucherDTO.ppaymentslist[i].ppartyid; objPaymentsDTO.ppartyname = _PaymentVoucherDTO.ppaymentslist[i].ppartyname; objPaymentsDTO.ppartyreferenceid = _PaymentVoucherDTO.ppaymentslist[i].ppartyreferenceid; objPaymentsDTO.ppartyreftype = _PaymentVoucherDTO.ppaymentslist[i].ppartyreftype; creditaccountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select accountid from tblmstaccounts where upper(accountname)='OTHER CURRENT LIABILITIES' and statusid=" + Convert.ToInt32(Status.Active) + ";")); creditaccountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select insertaccounts('TDS-" + _PaymentVoucherDTO.ppaymentslist[i].pTdsSection + " PAYABLE'," + creditaccountid + ",'2'," + _PaymentVoucherDTO.pCreatedby + ")")); creditaccountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select insertaccounts('" + _PaymentVoucherDTO.ppaymentslist[0].ppartyreferenceid + "_" + _PaymentVoucherDTO.ppaymentslist[0].ppartyname.ToUpper() + "'," + creditaccountid + ",'3'," + _PaymentVoucherDTO.pCreatedby + ")")); objPaymentsDTO.psubledgerid = creditaccountid; objPaymentsDTO.pamount = _PaymentVoucherDTO.ppaymentslist[i].ptdsamount; _Paymentslist.Add(objPaymentsDTO); objJournalVoucherDTO.pJournalVoucherlist = _Paymentslist; string refjvnumber = ""; //objJournalVoucherDTO.pStatusid = Convert.ToInt32(Status.Active); SaveJournalVoucher(objJournalVoucherDTO, trans, out refjvnumber); _PaymentVoucherDTO.ppaymentslist[i].ptdsrefjvnumber = refjvnumber; tdsaccountid = creditaccountid; } sbQuery.Append("insert into tbltranspaymentvoucherdetails( detailsid, paymentid, contactid,contactname,contactrefid,contactreftype, debitaccountid, ledgeramount, isgstapplicable,gsttype,gstcalculationtype, gstpercentage, igstamount, cgstamount, sgstamount, utgstamount, tdssection, tdscalculationtype, tdspercentage, tdsamount, istdsapplicable,pannumber,gstnumber,stateid,statename,tdsrefjvnumber,tdsaccountid)values (" + detailsid + ", '" + _PaymentVoucherDTO.ppaymentid + "'," + _PaymentVoucherDTO.ppaymentslist[i].ppartyid + ", '" + _PaymentVoucherDTO.ppaymentslist[i].ppartyname + "', '" + _PaymentVoucherDTO.ppaymentslist[i].ppartyreferenceid + "', '" + _PaymentVoucherDTO.ppaymentslist[i].ppartyreftype + "', " + _PaymentVoucherDTO.ppaymentslist[i].psubledgerid + ", " + _PaymentVoucherDTO.ppaymentslist[i].pamount + ", '" + _PaymentVoucherDTO.ppaymentslist[i].pisgstapplicable + "', '" + _PaymentVoucherDTO.ppaymentslist[i].pgsttype + "', '" + _PaymentVoucherDTO.ppaymentslist[i].pgstcalculationtype + "', " + _PaymentVoucherDTO.ppaymentslist[i].pgstpercentage + ", " + _PaymentVoucherDTO.ppaymentslist[i].pigstamount + ", " + _PaymentVoucherDTO.ppaymentslist[i].pcgstamount + ", " + _PaymentVoucherDTO.ppaymentslist[i].psgstamount + ", " + _PaymentVoucherDTO.ppaymentslist[i].putgstamount + ", '" + _PaymentVoucherDTO.ppaymentslist[i].pTdsSection + "', '" + _PaymentVoucherDTO.ppaymentslist[i].ptdscalculationtype + "', " + _PaymentVoucherDTO.ppaymentslist[i].pTdsPercentage + ", " + _PaymentVoucherDTO.ppaymentslist[i].ptdsamount + ", " + _PaymentVoucherDTO.ppaymentslist[i].pistdsapplicable + ", '" + _PaymentVoucherDTO.ppaymentslist[i].ppartypannumber + "','" + ManageQuote(_PaymentVoucherDTO.ppaymentslist[i].pgstno) + "'," + _PaymentVoucherDTO.ppaymentslist[i].pStateId + ",'" + ManageQuote(_PaymentVoucherDTO.ppaymentslist[i].pState) + "','" + ManageQuote(_PaymentVoucherDTO.ppaymentslist[i].ptdsrefjvnumber) + "'," + tdsaccountid + ");"); } } } if (_PaymentVoucherDTO.pmodofPayment != "CASH") { string particulars = ""; if (_PaymentVoucherDTO.ppaymentslist.Count > 0) { if (!string.IsNullOrEmpty(_PaymentVoucherDTO.ppaymentslist[0].pledgername)) { particulars = _PaymentVoucherDTO.ppaymentslist[0].pledgername.ToUpper() + "(" + _PaymentVoucherDTO.ppaymentslist[0].ppartyreferenceid + "_" + _PaymentVoucherDTO.ppaymentslist[0].ppartyname.ToUpper() + ")"; } else { particulars = ""; } } if (_PaymentVoucherDTO.ppaymentslist.Count > 1) { particulars = particulars + "AND OTHER"; } if (string.IsNullOrEmpty(_PaymentVoucherDTO.ptypeofpayment)) { _PaymentVoucherDTO.ptypeofpayment = _PaymentVoucherDTO.ptranstype; } if (_PaymentVoucherDTO.pbankname.Contains('-')) { _PaymentVoucherDTO.pbankname = _PaymentVoucherDTO.pbankname.Split('-')[0].Trim(); } sbQuery.Append("insert into tbltranspaymentreference( paymentid, bankname, branchname, transtype, typeofpayment, bankid, chequenumber,cardnumber , upiid , upiname, paymentdate, paidamount, clearstatus, particulars, statusid, createdby, createddate ) values('" + _PaymentVoucherDTO.ppaymentid + "', '" + _PaymentVoucherDTO.pbankname + "', '" + _PaymentVoucherDTO.pbranchname + "', '" + _PaymentVoucherDTO.ptranstype + "', '" + _PaymentVoucherDTO.ptypeofpayment + "', " + _PaymentVoucherDTO.pbankid + ", '" + _PaymentVoucherDTO.pChequenumber + "', '" + _PaymentVoucherDTO.pCardNumber + "', '" + _PaymentVoucherDTO.pUpiid + "', '" + _PaymentVoucherDTO.pUpiname + "', '" + FormatDate(_PaymentVoucherDTO.ppaymentdate) + "', " + _PaymentVoucherDTO.ptotalpaidamount + ", 'N', '" + particulars + "', " + Convert.ToInt32(Status.Active) + ", " + _PaymentVoucherDTO.pCreatedby + ", current_timestamp);"); if (_PaymentVoucherDTO.ptypeofpayment == "CHEQUE") { sbQuery.Append("update tblmstcheques set statusid =(SELECT statusid from tblmststatus where upper(statusname) ='USED-CHEQUES') where bankid =" + _PaymentVoucherDTO.pbankid + " and chequenumber=" + _PaymentVoucherDTO.pChequenumber + ";"); } } if (!string.IsNullOrEmpty(sbQuery.ToString())) { sbQuery.Append("select fntotaltransactions('" + _PaymentVoucherDTO.ppaymentid + "','PAYMENT VOUCHER');"); //+"select accountsupdate();" NPGSqlHelper.ExecuteNonQuery(trans, CommandType.Text, sbQuery.ToString()); IsSaved = true; } } catch (Exception ex) { throw ex; } _PaymentId = _PaymentVoucherDTO.ppaymentid; return(IsSaved); }
public bool SaveJournalVoucher(JournalVoucherDTO _JournalVoucherDTO, NpgsqlTransaction trans, out string ptdsrefjvnumber) { bool IsSaved = false; StringBuilder sbQuery = new StringBuilder(); try { if (string.IsNullOrEmpty(_JournalVoucherDTO.pjvnumber)) { _JournalVoucherDTO.pjvnumber = Convert.ToString(Convert.ToString(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "SELECT FN_GENERATENEXTID('JOURNAL VOUCHER','AUTO','" + FormatDate(_JournalVoucherDTO.pjvdate) + "')"))); } ptdsrefjvnumber = _JournalVoucherDTO.pjvnumber; string query = ""; long detailsid = 0; if (string.IsNullOrEmpty(_JournalVoucherDTO.ptypeofoperation)) { _JournalVoucherDTO.ptypeofoperation = "CREATE"; } if (_JournalVoucherDTO.ptypeofoperation.ToUpper() == "CREATE") { query = "insert into tbltransjournalvoucher( jvnumber, jvdate, narration, statusid, createdby, createddate,filename,filepath,fileformat,modeoftransaction)values('" + _JournalVoucherDTO.pjvnumber + "', '" + FormatDate(_JournalVoucherDTO.pjvdate) + "', '" + ManageQuote(_JournalVoucherDTO.pnarration) + "', " + Convert.ToInt32(Status.Active) + ", " + _JournalVoucherDTO.pCreatedby + ", current_timestamp,'" + ManageQuote(_JournalVoucherDTO.pFilename) + "','" + ManageQuote(_JournalVoucherDTO.pFilepath) + "','" + ManageQuote(_JournalVoucherDTO.pFileformat) + "','" + ManageQuote(_JournalVoucherDTO.pmodoftransaction) + "') returning recordid"; detailsid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, query)); } else if (_JournalVoucherDTO.ptypeofoperation.ToUpper() == "UPDATE") { query = "select recordid from tbltransjournalvoucher where jvnumber='" + _JournalVoucherDTO.pjvnumber + "';"; detailsid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, query)); sbQuery.Append("update tbltransjournalvoucher set modifiedby=" + _JournalVoucherDTO.pCreatedby + ", modifieddate=current_timestamp where jvnumber='" + _JournalVoucherDTO.pjvnumber + "'; "); sbQuery.Append("delete from tbltransjournalvoucherdetails where jvnumber='" + _JournalVoucherDTO.pjvnumber + "'; "); sbQuery.Append("delete from tbltranstotaltransactions where transactionno='" + _JournalVoucherDTO.pjvnumber + "' ;"); } if (_JournalVoucherDTO.pJournalVoucherlist != null) { for (int i = 0; i < _JournalVoucherDTO.pJournalVoucherlist.Count; i++) { if (string.IsNullOrEmpty(_JournalVoucherDTO.pJournalVoucherlist[i].ptypeofoperation)) { _JournalVoucherDTO.pJournalVoucherlist[i].ptypeofoperation = "CREATE"; } if (_JournalVoucherDTO.pJournalVoucherlist[i].ptypeofoperation.ToUpper() == "CREATE") { sbQuery.Append("insert into tbltransjournalvoucherdetails( detailsid, jvnumber, contactid,contactname,contactrefid,contactreftype, jvaccountid, ledgeramount,accounttranstype, gsttype, gstcalculationtype, tdssection, pannumber, tdscalculationtype, tdspercentage, tdsamount, gstpercentage, igstamount, cgstamount, sgstamount, utgstamount, istdsapplicable,gstnumber,tdsaccountid,stateid,statename)values (" + detailsid + ", '" + ManageQuote(_JournalVoucherDTO.pjvnumber) + "'," + _JournalVoucherDTO.pJournalVoucherlist[i].ppartyid + ",'" + _JournalVoucherDTO.pJournalVoucherlist[i].ppartyname + "','" + ManageQuote(_JournalVoucherDTO.pJournalVoucherlist[i].ppartyreferenceid) + "','" + ManageQuote(_JournalVoucherDTO.pJournalVoucherlist[i].ppartyreftype) + "', " + _JournalVoucherDTO.pJournalVoucherlist[i].psubledgerid + ", " + _JournalVoucherDTO.pJournalVoucherlist[i].pamount + ",'" + _JournalVoucherDTO.pJournalVoucherlist[i].ptranstype + "', '" + _JournalVoucherDTO.pJournalVoucherlist[i].pgsttype + "', '" + _JournalVoucherDTO.pJournalVoucherlist[i].pgstcalculationtype + "', '" + _JournalVoucherDTO.pJournalVoucherlist[i].pTdsSection + "', '" + _JournalVoucherDTO.pJournalVoucherlist[i].ppartypannumber + "', '" + _JournalVoucherDTO.pJournalVoucherlist[i].ptdscalculationtype + "', " + _JournalVoucherDTO.pJournalVoucherlist[i].pTdsPercentage + ", " + _JournalVoucherDTO.pJournalVoucherlist[i].ptdsamount + ", '" + _JournalVoucherDTO.pJournalVoucherlist[i].pgstpercentage + "', '" + _JournalVoucherDTO.pJournalVoucherlist[i].pigstamount + "', '" + _JournalVoucherDTO.pJournalVoucherlist[i].pcgstamount + "', " + _JournalVoucherDTO.pJournalVoucherlist[i].psgstamount + ", " + _JournalVoucherDTO.pJournalVoucherlist[i].putgstamount + ", " + _JournalVoucherDTO.pJournalVoucherlist[i].pistdsapplicable + ",'" + _JournalVoucherDTO.pJournalVoucherlist[i].pgstno + "'," + _JournalVoucherDTO.pJournalVoucherlist[i].ptdsaccountId + "," + _JournalVoucherDTO.pJournalVoucherlist[i].pStateId + ",'" + _JournalVoucherDTO.pJournalVoucherlist[i].pState + "');"); } } } if (!string.IsNullOrEmpty(_JournalVoucherDTO.pjvnumber)) { sbQuery.AppendLine("SELECT fntotaltransactions('" + _JournalVoucherDTO.pjvnumber + "','JOURNALVOUCHER');"); //select accountsupdate(); } if (!string.IsNullOrEmpty(sbQuery.ToString())) { NPGSqlHelper.ExecuteNonQuery(trans, CommandType.Text, sbQuery.ToString()); } IsSaved = true; } catch (Exception ex) { throw ex; } return(IsSaved); }
public bool SaveJournalVoucher_All(JournalVoucherDTO _JournalVoucherDTO, string ConnectionString, out string jvnumber) { long accountid = 0; bool isSaved = false; string refjvnumber = ""; StringBuilder sbinsert = new StringBuilder(); objJournalVoucherDTO = new JournalVoucherDTO(); List <PaymentsDTO> _Paymentslist = new List <PaymentsDTO>(); try { con = new NpgsqlConnection(ConnectionString); if (con.State != ConnectionState.Open) { con.Open(); } trans = con.BeginTransaction(); if (_JournalVoucherDTO.pJournalVoucherlist != null) { objJournalVoucherDTO.pjvdate = _JournalVoucherDTO.pjvdate; objJournalVoucherDTO.pnarration = _JournalVoucherDTO.pnarration.ToUpper(); objJournalVoucherDTO.pmodoftransaction = "MANUAL"; objJournalVoucherDTO.pCreatedby = _JournalVoucherDTO.pCreatedby; for (int i = 0; i < _JournalVoucherDTO.pJournalVoucherlist.Count; i++) { objPaymentsDTO = new PaymentsDTO(); objPaymentsDTO.ppartyid = _JournalVoucherDTO.pJournalVoucherlist[i].ppartyid; objPaymentsDTO.ppartyname = _JournalVoucherDTO.pJournalVoucherlist[i].ppartyname; objPaymentsDTO.ppartyreferenceid = _JournalVoucherDTO.pJournalVoucherlist[i].ppartyreferenceid; objPaymentsDTO.ppartyreftype = _JournalVoucherDTO.pJournalVoucherlist[i].ppartyreftype; if (_JournalVoucherDTO.pJournalVoucherlist[i].ptranstype.ToUpper() == "CREDIT") { if (_JournalVoucherDTO.pJournalVoucherlist[i].ptdsamount > 0) { accountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select accountid from tblmstaccounts where upper(accountname)='OTHER CURRENT LIABILITIES' and statusid=" + Convert.ToInt32(Status.Active) + ";")); accountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select insertaccounts('TDS-" + _JournalVoucherDTO.pJournalVoucherlist[i].pTdsSection + " PAYABLE'," + accountid + ",'2'," + objJournalVoucherDTO.pCreatedby + ")")); accountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select insertaccounts('" + _JournalVoucherDTO.pJournalVoucherlist[i].ppartyreferenceid + "_" + _JournalVoucherDTO.pJournalVoucherlist[i].ppartyname + "'," + accountid + ",'3'," + objJournalVoucherDTO.pCreatedby + ")")); } objPaymentsDTO.ptranstype = "C"; } if (_JournalVoucherDTO.pJournalVoucherlist[i].ptranstype.ToUpper() == "DEBIT") { if (_JournalVoucherDTO.pJournalVoucherlist[i].ptdsamount > 0) { accountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select accountid from tblmstaccounts where upper(accountname)='OTHER CURRENT ASSETS' and statusid=" + Convert.ToInt32(Status.Active) + ";")); accountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select insertaccounts('TDS-" + _JournalVoucherDTO.pJournalVoucherlist[i].pTdsSection + " RECEIVABLE'," + accountid + ",'2'," + objJournalVoucherDTO.pCreatedby + ")")); accountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select insertaccounts('" + _JournalVoucherDTO.pJournalVoucherlist[i].ppartyreferenceid + "_" + _JournalVoucherDTO.pJournalVoucherlist[i].ppartyname + "'," + accountid + ",'3'," + objJournalVoucherDTO.pCreatedby + ")")); } objPaymentsDTO.ptranstype = "D"; } objPaymentsDTO.psubledgerid = _JournalVoucherDTO.pJournalVoucherlist[i].psubledgerid; objPaymentsDTO.pamount = _JournalVoucherDTO.pJournalVoucherlist[i].pamount; objPaymentsDTO.pgstcalculationtype = _JournalVoucherDTO.pJournalVoucherlist[i].pgstcalculationtype; objPaymentsDTO.pTdsSection = _JournalVoucherDTO.pJournalVoucherlist[i].pTdsSection; objPaymentsDTO.ptdscalculationtype = _JournalVoucherDTO.pJournalVoucherlist[i].ptdscalculationtype; objPaymentsDTO.pTdsPercentage = _JournalVoucherDTO.pJournalVoucherlist[i].pTdsPercentage; objPaymentsDTO.ptdsamount = _JournalVoucherDTO.pJournalVoucherlist[i].ptdsamount; objPaymentsDTO.pgstpercentage = _JournalVoucherDTO.pJournalVoucherlist[i].pgstpercentage; objPaymentsDTO.pigstamount = _JournalVoucherDTO.pJournalVoucherlist[i].pigstamount; objPaymentsDTO.pcgstamount = _JournalVoucherDTO.pJournalVoucherlist[i].pcgstamount; objPaymentsDTO.psgstamount = _JournalVoucherDTO.pJournalVoucherlist[i].psgstamount; objPaymentsDTO.putgstamount = _JournalVoucherDTO.pJournalVoucherlist[i].putgstamount; objPaymentsDTO.pistdsapplicable = _JournalVoucherDTO.pJournalVoucherlist[i].pistdsapplicable; objPaymentsDTO.pgstnumber = _JournalVoucherDTO.pJournalVoucherlist[i].pgstnumber; objPaymentsDTO.pStateId = _JournalVoucherDTO.pJournalVoucherlist[i].pStateId; objPaymentsDTO.pState = _JournalVoucherDTO.pJournalVoucherlist[i].pState; objPaymentsDTO.pgstno = _JournalVoucherDTO.pJournalVoucherlist[i].pgstno; objPaymentsDTO.pgsttype = _JournalVoucherDTO.pJournalVoucherlist[i].pgsttype; objPaymentsDTO.ptdsaccountId = accountid; _Paymentslist.Add(objPaymentsDTO); } objJournalVoucherDTO.pJournalVoucherlist = _Paymentslist; SaveJournalVoucher(objJournalVoucherDTO, trans, out refjvnumber); trans.Commit(); isSaved = true; } } catch (Exception ex) { trans.Rollback(); throw ex; } finally { if (con.State == ConnectionState.Open) { con.Dispose(); con.Close(); con.ClearPool(); trans.Dispose(); } } jvnumber = refjvnumber; return(isSaved); }