Exemplo n.º 1
0
    private bool DeActivateBill(int BillID, String FlatNumber, DateTime DeactivationDate)
    {
        try
        {
            //Added by Aarshi on 16 Aug 2017 for Placing Sql Code in Bill Cycle Class
            //DataAccess dacess = new DataAccess();
            //String deactivatePlan = "update dbo.aBillCycle set CycleEnd = '" + DeactivationDate + "'  where BillID = '" + billid + "' and FlatID = '" + FlatNumber + "'";
            //bool result = dacess.Update(deactivatePlan);

            //Added by Aarshi on 16 Aug 2017 for Placing Sql Code in Bill Cycle Class
            BillCycle billCycle = new BillCycle();
            bool      result    = billCycle.UpdateDeactiveBill(DeactivationDate, BillID, FlatNumber);

            if (result == true)
            {
                lblbilltypeexist.Text = "plan deactivated Sucessfully";
            }

            else
            {
                lblbilltypeexist.Text = "plan deactivated failed";
            }

            return(true);
        }

        catch (Exception ex)
        {
            return(false);
        }
    }
Exemplo n.º 2
0
        public void ExecuteBillCycleRun(BillCycle billCycle)
        {
            var     noOfCustomersInvoiced = 0;
            decimal totalInvoiced         = 0.0m;

            OnBillCycleRunChanged(true, 0);

            var customers = GetCustomersToInvoice();

            foreach (var customer in customers)
            {
                var invoice = CreateInvoice(billCycle, customer);

                AddCustomerActiveContractsToInvoiceAndUpdateAccounts(invoice, customer);

                var prevBal = _transactionsService.GetBalanceForCustomer(invoice.CustomerId);

                if (invoice.InvoiceItems.Count > 0 || prevBal != 0)
                {
                    invoice.PreviousBalance = prevBal;
                    _invoiceRepository.Add(invoice);
                    totalInvoiced += invoice.InvoicedTotal;
                    noOfCustomersInvoiced++;
                    OnBillCycleRunChanged(true, noOfCustomersInvoiced);
                }
            }

            AddBillCycleRun(billCycle, noOfCustomersInvoiced, totalInvoiced);
            UpdateLastBillCycle(billCycle);

            OnBillCycleRunChanged(false, noOfCustomersInvoiced);
        }
Exemplo n.º 3
0
    public static List <string> GetFlatNumber(string FlatNumber)
    {
        //Added by Aarshi on 17 Aug 2017 for code restructuring
        List <string> Flat      = new List <string>();
        BillCycle     billCycle = new BillCycle();

        Flat = billCycle.GetFlatNumber(FlatNumber);
        return(Flat);
    }
Exemplo n.º 4
0
 private static Invoice CreateInvoice(BillCycle billCycle, Customer customer)
 {
     return(new Invoice
     {
         CustomerId = customer.CustomerId,
         BillCycle = billCycle,
         InvoiceItems = new List <InvoiceItem>(),
         PostedItems = new List <InvoicePosted>(),
         InvoiceDate = DateTime.Today
     });
 }
Exemplo n.º 5
0
        private void AddBillCycleRun(BillCycle billCycle, int noOfCustomersInvoiced, decimal totalInvoiced)
        {
            var bcr = new BillCycleRun
            {
                BillCycle             = billCycle,
                AmountInvoiced        = totalInvoiced,
                NoOfCustomersInvoiced = noOfCustomersInvoiced,
                DateOfRun             = DateTime.Today
            };

            _billCycleRunRepository.Add(bcr);
        }
Exemplo n.º 6
0
    protected void SocietyBillPlan_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        try
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRowView drv = e.Item.DataItem as DataRowView;
                if (drv != null)
                {
                    string ID = drv.Row[0].ToString();
                }

                Label lbl = (Label)e.Item.FindControl("lblBillEntity");

                String lablstatus = lbl.Text;

                if (lablstatus == "1")
                {
                    lbl.Text = "All";
                }
                if (lablstatus == "0")
                {
                    lbl.Text = "Selected";
                }

                Label  lblID  = (Label)e.Item.FindControl("lblID");
                String lablID = lblID.Text;


                //Added by Aarshi on 17 Aug 2017 for code restructuring
                BillCycle billCycle = new BillCycle();
                int       Count     = billCycle.GetFlatIDCount(lablID);

                Label lblcounttext = (Label)e.Item.FindControl("lblcount");
                lblcounttext.Text = Count.ToString();
            }
        }
        catch (Exception ex)
        {
            Utility.log("Bill Plan Data Bound Error :" + ex.Message);
        }
    }
Exemplo n.º 7
0
 private void UpdateLastBillCycle(BillCycle billCycle)
 {
     _miscService.UpdateValue(MiscIdentifier.LastBillCycle, billCycle.ToString());
 }
Exemplo n.º 8
0
 public override bool IsBillableThisCycle(BillCycle billCycle)
 {
     return(base.IsBillableThisCycle(billCycle) && !ContractType.HideFromInvoice);
 }
Exemplo n.º 9
0
 public virtual IEnumerable <Contract> GetListOfContractsToBill(BillCycle billCycle)
 {
     return(AttachedContracts.Where(attachedContract => attachedContract.IsBillableThisCycle(billCycle)));
 }
Exemplo n.º 10
0
 public Contract()
 {
     LastBilled = new BillCycle();
 }
Exemplo n.º 11
0
 public virtual bool IsBillableThisCycle(BillCycle billCycle)
 {
     return((LastBilled.Date == ConstantValues.MinDate && !IsContractScheduledBeyondDate(billCycle.Date)) || ((billCycle.BillCycleNo - LastBilled.BillCycleNo) == PaymentPeriod.PeriodInMonths && IsContractActiveOnDate(billCycle.Date)));
 }
Exemplo n.º 12
0
    protected void btnBillcycleSubmit_Click(object sender, EventArgs e)//Activated Bill
    {
        DataAccess dacess = new DataAccess();

        Double Amount      = 0;
        String Description = "";
        Double PrevBalance = 0;

        String billType = HiddenField2.Value;

        //Added by Aarshi on 17 Aug 2017 for code restructuring
        BillPlan billPlan = new BillPlan();
        int      billid   = billPlan.GetBillID(billType);

        String   CycleStart = txtCyclestart.Text;
        String   CycleEnD   = txtCycleend.Text;
        String   ChargeType = HiddenFieldChargeType.Value;
        DateTime Date       = Utility.GetCurrentDateTimeinUTC();
        String   CycleType  = labelcycletype.Text;
        String   Rate       = labelRate.Text;
        String   FlatNumber = lblFlatNumber.Text;



        //Added by Aarshi on 17 Aug 2017 for code restructuring
        BillCycle billCycle = new BillCycle();
        //   int ID = billCycle.GetFlatID(FlatNumber);
        int ID    = Convert.ToInt32(FlatNumber);
        int count = 0;

        if (ID != 0)
        {
            DateTime startdate = DateTime.ParseExact(CycleStart, "dd-MM-yyyy", null);
            DateTime enddate   = DateTime.ParseExact(CycleEnD, "dd-MM-yyyy", null);

            //BillCycle billCycle = new BillCycle();
            // Bill.ActivateBillForFlat(Convert.ToInt32(billid), FlatNumber, Convert.ToDateTime(CycleStart), Convert.ToDateTime(CycleEnD));
            //  bool result = true;   // = billCycle.AddSingleFlatBillCycle(Convert.ToInt32(billid), FlatNumber, Convert.ToDateTime(startdate), Convert.ToDateTime(enddate), "Activate Bill");

            GenerateBill genBill = new GenerateBill();
            genBill.AmountTobePaid       = Convert.ToInt32(Rate);
            genBill.AmountPaid           = 0;
            genBill.AmountPaidDate       = DateTime.Now;
            genBill.BillDescription      = Description;
            genBill.BillEndDate          = enddate;
            genBill.BillMonth            = enddate;
            genBill.BillTypeID           = 5;
            genBill.BillStartDate        = DateTime.UtcNow;
            genBill.CurrentBillAmount    = 500;
            genBill.ActionType           = "Activate";
            genBill.Activated            = 1;
            genBill.CycleType            = "Quaterly";
            genBill.FlatID               = ID;
            genBill.InvoiceID            = "";
            genBill.ModifiedAt           = DateTime.UtcNow;
            genBill.PaymentDueDate       = DateTime.UtcNow.AddDays(7);
            genBill.PaymentMode          = "";
            genBill.PreviousMonthBalance = 0;
            genBill.SocietyBillID        = 2;
            genBill.SocietyID            = 1;
            genBill.TransactionID        = "";


            genBill.op_BillType = "";

            Bill bill = new Bill();

            //bool isInserted = bill.InsertNewBillPay(genBill);



            /*  if (result)
             * {
             *   // count = Bill.InsertFirstZeroBill(FlatNumber, billid, CycleType, CycleStart);
             * }*/
        }

        else
        {
            lblbilltypeexist.Text = FlatNumber + " is Not Exist with this Society";
        }


        if (count == 1)
        {
            lblbilltypeexist.Text = "Bill Generated Sucessfully";
        }

        else
        {
            lblbilltypeexist.Text = "Bill Generated Failed";
        }


        LoadActivatedBill();
    }