Example #1
0
 /**
  * Generate PO | PO PLUS | PO Normal | Purchaseorder
  * PO PLUS ['POA.'.date('ymdhis')] -> PO DENGAN LIMIT HARGA
  * PO Normal ['PO.'.date('ymdhis')] -> PO Dengan Persetujuan orderby | RequestOrder|SalesOrder
  * @author ptrnov  <*****@*****.**>
  * @since 1.1
  */
 public function generatepo_saved()
 {
     $poHeader = new Purchaseorder();
     if ($this->validate()) {
         $poHeader->KD_PO = $this->PO_GNR == 0 ? 'PO.' . date('ymdhis') : 'POA.' . date('ymdhis');
         $poHeader->STATUS = '0';
         $poHeader->CREATE_AT = date("Y-m-d H:i:s");
         $poHeader->CREATE_BY = Yii::$app->user->identity->EMP_ID;
         if ($poHeader->save()) {
             $this->PO_RSLT = $poHeader->KD_PO;
             return $poHeader->KD_PO;
         }
         return $poHeader->KD_PO;
     }
     return null;
 }
Example #2
0
 /**
  * Generate PO | PO PLUS | PO Normal | Purchaseorder
  * PO PLUS ['POA.'.date('ymdhis')] -> PO DENGAN LIMIT HARGA
  * PO Normal ['PO.'.date('ymdhis')] -> PO Dengan Persetujuan orderby | RequestOrder|SalesOrder
  * @author ptrnov  <*****@*****.**>
  * @since 1.1
  */
 public function generatepo_saved()
 {
     $this->poRSLT = \Yii::$app->ambilkonci->getPoCode($this->kD_CORP, $this->pARENT_PO);
     $poHeader = new Purchaseorder();
     if ($this->validate()) {
         $poHeader->KD_PO = $this->poRSLT;
         $poHeader->KD_CORP = $this->kD_CORP;
         $poHeader->PARENT_PO = $this->pARENT_PO == 'POC' ? 1 : 0;
         $poHeader->STATUS = '0';
         $poHeader->CREATE_AT = date("Y-m-d H:i:s");
         $poHeader->CREATE_BY = Yii::$app->user->identity->EMP_ID;
         if ($poHeader->save()) {
             return $this->poRSLT;
         }
         return $this->poRSLT;
     }
     return null;
 }