Exemplo n.º 1
0
 public List <PaymentsDTO> GetPaymentVoucherDetailsReportDataById(string paymentId, string Connectionstring)
 {
     Paymentsdetailslist = new List <PaymentsDTO>();
     try
     {
         using (NpgsqlDataReader dr = NPGSqlHelper.ExecuteReader(Connectionstring, CommandType.Text, "SELECT contactname,accountname,SUM(ledgeramount)ledgeramount FROM (select contactname,case when chracctype ='2' then accountname else parentaccountname end accountname,(coalesce(ledgeramount,0) ) ledgeramount from tbltranspaymentvoucherdetails tr join tblmstaccounts tac on  tac.accountid=tr.debitaccountid  where  paymentid='" + paymentId + "')X GROUP BY contactname,accountname ORDER BY contactname"))
         {
             while (dr.Read())
             {
                 objPaymentsDTO = new PaymentsDTO
                 {
                     ppartyname  = Convert.ToString(dr["contactname"]),
                     pamount     = Convert.ToDecimal(dr["ledgeramount"]),
                     pledgername = Convert.ToString(dr["accountname"])
                 };
                 Paymentsdetailslist.Add(objPaymentsDTO);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(Paymentsdetailslist);
 }
Exemplo n.º 2
0
        public ActionResult UpdatePayments(PaymentsDTO payment)
        {
            int cnt = posMasters.UpdatePayments(payment);

            //List<PaymentsDTO> lstPayments = posMasters.showPayments();
            return(new JsonResult {
                Data = cnt, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Exemplo n.º 3
0
        public ActionResult DeletePayments(PaymentsDTO payment)
        {
            bool isSaved = posMasters.DeletePayments(payment);
            List <PaymentsDTO> lstPayments = posMasters.showPayments();

            return(new JsonResult {
                Data = lstPayments, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Exemplo n.º 4
0
        public ActionResult SavePayments(PaymentsDTO payment)
        {
            payment.statusid  = 1;
            payment.createdby = Convert.ToInt64(Session["UserId"]);
            int Count = posMasters.SavePayments(payment);

            // List<PaymentsDTO> lstPayments = posMasters.showPayments();
            return(new JsonResult {
                Data = Count, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Exemplo n.º 5
0
        public PaymentsDTO GetPaymentById(int paymentId)
        {
            PaymentsDTO payments = (from p in svmContext.tblpayment
                                    join q in svmContext.tblstudent
                                    on p.StudentId equals q.StudentId
                                    where p.IsDeleted == false && p.PaymentId == paymentId
                                    select new PaymentsDTO
            {
                StudentNo = q.StudentNo,
                FirstName = q.FirstName,
                MiddleName = q.MiddleName,
                LastName = q.LastName
            }).FirstOrDefault();

            return(payments);
        }
Exemplo n.º 6
0
        public BankInformationDTO SaveOpeningJV(BankInformationDTO lstBankInformation)
        {
            string             refjvnumber   = "";
            List <PaymentsDTO> _Paymentslist = new List <PaymentsDTO>();
            string             JvDate        = NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select transactionopeningdate from tblmstcompany where statusid=" + Convert.ToInt32(Status.Active) + ";").ToString();

            objJournalVoucherDTO.pjvdate           = JvDate;
            objJournalVoucherDTO.pnarration        = "OPENING BALANCE OF BANK ACCOUNT";
            objJournalVoucherDTO.pmodoftransaction = "AUTO";
            if (lstBankInformation.pOpeningBalanceType.ToUpper() == "C")
            {
                objPaymentsDTO              = new PaymentsDTO();
                objPaymentsDTO.ptranstype   = "C";
                objPaymentsDTO.psubledgerid = BankAccountId;
                objPaymentsDTO.pamount      = lstBankInformation.pOpeningBalance;
                _Paymentslist.Add(objPaymentsDTO);
                objPaymentsDTO              = new PaymentsDTO();
                objPaymentsDTO.ptranstype   = "D";
                objPaymentsDTO.psubledgerid = OpeningBalanceAccountID;
                objPaymentsDTO.pamount      = lstBankInformation.pOpeningBalance;
                _Paymentslist.Add(objPaymentsDTO);
            }
            else if (lstBankInformation.pOpeningBalanceType.ToUpper() == "D")
            {
                objPaymentsDTO              = new PaymentsDTO();
                objPaymentsDTO.ptranstype   = "D";
                objPaymentsDTO.psubledgerid = BankAccountId;
                objPaymentsDTO.pamount      = lstBankInformation.pOpeningBalance;
                _Paymentslist.Add(objPaymentsDTO);
                objPaymentsDTO              = new PaymentsDTO();
                objPaymentsDTO.ptranstype   = "C";
                objPaymentsDTO.psubledgerid = OpeningBalanceAccountID;
                objPaymentsDTO.pamount      = lstBankInformation.pOpeningBalance;
                _Paymentslist.Add(objPaymentsDTO);
            }
            objJournalVoucherDTO.pJournalVoucherlist = _Paymentslist;
            if (objJournalVoucherDTO.pJournalVoucherlist.Count > 0)
            {
                objJournalVoucher.SaveJournalVoucher(objJournalVoucherDTO, trans, out refjvnumber);
            }
            strSave.Append("UPDATE tblmstbank SET openingjvno='" + refjvnumber + "'  WHERE recordid=" + lstBankInformation.pRecordid + ";");
            return(lstBankInformation);
        }
Exemplo n.º 7
0
        public List <PaymentsDTO> GetPays(string pStrFolio)
        {
            SAPbobsCOM.Recordset lObjRecordset   = null;
            List <PaymentsDTO>   lLstPaymentsDTO = new List <PaymentsDTO>();

            try
            {
                Dictionary <string, string> lLstStrParameters = new Dictionary <string, string>();
                lLstStrParameters.Add("Folio", pStrFolio);
                string lStrQuery = this.GetSQL("GetPay").Inject(lLstStrParameters);
                //this.UIAPIRawForm.DataSources.DataTables.Item("RESULT").ExecuteQuery(lStrQuery);

                lObjRecordset = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                lObjRecordset.DoQuery(lStrQuery);

                if (lObjRecordset.RecordCount > 0)
                {
                    for (int i = 0; i < lObjRecordset.RecordCount; i++)
                    {
                        PaymentsDTO lObjPaymentDTO = new PaymentsDTO();
                        lObjPaymentDTO.DocEntry = lObjRecordset.Fields.Item("DocEntry").Value.ToString();
                        lObjPaymentDTO.DocNum   = lObjRecordset.Fields.Item("DocNum").Value.ToString();
                        lObjPaymentDTO.DocDate  = Convert.ToDateTime(lObjRecordset.Fields.Item("DocDate").Value.ToString());
                        lObjPaymentDTO.DocTotal = Convert.ToDouble(lObjRecordset.Fields.Item("DocTotal").Value.ToString());

                        lLstPaymentsDTO.Add(lObjPaymentDTO);
                        lObjRecordset.MoveNext();
                    }
                }
            }
            catch (Exception ex)
            {
                UIApplication.ShowError(string.Format("GetPayments: {0}", ex.Message));
                LogService.WriteError("PaymentDAO (GetPayments): " + ex.Message);
                LogService.WriteError(ex);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordset);
            }
            return(lLstPaymentsDTO);
        }
Exemplo n.º 8
0
 public bool CreatePayment(PaymentsDTO request)
 {
     return(_PaymentsRepo.CreatePayment(request.PaymentRequestId, request.ParentId, request.Amount));
 }
Exemplo n.º 9
0
 public bool CreateGroupPaymentRequest(PaymentsDTO request)
 {
     return(_PaymentsRepo.CreateGroupPaymentRequest(request.ClientId, request.GroupId, request.Amount, request.DueDate, request.PaymentRequestTypeId));
 }
Exemplo n.º 10
0
 public List <FinancialDTO> GetAllFinancialsForParent(PaymentsDTO request)
 {
     return(_PaymentsRepo.GetAllFinancialsForParent(request.ParentId));
 }
Exemplo n.º 11
0
        /// <summary>
        /// 修改用户支付方式
        /// </summary>
        /// <param name="paymentsDTO">支付方式实体</param>
        /// <returns></returns>
        public ResultDTO UpdatePaymentExt(PaymentsVM paymentsVM)
        {
            if (paymentsVM == null || paymentsVM.PaymentIds == null || !paymentsVM.PaymentIds.Any())
            {
                return new ResultDTO {
                           ResultCode = 1, Message = "支付方式不能为空"
                }
            }
            ;
            if (paymentsVM.AppScoreSetting == null)
            {
                paymentsVM.AppScoreSetting = new AppScoreSettingDTO();
            }
            //app是否有积分功能项
            var isMyIntegral = BACBP.CheckMyIntegral(paymentsVM.AppId);

            if (isMyIntegral && paymentsVM.AppScoreSetting.IsCashForScore && CustomConfig.ScoreCostList.All(c => c != paymentsVM.AppScoreSetting.ScoreCost))
            {
                return(new ResultDTO {
                    ResultCode = 2, Message = "积分设置不合法"
                });
            }
            Payments        p        = new Payments();
            List <Payments> payments = Payments.ObjectSet().Where(n => n.AppId == paymentsVM.AppId).ToList();

            ContextSession contextSession = ContextFactory.CurrentThreadContext;

            try
            {
                foreach (Payments item in payments)
                {
                    item.EntityState = System.Data.EntityState.Deleted;
                    contextSession.Delete(item);
                }

                if (paymentsVM.PaymentIds != null && paymentsVM.PaymentIds.Count() > 0)
                {
                    foreach (var item in paymentsVM.PaymentIds)
                    {
                        Guid payId;
                        if (!Guid.TryParse(item, out payId))
                        {
                            continue;
                        }
                        string      name        = AllPayment.ObjectSet().Where(n => n.Id == payId).Select(n => n.PaymentName).FirstOrDefault();
                        DateTime    dt          = DateTime.Now;
                        PaymentsDTO paymentsDTO = new PaymentsDTO();
                        paymentsDTO.Id          = Guid.NewGuid();
                        paymentsDTO.Name        = name;
                        paymentsDTO.AppId       = paymentsVM.AppId;
                        paymentsDTO.Code        = dt.ToFileTime().ToString();
                        paymentsDTO.SubTime     = DateTime.Now;
                        paymentsDTO.SubId       = paymentsVM.AppId;
                        paymentsDTO.PaymentId   = new Guid(item);
                        paymentsDTO.IsOnuse     = paymentsVM.IsOnuse;
                        paymentsDTO.PaymentName = name;

                        if (name == "支付宝")
                        {
                            paymentsDTO.AliPayPartnerId  = paymentsVM.AliPayPartnerId;
                            paymentsDTO.AliPayPrivateKey = paymentsVM.AliPayPrivateKey;
                            paymentsDTO.AliPayPublicKey  = paymentsVM.AliPayPublicKey;
                            paymentsDTO.AliPaySeller     = paymentsVM.AliPaySeller;
                            paymentsDTO.AliPayVerifyCode = paymentsVM.AliPayVerifyCode;
                        }

                        paymentsDTO.EntityState = System.Data.EntityState.Added;
                        Payments payment = new Payments().FromEntityData(paymentsDTO);
                        contextSession.SaveObject(payment);
                    }
                }
                //保存积分抵现设置
                if (isMyIntegral)
                {
                    var appExt = AppExtension.ObjectSet().FirstOrDefault(c => c.Id == paymentsVM.AppId);
                    if (appExt != null)
                    {
                        appExt.IsCashForScore = paymentsVM.AppScoreSetting.IsCashForScore;
                        appExt.ModifiedOn     = DateTime.Now;
                        appExt.EntityState    = EntityState.Modified;
                    }
                    else
                    {
                        appExt                = AppExtension.CreateAppExtension();
                        appExt.Id             = paymentsVM.AppId;
                        appExt.IsCashForScore = paymentsVM.AppScoreSetting.IsCashForScore;
                        contextSession.SaveObject(appExt);
                    }
                    if (paymentsVM.AppScoreSetting.IsCashForScore)
                    {
                        //差异判断,设置不变,不重新保存
                        var lastScoreSetting = ScoreSetting.ObjectSet().Where(c => c.AppId == paymentsVM.AppId).OrderByDescending(c => c.SubTime).FirstOrDefault();
                        if (lastScoreSetting == null || lastScoreSetting.ScoreCost != paymentsVM.AppScoreSetting.ScoreCost)
                        {
                            ScoreSetting scoreSetting = ScoreSetting.CreateScoreSetting();
                            scoreSetting.ScoreCost = paymentsVM.AppScoreSetting.ScoreCost;
                            scoreSetting.AppId     = paymentsVM.AppId;
                            contextSession.SaveObject(scoreSetting);
                        }
                    }
                }
                contextSession.SaveChange();

                //删除缓存
                Jinher.JAP.Cache.GlobalCacheWrapper.Remove("G_PaymentInfo", paymentsVM.AppId.ToString(), "BTPCache");
                Jinher.JAP.Cache.GlobalCacheWrapper.Remove("G_AliPayInfo", paymentsVM.AppId.ToString(), "BTPCache");
            }
            catch (Exception ex)
            {
                LogHelper.Error(string.Format("修改用户支付方式服务异常。paymentsVM:{0}", JsonHelper.JsonSerializer(paymentsVM)), ex);
                return(new ResultDTO {
                    ResultCode = 1, Message = "Error"
                });
            }
            return(new ResultDTO {
                ResultCode = 0, Message = "Success"
            });
        }
Exemplo n.º 12
0
        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);
        }
Exemplo n.º 13
0
        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;
            }
        }
Exemplo n.º 14
0
        private void FrmPaymentMaintenance_Load(object sender, EventArgs e)
        {
            cbTransferee.Enabled = false;
            //eager load discounts
            lstDiscount = _assessmentService.GetDiscount();

            var lstScholarshipRegular    = lstDiscount.Where(x => x.DiscountTypeId == 6).ToList();
            var lstScholarshipTransferee = lstDiscount.Where(x => x.DiscountTypeId == 5).ToList();
            var lstEarlyBird             = lstDiscount.Where(x => x.DiscountTypeId == 3).ToList();


            //siblingDiscountType = lstSibling[0].DiscountTypeId;
            //referralDiscountType = lstReferral[0].DiscountTypeId;



            // combobox mode of payment
            PaymentsDTO payments = _paymentService.GetPaymentById(Global.selectedId);

            cmbModeOfPayment.DataSource    = _paymentService.GetModeOfPayment();
            cmbModeOfPayment.ValueMember   = "ModeOfPaymentId";
            cmbModeOfPayment.DisplayMember = "ModeOfPaymentDesc";
            cmbModeOfPayment.SelectedIndex = 0;

            lblTransactionDate.Text = DateTime.Now.ToShortDateString();
            //combobox payment term (first/second/third/fourth grading)


            //load the payments grid

            List <PaymentsDTO> lstPayments   = _paymentService.GetPaymentsByStudentId(Global.selectedStudent);
            AssessmentDTO      assessmentDTO = _assessmentService.GetAssessmentsDTO(Global.selectedStudent);
            var studPaymentBindingList       = new BindingList <PaymentsDTO>(lstPayments);
            var studPaymentBindingSource     = new BindingSource(studPaymentBindingList, null);

            //###################      singit the textboxex    ######################
            var lstAssessment = _assessmentService.GetAssessment(Global.selectedStudent);

            txtMiscAmountDue.Text    = lstAssessment.DeferredMisc.ToString();
            txtTuitionAmountDue.Text = lstAssessment.PaymentPerDue.ToString();
            txtTotalAmount.Text      = (Convert.ToDouble(txtMiscAmountDue.Text) + Convert.ToDouble(txtMiscAmountDue.Text)).ToString("#.##");

            //determine due dates
            lstDueDates = _dueDatesService.GetDueDates(lstAssessment.PaymentTerm);

            //get high and low for dates
            dateLow = lstDueDates.Where(x => x.DueDate <= DateTime.Now).
                      OrderBy(x => x.DueDate).LastOrDefault().DueDate;

            dateHigh = lstDueDates.Where(x => x.DueDate >= DateTime.Now).
                       OrderBy(x => x.DueDate).LastOrDefault().DueDate;

            if (lstPayments.Count >= 1)
            {
                // cbTransferee.Checked = assessmentDTO.isTransferree;
                //this is not downpayment
            }
            else //if no payment given yet,
            {
                cbDownpayment.Checked = true;

                penalizedFee = DateTime.Now > lstDueDates[0].DueDate ? Convert.ToDouble(txtTuitionAmountDue.Text) +
                               ((Convert.ToDouble(txtTuitionAmountDue.Text) / 100) * 3.5) : 0;

                txtPenalty.Text      = ((Convert.ToDouble(txtTuitionAmountDue.Text) / 100) * 3.5).ToString("#.##");
                cbTransferee.Checked = false;
            }

            //payment term annual or downpayment  and not late for anything (no penalty)
            if ((lstAssessment.PaymentTerm == 1 || cbDownpayment.Checked == true) && penalizedFee == 0)
            {
                //early bird discount
                TuitionDTO earlyBirdVal = lstDiscount.Where(x => x.DiscountTypeId == 3 &&
                                                            Convert.ToDateTime(x.DiscountParam) >= DateTime.Now).
                                          OrderBy(x => x.DiscountVal).LastOrDefault();

                txtEarlyBird.Text = (Convert.ToDouble(earlyBirdVal.DiscountVal) *
                                     (lstAssessment.OriginalAmount) / 100).ToString("#.##");

                lblEarlyBird.Visible = true;
                lblEarlyBird.Text    = "Early Bird for " + Convert.ToDateTime(earlyBirdVal.DiscountParam).ToShortDateString()
                                       + " ," + (earlyBirdVal.DiscountVal) + "%";


                txtTotalAmount.Text = (Convert.ToDouble(txtPenalty.Text) + Convert.ToDouble(txtTotalAmount.Text)
                                       - Convert.ToDouble(txtEarlyBird.Text)).ToString("#.##");
            }
            else
            {
                lblEarlyBird.Visible = false;
                txtTotalAmount.Text  = (Convert.ToDouble(txtPenalty.Text) + Convert.ToDouble(txtTotalAmount.Text) + Convert.ToDouble(txtMiscAmountDue.Text)).ToString("#.##");
            }
            //txtTotalAmountBal.Text = (lstAssessment.FullAmount - (Convert.ToDouble(txtAmount.Text))).ToString("#.##");


            txtTotalRemainingBal.Text = (lstAssessment.FullAmount).ToString("#.##");
            PaymentsDTO lastPayment = lstPayments.LastOrDefault();

            //txtRemainingMiscBal.Text =Convert.ToDouble(txtMiscAmountDue.Text) - lastPayment.
            //####################/till here                    #######################



            pbStudent.Image = Image.FromFile(lstAssessment.path);

            dgvStudentPayments.AutoGenerateColumns = false;

            dgvStudentPayments.ColumnCount = 6;

            dgvStudentPayments.Columns[0].Name             = "colAmount";
            dgvStudentPayments.Columns[0].HeaderText       = "Amount";
            dgvStudentPayments.Columns[0].DataPropertyName = "Amount";

            //dgvStudentPayments.Columns[1].Name = "colBank";
            //dgvStudentPayments.Columns[1].HeaderText = "Bank";
            //dgvStudentPayments.Columns[1].DataPropertyName = "BankName";

            dgvStudentPayments.Columns[1].Name             = "colModeOfPayment";
            dgvStudentPayments.Columns[1].HeaderText       = "Mode Of Payment";
            dgvStudentPayments.Columns[1].DataPropertyName = "ModeOfPayment";

            dgvStudentPayments.Columns[2].Name             = "colTransactionDate";
            dgvStudentPayments.Columns[2].HeaderText       = "Transaction Date";
            dgvStudentPayments.Columns[2].DataPropertyName = "TransactionDate";

            dgvStudentPayments.Columns[3].Name             = "colRemaniningBalance";
            dgvStudentPayments.Columns[3].HeaderText       = "Remaining Balance";
            dgvStudentPayments.Columns[3].DataPropertyName = "Balance";

            dgvStudentPayments.Columns[4].Name             = "colOriginalBalance";
            dgvStudentPayments.Columns[4].HeaderText       = "Original Balance";
            dgvStudentPayments.Columns[4].DataPropertyName = "OriginalBalance";

            dgvStudentPayments.DataSource = studPaymentBindingSource;

            //fill the textboxes
            txtStudentName.Text = assessmentDTO.FirstName + " " + assessmentDTO.MiddleName.ToString() + " " + assessmentDTO.LastName.ToString();
            txtStudentNo.Text   = assessmentDTO.StudentNo;

            //txtBalance.Text = lstPayments[lstPayments.Count - 1].Balance.ToString();

            //load payment term

            //cmbPaymentTerm.DataSource = _paymentService.GetDateParameters();
            //cmbPaymentTerm.ValueMember = "DateParameterId";
            //cmbPaymentTerm.DisplayMember = "DatesDescription";
            //cmbPaymentTerm.SelectedIndex = -1;
        }
Exemplo n.º 15
0
        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);
        }
Exemplo n.º 16
0
 public bool Pay(PaymentsDTO request)
 {
     return(_PaymentsRepo.Pay(request.ClientId, request.ParentId, request.PaymentRequestId));
 }
Exemplo n.º 17
0
 public bool CreateStudentPaymentRequest(PaymentsDTO request)
 {
     return(_PaymentsRepo.CreateStudentPaymentRequest(request.ClientId, request.PaymentRequestTypeId, request.StudentId, request.Amount, request.Details, request.DueDate));
 }
        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);
        }
Exemplo n.º 19
0
 public FinancialDTO PaymentDetails(PaymentsDTO request)
 {
     return(_PaymentsRepo.PaymentDetails(request.ClientId, request.PaymentRequestId));
 }
Exemplo n.º 20
0
 public bool SendBackToReview(PaymentsDTO request)
 {
     return(_PaymentsRepo.SendBackToReview(request.ClientId, request.ParentId, request.PaymentRequestId));
 }
Exemplo n.º 21
0
 public bool ApprovePayment(PaymentsDTO request)
 {
     return(_PaymentsRepo.ApprovePayment(request.ClientId, request.ParentId, request.PaymentRequestId));
 }