Exemplo n.º 1
0
        int IPaymentService.SaveOrUpdateCollection(PaymentCollectionDTO paymentCollection)
        {
            paymentcollection paymentcollectionEntity = new paymentcollection();
            AutoMapper.Mapper.Map(paymentCollection, paymentcollectionEntity);

            if (paymentCollection.PC_Id == 0)
            {
                base.PaymentCollectionRepository.Save(paymentcollectionEntity);
            }
            else
            {
                base.PaymentCollectionRepository.Update(paymentcollectionEntity);
            }
            return paymentcollectionEntity.PC_Id;
        }
    /// <summary>
    /// Save new collection details
    /// </summary>
    /// <param name="previousCollectionId">Collection Id for cancelled collection</param>
    private int SaveNewCollection(int previousCollectionId)
    {
        int paymentMode = Convert.ToInt32(ViewState[Globals.StateMgmtVariables.PAYMENTMODE]);

        PaymentCollectionDTO paymentCollection = new PaymentCollectionDTO();

        paymentCollection.PC_ReceiptNo = string.Format("{0}/{1}/{2}/{3}",
            DateTime.Now.Year.ToString(), DateTime.Now.Month.ToString(),
            DateTime.Now.Day.ToString(), GetLeadingZeroesForReceiptNumber());

        paymentCollection.PC_CustId = Convert.ToInt32(ViewState[Globals.StateMgmtVariables.CUSTOMERID]);
        paymentCollection.PC_ReceiptDate = DateTime.Now;
        paymentCollection.PC_Amount = Convert.ToDecimal(txtAmount.Text);

        ////If Payment mode is Cheque, DD and RTGS
        if (paymentMode != (int)HelperClass.PaymentModes.CASH)
        {
            paymentCollection.PC_InstrumentNo = txtInstrumentNumber.Text.Trim();
            paymentCollection.PC_BankDrawn = Convert.ToInt32(ddlBankDrawn.SelectedItem.Value);
            paymentCollection.PC_BankBranch = txtBranchName.Text.Trim();
            paymentCollection.PC_InstrumentDate = Convert.ToDateTime(txtInstrumentDate.Text);
        }

        ////If Payment mode is RTGS
        if (paymentMode == (int)HelperClass.PaymentModes.RTGSTRANSFER)
        {
            //Get details for IFSC code
            paymentCollection.PC_BankIFSCCode = txtIFSCCode.Text.Trim();

            txtPayerName.Text = Convert.ToString(ViewState[Globals.StateMgmtVariables.CUSTOMERNAME]);
            txtMobileNo.Text = txtValidationValue.Text;
        }

        ////If its reissue of a cancelled collection
        if (previousCollectionId > 0)
        {
            ////Get previous collection Id and set it in old receipt no column in database
            paymentCollection.PC_OldReceiptId = previousCollectionId;
        }

        paymentCollection.PC_PaymentMode = paymentMode;
        paymentCollection.PC_PayerName = txtPayerName.Text.Trim();
        paymentCollection.PC_MobileNumber = txtMobileNo.Text.Trim();
        paymentCollection.PC_Remark = txtRemarks.Text.Trim();
        paymentCollection.PC_ReprintCount = 0;
        paymentCollection.PC_CreatedBy = base.GetCurrentUserId();
        paymentCollection.PC_CreatedDate = DateTime.Now;

        //Saves payment collection details in database
        return ESalesUnityContainer.Container.Resolve<IPaymentService>().
            SaveOrUpdateCollection(paymentCollection);
    }
 private void UpdateCollectionDetailsForRePrint(PaymentCollectionDTO paymentCollectionDetails)
 {
     paymentCollectionDetails.PC_ReprintCount += 1;
     paymentCollectionDetails.PC_ReceiptNo = paymentCollectionDetails.PC_Id.ToString();
     paymentCollectionDetails.PC_LastPrintDate = DateTime.Now;
     ESalesUnityContainer.Container.Resolve<IPaymentService>().SaveOrUpdateCollection(paymentCollectionDetails);
 }
Exemplo n.º 4
0
 PaymentCollectionDTO IPaymentService.GetCollectionDetailsByOldReceiptNo(int oldReceiptNo)
 {
     PaymentCollectionDTO paymentCollection = new PaymentCollectionDTO();
     AutoMapper.Mapper.Map(base.PaymentCollectionRepository.GetSingle(item =>
         item.PC_OldReceiptId == oldReceiptNo), paymentCollection);
     return paymentCollection;
 }
    private void SetReportParameters(PaymentCollectionDTO paymentCollectionDetails, ReportViewer reportViewer, bool isRePrint)
    {
        string amount = Convert.ToString(paymentCollectionDetails.PC_Amount);
        ReportParameter rpReceiptNo = new ReportParameter("ReceiptNo", Convert.ToString(paymentCollectionDetails.PC_Id));
        ReportParameter rpReceiptDate = new ReportParameter("ReceiptDate", String.Format("{0:dd/MM/yyyy}", 
            Convert.ToString(paymentCollectionDetails.PC_ReceiptDate)));
        ReportParameter rpCustomerCode = new ReportParameter("CustomerCode", paymentCollectionDetails.CustomerCode);
        ReportParameter rpTradeName = new ReportParameter("TradeName", paymentCollectionDetails.CustomerTradeName);
        ReportParameter rpCustomerName = new ReportParameter("CustomerName", Convert.ToString(paymentCollectionDetails.CustomerName));
        ReportParameter rpDistrictName = new ReportParameter("DistrictName", Convert.ToString(paymentCollectionDetails.CustomerDistrict));
        ReportParameter rpAmount = new ReportParameter("Amount", amount);
        CurrencyConvertor currencyConvertor = new CurrencyConvertor();
        string amountInWords = currencyConvertor.Convertor(string.Format("{0:0.00}", amount));
        ReportParameter rpAmountInWords = new ReportParameter("AmountInWords", amountInWords);
        ReportParameter rpInstrumentType = new ReportParameter("InstrumentType", Convert.ToString(paymentCollectionDetails.PaymentModeName));
        ReportParameter rpInstrumentNumber = new ReportParameter("InstrumentNumber", Convert.ToString(paymentCollectionDetails.PC_InstrumentNo));
        ReportParameter rpInstrumentDate = new ReportParameter("InstrumentDate", Convert.ToDateTime(paymentCollectionDetails.PC_InstrumentDate).ToString("dd/MMM/yyyy"));
        ReportParameter rpBankDrawn = new ReportParameter("BankDrawn", Convert.ToString(ESalesUnityContainer.Container.Resolve<IMasterService>().GetBanksDetailsById(Convert.ToInt32(paymentCollectionDetails.PC_BankDrawn)).Bank_Name));
        ReportParameter rpBankBranch = new ReportParameter("BranchName", Convert.ToString(paymentCollectionDetails.PC_BankBranch));
        ReportParameter rpPayer = new ReportParameter("Payer", Convert.ToString(paymentCollectionDetails.PC_PayerName));
        ReportParameter rpPayerMobileNumber = new ReportParameter("PayerMobileNumber", Convert.ToString(paymentCollectionDetails.PC_MobileNumber));
        ReportParameter rpPrintNumber = new ReportParameter("PrintNumber", Convert.ToString(GetPrintName(isRePrint == true ? (paymentCollectionDetails.PC_ReprintCount + 1) : paymentCollectionDetails.PC_ReprintCount)));

        reportViewer.LocalReport.SetParameters(new ReportParameter[] {rpReceiptNo, 
            rpReceiptDate, rpCustomerCode, rpTradeName, rpCustomerName, rpDistrictName,
            rpAmount, rpAmountInWords, rpInstrumentType, rpInstrumentNumber, 
            rpInstrumentDate, rpBankDrawn, rpBankBranch, rpPayer, 
            rpPayerMobileNumber,rpPrintNumber});
    }