Exemple #1
0
 private function buildPlayerGroup($tech, $fleets)
 {
     $playerObj = new Player(1);
     $playerObj->setName('bot');
     $playerObj->setTech($tech['weapons'], $tech['shields'], $tech['armour']);
     foreach ($fleets as $idFleet => $fleet) {
         $fleetObj = new Fleet($idFleet);
         foreach ($fleet as $id => $count) {
             $count = floor($count);
             $id = floor($id);
             if ($count > 0 && $id > 0) {
                 $fleetObj->addShipType($this->getShipType($id, $count));
             }
         }
         if (!$fleetObj->isEmpty()) {
             $playerObj->addFleet($fleetObj);
         }
     }
     if ($playerObj->isEmpty()) {
         die("<meta http-equiv=\"refresh\" content=2;\"WebTest.php\">There should be at least an attacker and defender");
     }
     $playerGroupObj = new PlayerGroup();
     $playerGroupObj->addPlayer($playerObj);
     return $playerGroupObj;
 }
 /**
  * @see Page::readData
  */
 public function readData()
 {
     parent::readData();
     //echo ".";
     $this->fleetQueue = new FleetQueue(0);
     $this->readTarget();
     $this->specs = Spec::getBySpecType(3);
     $this->fleets = Fleet::getByUserID(WCF::getUser()->userID);
     foreach ($this->fleets as $fleetID => $fleet) {
         $this->fleets[$fleetID]->navalFormation = NavalFormation::getByFleetID($fleetID);
     }
     // backlink
     if (isset($_REQUEST['backlink'])) {
         $this->backlink = StringUtil::trim($_REQUEST['backlink']);
     }
     $array = array();
     preg_match('/^(https?:\\/\\/[^\\/]*\\/)?(.*)$/i', $this->backlink, $array);
     $this->fleetQueue->backlink = $this->backlink = isset($array[2]) ? $array[2] : '';
     //echo ".";
     // TODO: clean this one up
     $sql = "DELETE FROM ugml_galactic_jump_queue\n\t\t\t\tWHERE userID = " . WCF::getUser()->userID;
     WCF::getDB()->registerShutdownUpdate($sql);
     $sql = "INSERT INTO ugml_galactic_jump_queue (userID, startPlanetID, state, time)\n\t\t\t\tVALUES(" . WCF::getUser()->userID . ", " . LWCore::getPlanet()->planetID . ", 1, " . TIME_NOW . ")";
     WCF::getDB()->registerShutdownUpdate($sql);
 }
 /**
  * @see Form::validate()
  */
 public function validate()
 {
     parent::validate();
     if ($this->action == 'rename') {
         if (!PlanetUtil::isValid($this->newName)) {
             throw new UserInputException('newName', 'notValid');
         }
     } else {
         if ($this->action == 'delete') {
             // main planet
             if (LWCore::getPlanet()->planetID == WCF::getUser()->id_planet) {
                 throw new SystemException('tried to delete main planet');
             }
             // password
             if (!WCF::getUser()->checkPassword($this->password)) {
                 throw new UserInputException('password', 'notValid');
             }
             // check fleets (moon, if existing and planet)
             if (LWCore::getPlanet()->planetKind == 1 && LWCore::getPlanet()->getMoon() != null) {
                 if (count(Fleet::getByPlanetID(LWCore::getPlanet()->getMoon()->planetID, Fleet::OFIARA | Fleet::OWNER))) {
                     throw new UserInputException('password', 'activityMoon');
                 }
             }
             // check current
             if (count(Fleet::getByPlanetID(LWCore::getPlanet()->planetID, Fleet::OFIARA | Fleet::OWNER))) {
                 throw new UserInputException('password', 'activity');
             }
         }
     }
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     if (!WCF::getUser()->userID) {
         require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php';
         throw new PermissionDeniedException();
     }
     $this->fleet = Fleet::getInstance($this->fleetID);
     if ($this->fleet->ownerID != WCF::getUser()->userID) {
         require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php';
         throw new PermissionDeniedException();
     }
     if (!$this->fleet->getCancelDuration()) {
         require_once WCF_DIR . 'lib/system/exception/IllegalLinkException.class.php';
         throw new IllegalLinkException();
     }
     if ($this->fleet->missionID == 11) {
         $formation = $this->fleet->getNavalFormation();
     }
     $this->fleet->getEditor()->cancel();
     if ($this->fleet->missionID == 11) {
         FleetOvent::update($formation->getLeaderFleet());
     }
     $this->executed();
     header('Location: index.php?page=FleetStartShips');
     exit;
 }
Exemple #5
0
 public function post_reporthutang()
 {
     $msg = null;
     $pool_id = Auth::user()->pool_id;
     $date = Input::get('dateops', date('Y-m-d'));
     $shift_id = Input::get('shift_id');
     $page = Input::get('page');
     $limit = Input::get('rows');
     $sidx = Input::get('sidx', 'operasi_time');
     $sord = Input::get('sord', 'asc');
     if ($shift_id == 'all') {
         $count = Checkin::join('ksos', 'ksos.id', '=', 'kso_id')->where('checkins.operasi_time', '<=', $date)->where('ksos.pool_id', '=', Auth::user()->pool_id)->where('ksos.actived', '=', 1)->group_by('kso_id')->count();
     } else {
         $count = Checkin::join('ksos', 'ksos.id', '=', 'kso_id')->where('checkins.operasi_time', '<=', $date)->where('checkins.shift_id', '=', $shift_id)->where('ksos.pool_id', '=', Auth::user()->pool_id)->where('ksos.actived', '=', 1)->group_by('kso_id')->count();
     }
     if ($count > 0) {
         $total_pages = ceil($count / $limit);
     } else {
         $total_pages = 0;
     }
     if ($page > $total_pages) {
         $page = $total_pages;
     }
     $start = $limit * $page - $limit;
     if ($start < 0) {
         $start = 0;
     }
     $saldohutangbymonth = $this->sqlData($date, $pool_id, $shift_id, $start, $limit);
     $responce['page'] = $page;
     $responce['total'] = $total_pages;
     $responce['records'] = $count;
     if ($saldohutangbymonth) {
         $no = $start + 1;
         $ksavr = 0;
         $selisiavr = 0;
         $setoranopsavr = 0;
         $totalavr = 0;
         $cicilanksavr = 0;
         $dendaavr = 0;
         $cicilan_dp_ksoavr = 0;
         foreach ($saldohutangbymonth as $finan) {
             $saldosp = $finan->tabungan_sparepart + $finan->hutang_dp_sparepart + $finan->cicilan_sparepart - $finan->pemakaian_part;
             $responce['rows'][] = array('no' => $no++, 'taxi_number' => ($c = Fleet::find($finan->fleet_id)) ? $c->taxi_number : 'Body Error', 'bravo' => ($b = Driver::find($finan->bravo_driver_id)) ? $b->name : 'Bravo Error', 'shift_id' => Shift::find($finan->shift_id)->shift, 'pemakaian_sp' => $finan->pemakaian_part, 'tabungan_sp' => $finan->tabungan_sparepart, 'bayar_sp' => $finan->hutang_dp_sparepart + $finan->cicilan_sparepart, 'saldo_sp' => $saldosp, 'ks' => $finan->ks, 'bayar_ks' => $finan->cicilan_ks, 'selisi_ks' => $finan->selisi_ks, 'saldo_armada' => $saldosp + $finan->selisi_ks);
         }
     }
     return json_encode($responce);
 }
 /**
  * @see Page::readData
  */
 public function readData()
 {
     parent::readData();
     // get system
     require_once LW_DIR . 'lib/data/system/System.class.php';
     $this->systemObj = new System($this->galaxy, $this->system);
     // get planet
     $this->planetObj = $this->systemObj->getPlanet($this->planet);
     // get fleets
     $sql = "SELECT ugml_fleet.*,\r\n\t\t\t\t\tugml_naval_formation.formationID,\r\n\t\t\t\t\t\t\t\tGROUP_CONCAT(\r\n\t\t\t\t\t\t\t\t\tCONCAT(specID, ',', shipCount) \r\n\t\t\t\t\t\t\t\t\tSEPARATOR ';')\r\n\t\t\t\t\t\t\t\tAS fleet\r\n\t\t\t\tFROM ugml_fleet\r\n\t\t\t\tLEFT JOIN ugml_naval_formation\r\n\t\t\t\t\tON ugml_fleet.formationID = ugml_naval_formation.formationID\r\n\t\t    \tLEFT JOIN ugml_fleet_spec\r\n\t\t    \t\tON ugml_fleet.fleetID = ugml_fleet_spec.fleetID\r\n\t\t\t\tWHERE targetPlanetID = " . $this->planetObj->planetID . "\r\n\t\t\t\t\tOR startPlanetID = " . $this->planetObj->planetID . "\r\n\t\t\t\tGROUP BY ugml_fleet.fleetID\r\n\t\t\t\tORDER BY ugml_fleet.impactTime,\r\n\t\t\t\t\tugml_fleet.returnTime";
     $fleets = WCF::getDB()->sendQuery($sql);
     $fleetArray = array();
     require_once LW_DIR . 'lib/data/fleet/Fleet.class.php';
     while ($row = WCF::getDB()->fetchArray($fleets)) {
         $fleet = Fleet::getInstance(null, $row);
         $fleetArray += $fleet->getFleetSet($this->planetObj->planetID);
     }
     ksort($fleetArray);
     $this->fleetObjs = $fleetArray;
     // calculate needed deuterium
     // 500 * (ENTFERNUNG + 2) * 0,9 ^ STUFE * (1 + 0,001 * 0,9 ^ (STUFE + 3)) ^ (ANZEIGEN + 1)
     // check phalanx
     if ($this->galaxy != LWCore::getPlanet()->galaxy) {
         message('Unerreichbare Koordinaten!');
     }
     $range = pow(LWCore::getPlanet()->sensor_phalanx, 2) - 1;
     if ($this->system < LWCore::getPlanet()->system - $range) {
         message('Unerreichbare Koordinaten!');
     }
     if ($this->system > LWCore::getPlanet()->system + $range) {
         message('Unerreichbare Koordinaten!');
     }
     if (LWCore::getPlanet()->deuterium < $this->systemObj->getPhalanxCosts()) {
         message('Zu wenig Deuterium vorhanden!');
     }
     if ($this->planetObj->id_owner == WCF::getUser()->userID && WCF::getUser()->userID != 143) {
         message('Du kannst dich nicht selbst phalanxen!');
     }
     if (LWCore::getPlanet()->sensor_phalanx <= 0) {
         message('Unerreichbare Koordinaten!');
     }
     $this->costs = $this->systemObj->getPhalanxCosts();
     $sql = "UPDATE ugml_planets\r\n\t\t\t\tSET deuterium = deuterium - " . $this->costs . ",\r\n\t\t\t\t\tphalanx_views = phalanx_views + 1\r\n\t\t\t\tWHERE id = " . LWCore::getPlanet()->planetID;
     WCF::getDB()->registerShutdownUpdate($sql);
     LWCore::getPlanet()->deuterium -= $this->costs;
     LWCore::getPlanet()->phalanx_views++;
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     if (!WCF::getUser()->userID) {
         require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php';
         throw new PermissionDeniedException();
     }
     $this->fleet = Fleet::getInstance($this->fleetID);
     // check fleet
     if ($this->fleet->impactTime <= TIME_NOW || $this->fleet->ownerID != WCF::getUser()->userID) {
         require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php';
         throw new PermissionDeniedException();
     }
     $this->navalFormation = NavalFormationEditor::create($this->fleetID, $this->fleet->ownerID);
     $this->executed();
     header('Location: index.php?page=FleetStartShips');
     exit;
 }
 /**
  * Updates ships and resources.
  */
 public function update()
 {
     $fleetData = $this->getPoolData();
     foreach ($fleetData as &$fleetDate) {
         $fleetObj = Fleet::getInstance($fleetDate['fleetID']);
         $fleetDate['resources'] = array('metal' => $fleetObj->metal, 'crystal' => $fleetObj->crystal, 'deuterium' => $fleetObj->deuterium);
         $fleetDate['spec'] = $fleetObj->fleet;
         $fleetDate['missionID'] = $fleetObj->missionID;
     }
     if (isset($fleetData[0])) {
         $fleet0 = Fleet::getInstance($fleetData[0]['fleetID']);
         if ($fleet0->missionID == 11 && $fleetData[0]['passage'] == "flight") {
             $formation = $fleet0->getNavalFormation();
             foreach ($fleetData as $key => &$fleetDate) {
                 if (!isset($formation->fleets[$fleetDate['fleetID']])) {
                     unset($fleetData[$key]);
                 }
             }
         }
     }
     $sql = "UPDATE ugml_ovent\n\t\t\t\tSET data = '" . SerializeUtil::serialize($fleetData) . "'\n\t\t\t\tWHERE oventID = " . $this->oventID;
     WCF::getDB()->sendQuery($sql);
 }
 /**
  * Loads the information of the fleets that are in stand by at the defender planet
  */
 protected function getDefendingFleets()
 {
     // add planet
     $this->standByFleets[0] = new PhantomFleet(null, array('galaxy' => $this->getTargetPlanet()->galaxy, 'system' => $this->getTargetPlanet()->system, 'planet' => $this->getTargetPlanet()->planet, 'fleet_owner' => $this->ofiaraID, 'ownerID' => $this->ofiaraID));
     $this->standByUsers[$this->ofiaraID] = $this->standByFleets[0]->getOwner();
     // add stand-by fleets
     $sql = "SELECT ugml_fleet.*,\n\t\t\t\t\t\tGROUP_CONCAT(\n\t\t\t\t\t\t\tCONCAT(specID, ',', shipCount) \n\t\t\t\t\t\t\tSEPARATOR ';')\n\t\t\t\t\t\tAS fleet\n\t\t\t\tFROM ugml_fleet\n\t\t    \tLEFT JOIN ugml_fleet_spec\n\t\t    \t\tON ugml_fleet.fleetID = ugml_fleet_spec.fleetID\n\t\t\t\tWHERE " . $this->impactTime . " BETWEEN impactTime AND wakeUpTime\n\t\t\t\t\tAND impactTime > 0\n\t\t\t\t\tAND targetPlanetID = " . $this->targetPlanetID . "\n\t\t    \tGROUP BY ugml_fleet.fleetID";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $fleet = Fleet::getInstance(null, $row);
         $user = $fleet->getOwner();
         $this->standByFleets[$fleet->fleetID] = $fleet;
         $this->standByUsers[$fleet->ownerID] = $user;
     }
 }
 /**
  * If this was the last fleet, cancel the hole naval formation
  *  or search a new leader fleet if the cancel was this.
  *  
  * @param	int		fleet id
  */
 public function cancelFleet($fleetID)
 {
     Fleet::getInstance($fleetID)->getEditor()->update('formationID', 0);
     if ($fleetID != $this->leaderFleetID) {
         return;
     }
     if (count($this->fleets) == 1) {
         $this->getEditor()->delete();
     } else {
         $sql = "SELECT fleetID\r\n\t\t\t\t\tFROM ugml_fleet\r\n\t\t\t\t\tWHERE formationID = " . $this->formationID . "\r\n\t\t\t\t\tORDER BY fleetID ASC";
         $row = WCF::getDB()->getFirstRow($sql);
         $this->getEditor()->setLeaderFleetID($row['fleetID']);
     }
 }
Exemple #11
0
 public function get_findbyIdFleet($id = false)
 {
     if (!$id) {
         return false;
     }
     $fleet = Fleet::find($id);
     $kso = Kso::where_fleet_id($fleet->id)->first();
     $financial_fleet = DB::table('financial_report_bykso')->where('kso_id', '=', $kso->id)->first();
     $financial_fleet_part = DB::table('wo_financial_report_bykso')->where('kso_id', '=', $kso->id)->first();
     $fleet_ks = 0;
     $fleet_cicilan_ks = 0;
     $fleet_tabungan_sparepart = 0;
     $fleet_cicilan_db_kso = 0;
     $fleet_cicilan_sparepart = 0;
     $fleet_dp_sparepart = 0;
     if ($financial_fleet) {
         $fleet_ks = $financial_fleet->ks;
         $fleet_cicilan_ks = $financial_fleet->cicilan_ks;
         $fleet_tabungan_sparepart = $financial_fleet->tabungan_sparepart;
         $fleet_cicilan_db_kso = $financial_fleet->cicilan_dp_kso;
         $fleet_cicilan_sparepart = $financial_fleet->cicilan_sparepart;
         $fleet_dp_sparepart = $financial_fleet->hutang_dp_sparepart;
     }
     $total_pemakaian_part = 0;
     if ($financial_fleet_part) {
         $total_pemakaian_part = $financial_fleet_part->pemakaian_part;
     }
     $fleetinfo = array('id' => $fleet->id, 'police_number' => $fleet->police_number, 'bravo' => Driver::find($kso->bravo_driver_id)->name, 'taxi_number' => $fleet->taxi_number, 'total_ks' => number_format($fleet_ks, 2, ',', '.'), 'pembayaran_ks' => number_format($fleet_cicilan_ks, 2, ',', '.'), 'tab_sparepart' => number_format($fleet_tabungan_sparepart, 2, ',', '.'), 'dp_kso' => number_format($kso->dp, 2, ',', '.'), 'hutang_dp_kso' => number_format($kso->sisa_dp, 2, ',', '.'), 'pem_hutang_dp_kso' => number_format($fleet_cicilan_db_kso, 2, ',', '.'), 'pem_sparepart' => number_format($total_pemakaian_part, 2, ',', '.'), 'saldo_unit' => number_format($fleet_cicilan_ks + $fleet_cicilan_db_kso + $kso->dp - ($fleet_ks + $kso->sisa_dp) + ($fleet_tabungan_sparepart + $fleet_cicilan_sparepart + $fleet_dp_sparepart - $total_pemakaian_part), 2, ',', '.'), 'pembayaran_sparepart' => $fleet_cicilan_sparepart + $fleet_dp_sparepart, 'status' => $fleet->fg_blocked == 1 || $fleet->fg_bengkel == 1 ? 'Blocked' : 'Ready');
     $returndata = array('fleetinfo' => $fleetinfo);
     return json_encode($returndata);
 }
 /**
  * Save Data: Redirects the fleets
  */
 protected function redirectFleets()
 {
     $sql = "SELECT id\n    \t\t\tFROM ugml_planets\n    \t\t\tWHERE galaxy = " . $this->galaxy . "\n    \t\t\t\tAND system = " . $this->system . "\n    \t\t\t\tAND planet = " . $this->planet . "\n    \t\t\t\tAND planetKind = 1";
     $row = WCF::getDB()->getFirstRow($sql);
     $planetPlanetID = $row['id'];
     $sql = "UPDATE ugml_fleet\n    \t\t\tSET startPlanetID = " . $planetPlanetID . "\n    \t\t\tWHERE startPlanetID = " . $this->targetPlanetID;
     WCF::getDB()->sendQuery($sql);
     $sql = "UPDATE ugml_fleet\n    \t\t\tSET targetPlanetID = " . $planetPlanetID . "\n    \t\t\tWHERE targetPlanetID = " . $this->targetPlanetID;
     WCF::getDB()->sendQuery($sql);
     $sql = "SELECT ugml_fleet.*,\n\t\t\t\t\tGROUP_CONCAT(\n\t\t\t\t\t\tCONCAT(specID, ',', shipCount) \n\t\t\t\t\t\tSEPARATOR ';')\n\t\t\t\t\tAS fleet\n\t\t\t\tFROM ugml_fleet\n\t    \t\tLEFT JOIN ugml_fleet_spec\n\t    \t\t\tON ugml_fleet.fleetID = ugml_fleet_spec.fleetID\n\t    \t\tWHERE ugml_fleet.targetPlanetID = " . $planetPlanetID . "\n\t    \t\t\tAND missionID = " . $this->missionID . "\n\t    \t\t\tAND impactTime > " . $this->impactTime . "\n\t    \t\tGROUP BY ugml_fleet.fleetID";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $fleet = Fleet::getInstance(null, $row);
         $fleet->getEditor()->cancel();
     }
 }
Exemple #13
0
 public function post_findbyidafterpay()
 {
     $jsondata = Input::json();
     $checkin = Checkin::find($jsondata->id);
     $driverinfo = Driver::find($checkin->driver_id);
     $fleetinfo = Fleet::find($checkin->fleet_id);
     $kso = Kso::find($checkin->kso_id);
     $payment = Checkinfinancial::where_checkin_id($checkin->id)->get();
     $datapayment = array();
     foreach ($payment as $pay) {
         $datapayment[$pay->financial_type_id] = $pay->amount;
     }
     //km tempuh operasi
     $last_operasi = date('Y-m-d', strtotime($checkin->operasi_time . ' -1 days'));
     $last_checkin = Checkin::where_fleet_id($checkin->fleet_id)->where_operasi_time($last_operasi)->first();
     $km_tempuh = $checkin->km_fleet;
     if ($last_checkin) {
         $km_tempuh = $checkin->km_fleet - $last_checkin->km_fleet;
     }
     $returndata = array('id' => $checkin->id, 'nip' => $driverinfo->nip, 'name' => $driverinfo->name, 'taxi_number' => $fleetinfo->taxi_number, 'police_number' => $fleetinfo->police_number, 'pool_id' => $fleetinfo->pool_id, 'pool' => Pool::find($fleetinfo->pool_id)->pool_name, 'operasi_status_id' => $checkin->operasi_status_id, 'shift_id' => $checkin->shift_id, 'setoran_wajib' => $datapayment[1], 'tab_sp' => $datapayment[2], 'pot' => $datapayment[4], 'denda' => $datapayment[3], 'iuran_laka' => $datapayment[8], 'biaya_tc' => $datapayment[7], 'tag_spart' => $datapayment[5], 'tag_ks' => $datapayment[6], 'tag_cicilan_dp' => $datapayment[9], 'tag_dp_spart' => $datapayment[13], 'tag_hut_lama' => $datapayment[10], 'tag_other' => $datapayment[12], 'ks' => $datapayment[20] - ($datapayment[1] + $datapayment[2] + $datapayment[3] + $datapayment[8] + $datapayment[7] + $datapayment[5] + $datapayment[6] + $datapayment[9] + $datapayment[13] + $datapayment[10] + $datapayment[12] - $datapayment[4]), 'cash' => $datapayment[20], 'in_time' => $checkin->checkin_time, 'km_tempuh' => $km_tempuh, 'total' => $datapayment[1] + $datapayment[2] + $datapayment[3] + $datapayment[8] + $datapayment[7] + $datapayment[5] + $datapayment[6] + $datapayment[9] + $datapayment[13] + $datapayment[10] + $datapayment[12] - $datapayment[4]);
     return json_encode($returndata);
 }
Exemple #14
0
 /**
  * @see AbstractDecorator::getObject()
  */
 protected function getObject()
 {
     return Fleet::getInstance($this->fleetID);
 }
Exemple #15
0
 public function mergeFleet(Fleet $other)
 {
     foreach ($other->getIterator() as $idShipType => $shipType) {
         $this->addShipType($shipType);
     }
 }
                      <td colspan="5">Pembayaran</td>
                      <td rowspan="2">KS</td>
                      <td rowspan="2">Keterangan OPS</td>
                    </tr>
                    <tr>
                      <td>KS</td>
                      <td>SP</td>
                      <td>DP KSO</td>
                      <td>DP SP</td>
                      <td>HUT LAMA</td>
                    </tr>
              </thead>
              <tbody>
                @foreach($reports as $report)
                <?php 
$fleet = Fleet::find($report->fleet_id);
?>
                <tr>
                  <td>{{ $report->operasi_time }}</td>
                  <td>{{ $fleet->taxi_number }}</td>
                  <td class="text-right">{{ number_format($report->setoran_cash, 2, ',', '.') }}</td>
                  <td class="text-right">{{ number_format($report->denda, 2, ',', '.') }}</td>
                  <td class="text-right">{{ number_format($report->cicilan_ks, 2, ',', '.') }}</td>
                  <td class="text-right">{{ number_format($report->cicilan_sparepart, 2, ',', '.') }}</td>
                  <td class="text-right">{{ number_format($report->cicilan_dp_kso, 2, ',', '.') }}</td>
                  <td class="text-right">{{ number_format($report->hutang_dp_sparepart, 2, ',', '.') }}</td>
                  <td class="text-right">{{ number_format($report->cicilan_hutang_lama, 2, ',', '.') }}</td>
                  <td class="text-right">{{ number_format($report->ks, 2, ',', '.') }}</td>
                  <td class="text-right">{{ Statusoperasi::find($report->operasi_status_id)->kode }}</td>
                </tr>
                <?php 
Exemple #17
0
 public function post_stockspart()
 {
     $part_number = Input::get('part_number');
     $sparepart = Sparepart::where('part_number', '=', $part_number)->first();
     $data = array('status' => 0, 'data' => 'null');
     if ($sparepart) {
         $stock = DB::table('stock_sp')->where('pool_id', '=', Auth::user()->pool_id)->where('sparepart_id', '=', $sparepart->id)->first();
         $lists = DB::table('wo_listparts')->where('pool_id', '=', Auth::user()->pool_id)->where('sparepart_id', '=', $sparepart->id)->order_by('inserted_date_set', 'desc')->get();
         $xs = array();
         if ($stock) {
             $no = 1;
             foreach ($lists as $ls) {
                 $xs[] = array($no++, date('d/m/Y', strtotime($ls->inserted_date_set)), $ls->wo_number, Fleet::find($ls->fleet_id)->taxi_number, $ls->qty, $ls->satuan);
             }
             $data = array('status' => 1, 'data' => $stock, 'aaData' => $xs);
         }
     }
     return json_encode($data);
 }
Exemple #18
0
	font-size: .8em;
	font-family:Tahoma, Geneva, sans-serif;
	position: fixed;
}
#content {
	padding: 10px 10px 10px 10px;
}
h1 {
	font-size: 1.4em;
}
</style>
</head>
<body>
<?php 
$driver = Driver::find($wo->driver_id);
$fleet = Fleet::find($wo->fleet_id);
?>
<div id="KERTASSEDANG">
	<div id="content">
<table cellspacing="0" cellpadding="0" width="100%">
			  <tr>
			    <td colspan="4" align="center">BUKTI KELUAR BARANG</td>
			  </tr>
			  <tr>
			    <td colspan="4" align="center">PT. DHARMA INDAH AGUNG METROPOLITAN</td>
			  </tr>
			  <tr>
			    <td>&nbsp;</td>
			    <td></td>
			    <td></td>
			    <td></td>
Exemple #19
0
                <th>KM Keluar</th>
                <th>Waktu Masuk Pool</th>
                <th>KM Masuk</th>
                <th>Shift</th>
                <th>Status OPS</th>
                <th>Action</th>
              </tr>
            
            </thead>
            <?php 
$no = 1;
?>
              <tbody>
                @foreach($checkout as $out)
                <?php 
$fleet = Fleet::find($out->fleet_id);
?>
                <?php 
$driver = Driver::find($out->driver_id);
?>
                <tr>
                  <td>{{ $no }}</td>
                  <td>@if($fleet) {{ $fleet->taxi_number }} @endif</td>
                  <td>@if($driver) {{ $driver->nip }} @endif</td>
                  <td>@if($driver) {{ $driver->name }} @endif</td>
                  <td>{{ $out->printspj_time }}</td>
                  <td>{{ $out->checkout_time }}</td>
                  <td>
                    <?php 
$last_operasi = date('Y-m-d', strtotime($out->operasi_time . ' -1 days'));
$last_checkin = Checkin::where_fleet_id($out->fleet_id)->where_operasi_time($last_operasi)->first();
Exemple #20
0
 /**
  * Returns all fleetcontacts with this planet.
  * 
  * @return	array
  */
 public function getFleets()
 {
     $sql = "SELECT ugml_fleets.*,\r\n\t\t\t\t\tugml_naval_formation.formationID\r\n\t\t\t\tFROM ugml_fleets\r\n\t\t\t\tLEFT JOIN ugml_naval_formation_to_fleets\r\n\t\t\t\t\tON ugml_fleets.fleet_id = ugml_naval_formation_to_fleets.fleetID\r\n\t\t\t\tLEFT JOIN ugml_naval_formation\r\n\t\t\t\t\tON ugml_naval_formation_to_fleets.formationID = ugml_naval_formation.formationID\r\n\t\t\t\tWHERE startPlanetID = " . $this->planetID . "\r\n\t\t\t\t\tOR ugml_fleets.endPlanetID = " . $this->planetID;
     $result = WCF::getDB()->sendQuery($sql);
     $fleets = array();
     require_once LW_DIR . 'lib/data/fleet/Fleet.class.php';
     while ($row = WCF::getDB()->fetchArray($result)) {
         $fleet = Fleet::getInstance(null, $row);
         if ($fleet->fleet_mess == 0 || $fleet->fleet_mess == 2) {
             $fleets[$fleet->fleet_start_time . $fleet->fleetID] = $fleet;
         } else {
             $fleets[$fleet->fleet_end_time . $fleet->fleetID] = $fleet;
         }
     }
     ksort($fleets);
     return $fleets;
 }
Exemple #21
0
 public function post_otorisasi()
 {
     $input = Input::json();
     $username = $input->username;
     $password = $input->password;
     $bap_id = $input->bap_id;
     $ver2 = User::where('username', '=', $username)->first();
     if ($ver2) {
         if (Hash::check($password, $ver2->password)) {
             if ($ver2->id !== Auth::user()->id) {
                 //melihat driver_id dan fleet_id pada bap
                 $bap = Bap::find($bap_id);
                 //create log open block
                 try {
                     $open = Openblocking::create(array('bap_id' => $bap_id, 'tanggal' => date('Y-m-d H:i:s'), 'otorisasi1_id' => Auth::user()->id, 'otorisasi2_id' => $ver2->id));
                     if ($open) {
                         $driver = Driver::find($bap->driver_id);
                         $driver->fg_blocked = 0;
                         $driver->save();
                         $setor = Fleet::find($bap->fleet_id);
                         $setor->fg_setor = 0;
                         $setor->save();
                         return json_encode(array('status' => true, 'msg' => 'Otorisasi open block berhasil!'));
                     }
                 } catch (Exception $e) {
                     return json_encode(array('status' => true, 'msg' => 'Otorisasi sudah dilakukan!'));
                 }
             } else {
                 return json_encode(array('status' => false, 'msg' => 'Otorisasi harus orang yang berbeda!'));
             }
         }
     }
     return json_encode(array('status' => false, 'msg' => 'Otorisasi kedua gagal!'));
 }
Exemple #22
0
            <span class="block-icon pull-right">
                
            </span>
            <a href="#widgetGroup1" data-toggle="collapse">Daftar Armada Perserta KSO</a>       
        </div>
        <div class="block-body collapse in" id="widgetGroup1">
            
            <table class="table">
                @foreach(Pool::all() as $pool)
                <tr>
                    <td> {{$pool->pool_name}} </td>
                </tr>
                <tr>
                    <td> 
                        <?php 
$ksos = Fleet::join('ksos', 'fleets.id', '=', 'ksos.fleet_id')->where_in('ksos.actived', array(1, 2))->where('fleets.pool_id', '=', $pool->id)->get(array('ksos.id', 'fleets.taxi_number', 'fleets.id as fleet_id'));
?>
                        @foreach($ksos as $kso)
                            {{ HTML::link('ksos/ksofleet/'.$kso->fleet_id ,$kso->taxi_number,array('class'=>'btn btn-mini btn-success')) }}
                        @endforeach
                    </td>
                </tr>
                @endforeach
            </table>

        </div>
    </div>
 

@endsection
@section('otherscript')
Exemple #23
0
  padding-right: 5mm;
}
h3 {
  font-size: 13pt;
}

</style>

</head>
<body>

<div id="content">

<?php 
$driver = Driver::find($bap->driver_id);
$fleet = Fleet::find($bap->fleet_id);
?>
<table width="100%"  cellpadding="0" cellspacing="0" id="header">
  <tr>
    <td rowspan="3">{{ HTML::image('img/diantaksi.png','',array('id' => 'logo')) }}</td>
    <td>PT DHARMA INDAH AGUNG METROPOLITAN</td>
  </tr>
  <tr>
    <td><strong><u><h3>BERITA ACARA PROSES PENGEMUDI</h3></u></strong></td>
  </tr>
  <tr>
    <td> NO  :  {{ $bap->bap_number }} </td>
  </tr>
</table>

<br>
Exemple #24
0
<?php

require_once 'app_code/EveBrowserFactory.php';
require_once 'app_code/Utilities.php';
require_once 'app_code/Fleet.php';
require_once 'app_code/Alliance.php';
require_once 'app_code/DataManager.php';
$brow = EveBowserFactory::Get();
if (!($brow->IsIGB() && $brow->IsTrusted())) {
    RedirectResponse('links.php');
}
if (isset($_POST['fleetLink']) && isset($_POST['name'])) {
    $matches;
    if (preg_match('/gang:(?<id>\\d+)/', GetPost('fleetLink'), $matches)) {
        $a = Alliance::EnsureAlliance($brow->AllianceId(), $brow->AllianceName());
        $f = new Fleet();
        $f->Id = $matches['id'];
        $f->AllianceId = $a->Id;
        $f->Name = GetPost('name');
        $f->Added = time();
        if ($f->Validate()) {
            $f->Save();
            // this seems like a good place to delete old fleets
            Fleet::DeleteOldFleets();
            DataManager::GetInstance()->CloseConnection();
            RedirectResponse('links.php');
        }
    }
}
?>
Exemple #25
0
  This file is part of WOT Game.

    WOT Game is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    WOT Game is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with WOT Game.  If not, see <http://www.gnu.org/licenses/>.
*/
define('INSIDE', true);
$ugamela_root_path = '../';
include $ugamela_root_path . 'extension.inc';
include $ugamela_root_path . 'common.' . $phpEx;
if (!check_user()) {
    header("Location: login.php");
    die;
}
require_once LW_DIR . 'lib/data/fleet/Fleet.class.php';
$sql = "SELECT ugml_fleet.*,\r\n\t\t\tGROUP_CONCAT(\r\n\t\t\t\tCONCAT(specID, ',', shipCount) \r\n\t\t\t\tSEPARATOR ';')\r\n\t\t\tAS fleet\r\n\t\tFROM ugml_fleet\r\n    \tLEFT JOIN ugml_fleet_spec\r\n    \t\tON ugml_fleet.fleetID = ugml_fleet_spec.fleetID\r\n    \tWHERE startTime > UNIX_TIMESTAMP() - 60 * 60\r\n    \tGROUP BY ugml_fleet.fleetID";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
    $fleet = Fleet::getInstance(null, $row);
    $fleet->getEditor()->delete();
    echo 'done' . $row['fleetID'];
}
 /**
  * Reads the fleets that are in standby on this planet.
  */
 public function initStandByFleets()
 {
     $sql = "SELECT *,\n\t\t\t\t\t\tGROUP_CONCAT(\n\t\t\t\t\t\t\tCONCAT(specID, ',', shipCount) \n\t\t\t\t\t\t\tSEPARATOR ';')\n\t\t\t\t\t\tAS fleet\n\t\t\t\tFROM ugml_fleet\n\t\t    \t\tLEFT JOIN ugml_fleet_spec\n\t\t    \t\tON ugml_fleet.fleetID = ugml_fleet_spec.fleetID\n\t\t\t\tWHERE " . $this->impactTime . " BETWEEN impactTime AND wakeUpTime\n\t\t\t\t\tAND impactTime > 0\n\t\t\t\t\tAND targetPlanetID = " . $this->targetPlanetID . "\n\t\t    \tGROUP BY ugml_fleet.fleetID";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $fleet = Fleet::getInstance(null, $row);
         $this->estandByFleets[$fleet->fleetID] = $fleet;
     }
 }
                 {{ $fl->taxi_number }} 
                 @endif  </span></td>
              <td>( {{$bravo->nip}} ) {{$bravo->name}} </td>
              <td>@if($charlie)
                        ( {{$charlie->nip}} ) {{$charlie->name}} </td>
                      @else
                        Tidak Ada Charlie
                      @endif
            </td>
              <td>{{ HTML::link('anakasuh/remove/'.$fleet->id ,'Hapus',array('class'=>'btn btn-mini btn-success')) }}</td>
            </tr>
          @else
            <tr>
              <td>{{ $no }}</td>
              <td><span class="label label-success"><?php 
$fl = Fleet::find($fleet->fleet_id);
?>
 
                @if($fl) 
                {{ $fl->taxi_number }} 
                @endif</span></td>
              <td>Gugur KSO</td>
              <td></td>
              <td>{{ HTML::link('anakasuh/remove/'.$fleet->id ,'Hapus',array('class'=>'btn btn-mini btn-success')) }}</td>
            </tr>
          @endif
          <?php 
$no++;
?>
          @endforeach 
        </tbody>
 /**
  * method get_player_group_from_query
  * param $result
  * param $target_user
  * return the attack result
  */
 private function get_player_group_from_query($result, $target_user = false)
 {
     $playerGroup = new PlayerGroup();
     while ($fleet_row = parent::$db->fetch_assoc($result)) {
         //making the current fleet object
         $serializedTypes = explode(';', $fleet_row['fleet_array']);
         $idPlayer = $fleet_row['fleet_owner'];
         $fleet = new Fleet($fleet_row['fleet_id']);
         foreach ($serializedTypes as $serializedType) {
             list($id, $count) = explode(',', $serializedType);
             if ($id != 0 && $count != 0) {
                 $fleet->add(get_ship_type($id, $count));
             }
         }
         //making the player object and add it to playerGroup object
         if (!$playerGroup->existPlayer($idPlayer)) {
             if ($target_user !== FALSE && $target_user['id'] == $idPlayer) {
                 $player_info = $target_user;
             } else {
                 $player_info = parent::$db->query_fetch("SELECT `research_weapons_technology`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`research_shielding_technology`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`research_armour_technology`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM `" . RESEARCH . "`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `research_user_id` = '" . $idPlayer . "';");
             }
             $player = new Player($idPlayer, array($fleet));
             $player->setTech($player_info['military_tech'], $player_info['shield_tech'], $player_info['defence_tech']);
             $playerGroup->addPlayer($player);
         } else {
             $playerGroup->getPlayer($idPlayer)->addFleet($fleet);
         }
     }
     return $playerGroup;
 }
/**
 * calculateAttack()
 * Calculate the battle using OPBE.
 * 
 * OPBE ,to decrease memory usage, don't save both the initial and end state of fleets in a single round: only the end state is saved.
 * Then OPBE store the first round in BattleReport and don't start it, just to show the fleets before the battle.
 * Also,cause OPBE start the rounds without saving the initial state, the informations about how many shots were fired etc must be asked to the next round.
 * Logically, the last round can't ask the next round because there is not.
 * 
 * @param array &$attackers
 * @param array &$defenders
 * @param mixed $FleetTF
 * @param mixed $DefTF
 * @return array
 */
function calculateAttack(&$attackers, &$defenders, $FleetTF, $DefTF)
{
    //null == use default handlers
    $errorHandler = null;
    $exceptionHandler = null;
    $CombatCaps = $GLOBALS['CombatCaps'];
    $pricelist = $GLOBALS['pricelist'];
    /********** BUILDINGS MODELS **********/
    /** Note: we are transform array of data like
     *  fleetID => infos
     *  into object tree structure like
     *  playerGroup -> player -> fleet -> shipType
     */
    //attackers
    $attackerGroupObj = new PlayerGroup();
    foreach ($attackers as $fleetID => $attacker) {
        $player = $attacker['player'];
        //techs + bonus. Note that the bonus is divided by the factor because the result sum will be multiplied by the same inside OPBE
        list($attTech, $defenceTech, $shieldTech) = getTechsFromArray($player);
        //--
        $attackerPlayerObj = $attackerGroupObj->createPlayerIfNotExist($player['id'], array(), $attTech, $shieldTech, $defenceTech);
        $attackerFleetObj = new Fleet($fleetID);
        foreach ($attacker['unit'] as $element => $amount) {
            if (empty($amount)) {
                continue;
            }
            $shipType = getShipType($element, $amount);
            $attackerFleetObj->addShipType($shipType);
        }
        $attackerPlayerObj->addFleet($attackerFleetObj);
    }
    //defenders
    $defenderGroupObj = new PlayerGroup();
    foreach ($defenders as $fleetID => $defender) {
        $player = $defender['player'];
        //techs + bonus. Note that the bonus is divided by the factor because the result sum will be multiplied by the same inside OPBE
        list($attTech, $defenceTech, $shieldTech) = getTechsFromArray($player);
        //--
        $defenderPlayerObj = $defenderGroupObj->createPlayerIfNotExist($player['id'], array(), $attTech, $shieldTech, $defenceTech);
        $defenderFleetObj = getFleet($fleetID);
        foreach ($defender['unit'] as $element => $amount) {
            if (empty($amount)) {
                continue;
            }
            $shipType = getShipType($element, $amount);
            $defenderFleetObj->addShipType($shipType);
        }
        $defenderPlayerObj->addFleet($defenderFleetObj);
    }
    /********** BATTLE ELABORATION **********/
    $opbe = new Battle($attackerGroupObj, $defenderGroupObj);
    $startBattle = DebugManager::runDebugged(array($opbe, 'startBattle'), $errorHandler, $exceptionHandler);
    $startBattle();
    $report = $opbe->getReport();
    /********** WHO WON **********/
    if ($report->defenderHasWin()) {
        $won = DEFENDERS_WON;
    } elseif ($report->attackerHasWin()) {
        $won = ATTACKERS_WON;
    } elseif ($report->isAdraw()) {
        $won = DRAW;
    } else {
        throw new Exception('problem');
    }
    /********** ROUNDS INFOS **********/
    $ROUND = array();
    $lastRound = $report->getLastRoundNumber();
    for ($i = 0; $i <= $lastRound; $i++) {
        // in case of last round, ask for rebuilt defenses. to change rebuils prob see constants/battle_constants.php
        $attackerGroupObj = $lastRound == $i ? $report->getAfterBattleAttackers() : $report->getResultAttackersFleetOnRound($i);
        $defenderGroupObj = $lastRound == $i ? $report->getAfterBattleDefenders() : $report->getResultDefendersFleetOnRound($i);
        $attInfo = updatePlayers($attackerGroupObj, $attackers);
        $defInfo = updatePlayers($defenderGroupObj, $defenders);
        $ROUND[$i] = roundInfo($report, $attackers, $defenders, $attackerGroupObj, $defenderGroupObj, $i + 1, $attInfo, $defInfo);
    }
    /********** DEBRIS **********/
    //attackers
    $debAtt = $report->getAttackerDebris();
    $debAttMet = $debAtt[0];
    $debAttCry = $debAtt[1];
    //defenders
    $debDef = $report->getDefenderDebris();
    $debDefMet = $debDef[0];
    $debDefCry = $debDef[1];
    //total
    $debris = array('attacker' => array(METAL_ID => $debAttMet, CRYSTAL_ID => $debAttCry), 'defender' => array(METAL_ID => $debDefMet, CRYSTAL_ID => $debDefCry));
    /********** LOST UNITS **********/
    $totalLost = array('attacker' => $report->getTotalAttackersLostUnits(), 'defender' => $report->getTotalDefendersLostUnits());
    /********** RETURNS **********/
    return array('won' => $won, 'debris' => $debris, 'rw' => $ROUND, 'unitLost' => $totalLost);
}
Exemple #30
0
 public function ActiveFleets()
 {
     return Fleet::GetFleetsForAlliance($this->Id);
 }