Example #1
0
 public void billComputation(Object[] space, DateTime dueDate, ref List<Object[]> gas, ref List<Object[]> ele, ref List<Object[]> wat) {
     BillCalculation bill = new BillCalculation(parkId, (int)space[0], dueDate);
     Object[] info = bill.generateUtilReport();
     Dictionary<String, int> read = bill.meterRead;
     gas.Add(new Object[] { bill.tenantInfo["OrderID"], read["PrevGasReadValue"], read["GasReadValue"], info[0] });
     ele.Add(new Object[] { bill.tenantInfo["OrderID"], read["PrevEleReadValue"], read["EleReadValue"], info[1] });
     wat.Add(new Object[] { bill.tenantInfo["OrderID"], read["PrevWatReadValue"], read["WatReadValue"], info[2] });
 }
Example #2
0
        private void readDate_SelectedIndexChanged(object sender, EventArgs e)
        {
            meterReadId = ((CommonTools.Item)readDate.SelectedItem).Value;
            Object[] read = DatabaseControl.getSingleRecord(new String[] { "DueDate", "StartDate", "MeterReadDate" },
                DatabaseControl.meterReadsTable, "MeterReadID=@value0", new Object[] { meterReadId });
            BillCalculation bill = new BillCalculation(parkId, parkSpaceId, (DateTime)read[0]);
            dueDate = (DateTime)read[0];
            Object[] previous = DatabaseControl.getSingleRecord(new String[] { "ParkSpaceID" },
                DatabaseControl.spaceTable, "ParkID=@value0 AND OrderID=@value1 AND MoveInDate<=@value2 AND MoveOutDate>=@value3",
                new Object[] { parkId, orderId, read[1], read[2] });
            if (previous != null) {
                parkSpaceId = (int)previous[0];
                String[] fields = { "Tenant", "Address1", "Address2", "City", "State", "Zip" };
                String condition = "ParkSpaceID=@value0";
                object[] tenant = DatabaseControl.getSingleRecord(fields, DatabaseControl.spaceTable, condition, new Object[] { this.parkSpaceId });
                Object movedOut = DatabaseControl.getSingleRecord(new String[] { "MoveOutDate" }, DatabaseControl.spaceTable, condition, new Object[] { this.parkSpaceId })[0];
                if (movedOut == DBNull.Value) { moveOut.Visible = true; } else { moveOut.Visible = false; }
                tenantInfo.Text = String.Format("{0}\tSpace # {6}\n{1}\n{3}, {4} {5}", tenant, orderId);
            }

            parkMessage = DatabaseControl.getSingleRecord(new String[] { "TopMessage", "BotMessage" }, DatabaseControl.messageTable,
                "ParkID=@value0 AND DueDate=@value1", new Object[] { parkId, dueDate });
            if (parkMessage == null) parkMessage = DatabaseControl.getSingleRecord(new String[] { "TopMessage", "BotMessage" }, DatabaseControl.messageTable,
                "ParkID=@value0 ORDER BY DueDate DESC", new Object[] { parkId });
            topMessageInput.Text = parkMessage[0].ToString();
            botMessageInput.Text = parkMessage[1].ToString();
            displayBill(bill.generateBill(), (DateTime)read[0]);
        }
Example #3
0
        private void billComputation(Object[] space, DateTime dueDate)
        {
            BillCalculation bill = new BillCalculation(parkId, (int)space[0], dueDate);
            Object[] info = bill.generateBill();
            decimal gasTotal, eleTotal, watTotal;
            gasTotal = (decimal)((Object[])info[5])[2];
            eleTotal = (decimal)((Object[])info[6])[2];
            watTotal = (decimal)((Object[])info[7])[2];
            List<Object[]> summary = getSummaryOfCharges((int)space[0], dueDate);
            List<Object[]> temporary = getTempCharges((int)space[0], bill.start, bill.end, bill.dueDate);
            List<Object[]> charges = new List<Object[]>();
            foreach (Object[] charge in summary) charges.Add(charge);
            foreach (Object[] charge in temporary) charges.Add(charge);
            charges.Add(new Object[] { "Utilities", gasTotal + eleTotal + watTotal });
            info[3] = parkInfo;
            info[8] = charges;
            info[11] = parkMessage;

            //PdfControl.createBillPdf((int)space[0], info);
            //PdfControl.createBillPrint((int)space[0], info);
            Object[] usage = (Object[])info[4];

            String condition = "ParkSpaceID=@value0 AND DueDate=@value1";
            DatabaseControl.deleteRecords(DatabaseControl.spaceBillTable, condition,
                new Object[] { (int)space[0], bill.dueDate });
            DatabaseControl.deleteRecords(DatabaseControl.spaceChargeTable, condition,
                new Object[] { (int)space[0], bill.dueDate});
            DatabaseControl.deleteRecords(DatabaseControl.spaceTempChargeTable, condition,
                new Object[] { (int)space[0], bill.dueDate });

            Object[] utilUsage = (Object[])usage[0];
            Object[] gasReads = (Object[])usage[1];
            Object[] eleReads = (Object[])usage[2];
            Object[] watReads = (Object[])usage[3];

            Object[] values = { (int)space[0], bill.dueDate, gasReads[3], gasReads[4], utilUsage[1], gasTotal, eleReads[3], eleReads[4], utilUsage[4], eleTotal, watReads[3], watReads[4], utilUsage[7], watTotal };
            DatabaseControl.executeInsertQuery(DatabaseControl.spaceBillTable, DatabaseControl.spaceBillColumns, values);
            foreach (Object[] item in summary) {
                values = new Object[] { (int)space[0], bill.dueDate, item[0], item[1], item[2] };
                DatabaseControl.executeInsertQuery(DatabaseControl.spaceChargeTable, DatabaseControl.spaceChargeColumns, values);
            }
            foreach (Object[] item in temporary) {
                if (item[0].ToString().Equals("Utilities")) continue;
                values = new Object[] { (int)space[0], bill.dueDate, item[0], item[1] };
                DatabaseControl.executeInsertQuery(DatabaseControl.spaceTempChargeTable, DatabaseControl.spaceTempChargeColumns, values);
            }
        }