Esempio n. 1
0
        public async Task <IActionResult> SaveMemberReceipt([FromBody]  MemberReceiptDTO ObjMemberReceiptDTO)
        {
            try
            {
                string OUTReceiptid = string.Empty;
                if (objSDReceipt.SaveMemberReceipt(ObjMemberReceiptDTO, Con, out OUTReceiptid))
                {
                    if (!string.IsNullOrEmpty(OUTReceiptid))
                    {
                        _GeneralReceiptReportDTO = new GeneralReceiptReportDTO();
                        _GeneralReceiptReportDTO = await _AccountingTransactionsDAL.GetgeneralreceiptReportData1(OUTReceiptid, Con);

                        _GeneralReceiptReportDTO.pCompanyInfoforReports = obj.GetcompanyNameandaddressDetails(Con);
                        return(Ok(_GeneralReceiptReportDTO));
                    }
                    else
                    {
                        return(Ok(false));
                    }
                }
                else
                {
                    return(StatusCode(StatusCodes.Status304NotModified));
                }
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError));

                throw ex;
            }
        }
        public List <MemberReceiptDTO> GetMemberReceiptDetails(string FdAccountNo, string Connectionstring)
        {
            List <MemberReceiptDTO> lstMemberReceipts = new List <MemberReceiptDTO>();
            string Query = string.Empty;

            try
            {
                Query = "select tm.membername,tm.membercode,ft.fdaccountno,to_char(fr.fd_receiptt_date, 'dd/Mon/yyyy')fd_receiptt_date,ft.depositamount,fr.instalment_amount as dueamount,fr.received_amount,fr.mode_of_receipt,fr.receipt_no,(case when tt.clearstatus = 'Y' then 'Cleared' when tt.clearstatus = 'R' then 'Returned' when tt.depositstatus = 'C' then 'Cancelled'  when tt.clearstatus IS NULL then 'Cleared' else 'Un Cleared' end)as ChequeStatus from fd_receipt fr join tblmstmembers tm on fr.member_id = tm.memberid join tbltransfdcreation ft on fr.fd_account_id = ft.fdaccountid and fr.status = true left join tbltransreceiptreference tt on tt.receiptid=fr.receipt_no where ft.fdaccountno='" + FdAccountNo + "'   order by fd_receipt_id desc;";
                using (NpgsqlDataReader dr = NPGSqlHelper.ExecuteReader(Connectionstring, CommandType.Text, Query))
                {
                    while (dr.Read())
                    {
                        MemberReceiptDTO objMemberReceiptDTO = new MemberReceiptDTO();
                        objMemberReceiptDTO.pMembername     = dr["membername"];
                        objMemberReceiptDTO.pMembercode     = dr["membercode"];
                        objMemberReceiptDTO.pFdaccountno    = dr["fdaccountno"];
                        objMemberReceiptDTO.pFdreceipttdate = dr["fd_receiptt_date"];
                        objMemberReceiptDTO.pAdvanceamount  = dr["depositamount"];
                        objMemberReceiptDTO.pReceivedamount = dr["received_amount"];
                        objMemberReceiptDTO.pModeofreceipt  = dr["mode_of_receipt"];
                        objMemberReceiptDTO.pReceiptno      = dr["receipt_no"];
                        objMemberReceiptDTO.pChequestatus   = dr["chequestatus"];
                        lstMemberReceipts.Add(objMemberReceiptDTO);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(lstMemberReceipts);
        }
Esempio n. 3
0
        public bool SaveMemberReceipt(MemberReceiptDTO ObjMemberReceiptDTO, string ConnectionString, out string OUTReceiptid)
        {
            bool          Issaved        = false;
            StringBuilder sbInsert       = new StringBuilder();
            bool          IsAccountSaved = false;

            try
            {
                con = new NpgsqlConnection(ConnectionString);
                if (con.State != ConnectionState.Open)
                {
                    con.Open();
                }
                trans = con.BeginTransaction();
                if (Savegenaralreceipt(ObjMemberReceiptDTO, trans, out OUTReceiptid))
                {
                    IsAccountSaved = true;
                }
                else
                {
                    trans.Rollback();
                    return(IsAccountSaved);
                }
                string Receiptno = OUTReceiptid;
                ObjMemberReceiptDTO.pReceiptno = Receiptno;
                if (string.IsNullOrEmpty(ObjMemberReceiptDTO.pRecordid.ToString()) || ObjMemberReceiptDTO.pRecordid == 0)
                {
                    sbInsert.Append("insert into Member_receipt (member_id, receipt_date, received_amount, mode_of_receipt, receipt_no, narration, status) values (" + ObjMemberReceiptDTO.pMemberid + ", '" + FormatDate(ObjMemberReceiptDTO.pReceiptdate) + "', " + ObjMemberReceiptDTO.pReceivedamount + ", '" + ObjMemberReceiptDTO.pModeofreceipt + "', '" + ObjMemberReceiptDTO.pReceiptno + "', '" + ObjMemberReceiptDTO.pNarration + "', true);");
                }
                if (!string.IsNullOrEmpty(sbInsert.ToString()))
                {
                    NPGSqlHelper.ExecuteNonQuery(trans, CommandType.Text, sbInsert.ToString());
                }
                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();
                }
            }
            return(Issaved);
        }
Esempio n. 4
0
        public bool Savegenaralreceipt(MemberReceiptDTO ObjMemberReceiptDTO, NpgsqlTransaction trans, out string Receiptid)
        {
            bool                      IsSaved      = false;
            StringBuilder             sbQuery      = new StringBuilder();
            AccountingTransactionsDAL Accontstrans = new AccountingTransactionsDAL();

            try
            {
                GeneralreceiptDTO Objgeneralreceipt = new GeneralreceiptDTO();
                Objgeneralreceipt.preceiptid           = "";
                Objgeneralreceipt.ppartyid             = ObjMemberReceiptDTO.pConid;
                Objgeneralreceipt.ppartyreferenceid    = ObjMemberReceiptDTO.pContactid;
                Objgeneralreceipt.ppartyreftype        = "Member Receipt";
                Objgeneralreceipt.ppartyname           = ObjMemberReceiptDTO.pMembername;
                Objgeneralreceipt.preceiptdate         = ObjMemberReceiptDTO.pReceiptdate.ToString();
                Objgeneralreceipt.pmodofreceipt        = ObjMemberReceiptDTO.pModeofreceipt;
                Objgeneralreceipt.ptotalreceivedamount = Convert.ToDecimal(ObjMemberReceiptDTO.pReceivedamount);
                Objgeneralreceipt.pnarration           = ObjMemberReceiptDTO.pNarration;
                Objgeneralreceipt.pbankname            = ObjMemberReceiptDTO.pBank;
                Objgeneralreceipt.pBankId        = ObjMemberReceiptDTO.pBankid;
                Objgeneralreceipt.pdepositbankid = ObjMemberReceiptDTO.pdepositbankid;
                Objgeneralreceipt.pbranchname    = ObjMemberReceiptDTO.pBranch;
                Objgeneralreceipt.ptranstype     = ObjMemberReceiptDTO.pTranstype;
                Objgeneralreceipt.ptypeofpayment = ObjMemberReceiptDTO.ptypeofpayment;
                Objgeneralreceipt.pChequenumber  = ObjMemberReceiptDTO.pChequenumber;
                if (ObjMemberReceiptDTO.ptypeofpayment == "Debit Card")
                {
                    Objgeneralreceipt.pchequedate = ObjMemberReceiptDTO.pReceiptdate.ToString();
                }
                else if (ObjMemberReceiptDTO.ptypeofpayment == "Credit Card")
                {
                    Objgeneralreceipt.pchequedate = ObjMemberReceiptDTO.pReceiptdate.ToString();
                }
                else
                {
                    Objgeneralreceipt.pchequedate = ObjMemberReceiptDTO.pchequedate;
                }

                Objgeneralreceipt.pCardNumber = ObjMemberReceiptDTO.pCardnumber;
                Objgeneralreceipt.pUpiid      = ObjMemberReceiptDTO.pUpiid;
                Objgeneralreceipt.pCreatedby  = ObjMemberReceiptDTO.pCreatedby;
                string             membername     = ObjMemberReceiptDTO.pMembername;
                string             membercode     = ObjMemberReceiptDTO.pMembercode;
                string             membernamecode = membercode + "_" + membername;
                List <ReceiptsDTO> preceiptslist  = new List <ReceiptsDTO>();
                ReceiptsDTO        objpreceipts   = new ReceiptsDTO();

                Int64 membershipaccountid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select accountid from tblmstaccounts  where accountname  in('MEMBERSHIP FEE') AND chracctype='2' and statusid=" + Convert.ToInt32(Status.Active) + ";"));

                int subledgerid = Convert.ToInt32(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "select insertaccounts('" + membernamecode + "', " + membershipaccountid + ", '3'," + ObjMemberReceiptDTO.pCreatedby + ")"));


                objpreceipts.psubledgerid         = subledgerid;
                objpreceipts.pledgername          = membernamecode;
                objpreceipts.ptdsamountindividual = Convert.ToDecimal(ObjMemberReceiptDTO.pReceivedamount);
                objpreceipts.pamount = Convert.ToDecimal(ObjMemberReceiptDTO.pReceivedamount);
                preceiptslist.Add(objpreceipts);
                Objgeneralreceipt.preceiptslist = preceiptslist;
                if (Accontstrans.CallsaveGeneralReceipt(Objgeneralreceipt, trans, out Receiptid))
                {
                    IsSaved = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(IsSaved);
        }