예제 #1
0
 function __construct()
 {
     if (empty($_SESSION['user'])) {
         return null;
     }
     $this->companyId = $_SESSION['user']['company'];
     $this->userId = new User();
     $mDeployedVehicleList = $this->userId->getDeployedVehicleList();
     //currently running vehicles...
     $this->activationamount = $this->totalAmount = $this->totalPaidAmount = $this->amountreqfornextcycle = $this->totalRemainingAmount = 0;
     $this->vehListActivationReq = $this->vehListPayReq = $this->vehList = "";
     //calcultaion for deplyoed vehicles....
     for ($i = 0; $i < sizeof($mDeployedVehicleList); $i++) {
         $mVehicle = new Vehicle($mDeployedVehicleList[$i]);
         $this->vehListPayReq .= $mVehicle->getId() . ", ";
         $mVehPayments = new Payments($mVehicle->getId(), $this->companyId);
         if ($mVehPayments->getId() != "") {
             $this->totalAmount += $mVehPayments->getTotalAmount();
             $this->totalPaidAmount += $mVehPayments->getPaidpayment();
             $this->totalRemainingAmount += $mVehPayments->getRemainingAmount();
             if ($mVehPayments->isDue() != 0) {
                 $this->amountreqfornextcycle += $mVehPayments->isDue();
             }
         }
     }
     ///calculate amount with respect to the initate vehicels...
     $mPreviousVehicleList = $this->userId->getWaitingVehicleList();
     //previous used vehicles...
     for ($i = 0; $i < sizeof($mPreviousVehicleList); $i++) {
         $mVehicle = new Vehicle($mPreviousVehicleList[$i]);
         $this->vehListActivationReq .= $mVehicle->getId() . ", ";
         $mVehPayments = new Payments($mVehicle->getId(), $this->companyId);
         $this->activationamount += $mVehPayments->getVehicleActivationAmount();
     }
     $this->vehList = $this->vehListPayReq . $this->vehListActivationReq;
 }