/** * * @static * @param FolioImportProgrammedPayment folioImportProgrammedPayment * @param array $fields */ public static function populate($folioImportProgrammedPayment, $fields) { parent::populate($folioImportProgrammedPayment, $fields); if (!$folioImportProgrammedPayment instanceof FolioImportProgrammedPayment) { static::throwException("El objecto no es un FolioImportProgrammedPayment"); } if (isset($fields['id_folios_import_programmed_payment'])) { $folioImportProgrammedPayment->setIdFoliosImportProgrammedPayment($fields['id_folios_import_programmed_payment']); } if (isset($fields['id_folio_import'])) { $folioImportProgrammedPayment->setIdFolioImport($fields['id_folio_import']); } if (isset($fields['id_programmed_payment'])) { $folioImportProgrammedPayment->setIdProgrammedPayment($fields['id_programmed_payment']); } if (isset($fields['concept'])) { $folioImportProgrammedPayment->setConcept($fields['concept']); } if (isset($fields['doc_num'])) { $folioImportProgrammedPayment->setDocNum($fields['doc_num']); } if (isset($fields['doc_entry'])) { $folioImportProgrammedPayment->setDocEntry($fields['doc_entry']); } }
/** * * @static * @param ProformaInvoiceProgrammedPayment proformaInvoiceProgrammedPayment * @param array $fields */ public static function populate($proformaInvoiceProgrammedPayment, $fields) { parent::populate($proformaInvoiceProgrammedPayment, $fields); if (!$proformaInvoiceProgrammedPayment instanceof ProformaInvoiceProgrammedPayment) { static::throwException("El objecto no es un ProformaInvoiceProgrammedPayment"); } if (isset($fields['id_proforma_invoice_programmed_payment'])) { $proformaInvoiceProgrammedPayment->setIdProformaInvoiceProgrammedPayment($fields['id_proforma_invoice_programmed_payment']); } if (isset($fields['id_proforma_invoice_payment_term'])) { $proformaInvoiceProgrammedPayment->setIdProformaInvoicePaymentTerm($fields['id_proforma_invoice_payment_term']); } if (isset($fields['id_programmed_payment'])) { $proformaInvoiceProgrammedPayment->setIdProgrammedPayment($fields['id_programmed_payment']); } if (isset($fields['pieces'])) { $proformaInvoiceProgrammedPayment->setPieces($fields['pieces']); } if (isset($fields['id_proforma_invoice'])) { $proformaInvoiceProgrammedPayment->setIdProformaInvoice($fields['id_proforma_invoice']); } if (isset($fields['id_proforma_invoice_entry'])) { $proformaInvoiceProgrammedPayment->setIdProformaInvoiceEntry($fields['id_proforma_invoice_entry']); } if (isset($fields['line'])) { $proformaInvoiceProgrammedPayment->setLine($fields['line']); } }
/** * * @param CondensedProgrammedPaymentCollection $condensedPayments * @param PurchaseOrderProgrammedPaymentCollection $purchaseOrderProgrammedPayments * @param ProformaInvoiceProgrammedPaymentCollection $proformaInvoiceProgrammedPayments * @return CondensedProgrammedPaymentCollection */ private function generateMissingPurchaseOrderProgrammedPayments(CondensedProgrammedPaymentCollection $condensedPayments, PurchaseOrderProgrammedPaymentCollection $purchaseOrderProgrammedPayments, ProformaInvoiceProgrammedPaymentCollection $proformaInvoiceProgrammedPayments) { $purchaseOrders = $this->getPurchaseOrderCollection(); $purchaseOrderPaymentTerms = PurchaseOrderPaymentTermQuery::create()->whereAdd(PurchaseOrderPaymentTerm::ID_PURCHASE_ORDER_PAYMENT_TERM, $purchaseOrderProgrammedPayments->getPurchaseOrderPaymentTermIds(), ProformaInvoicePaymentTermQuery::NOT_IN)->whereAdd(PurchaseOrderPaymentTerm::ID_PROFORMA_INVOICE_PAYMENT_TERM, $proformaInvoiceProgrammedPayments->getProformaInvoicePaymentTermIds(), ProformaInvoicePaymentTermQuery::NOT_IN)->whereAdd(PurchaseOrderPaymentTerm::ID_PURCHASE_ORDER, $purchaseOrders->getPrimaryKeys())->actives()->find(); $proformaInvoicePaymentTerms = ProformaInvoicePaymentTermQuery::create()->find(); $purchaseOrderMissingProgrammedPaymentCollection = new PurchaseOrderProgrammedPaymentCollection(); $i = 0; while ($purchaseOrderPaymentTerm = $purchaseOrderPaymentTerms->read()) { $purchaseOrder = $purchaseOrders->getByPK($purchaseOrderPaymentTerm->getIdPurchaseOrder()); $programmedPayment = ProgrammedPaymentFactory::createFromArray(array('id_programmed_payment' => 'VPP' . $purchaseOrderPaymentTerm->getIdPurchaseOrderPaymentTerm(), 'id_currency' => $purchaseOrderPaymentTerm->getCurrency(), 'id_company' => $purchaseOrder->getIdSupplier(), 'type' => ProgrammedPayment::$TypePayment['PurchaseOrder'], 'ammount' => $purchaseOrderPaymentTerm->getAmount(), 'folio' => 'Not Available', 'due_date' => 'Not Available', 'status' => ProgrammedPayment::$TypeStatus['Virtual'])); $this->getVirtualProgrammedPaymentCollection()->append($programmedPayment); $purchaseOrderMissingProgrammedPayment = PurchaseOrderProgrammedPaymentFactory::createFromArray(array('id_purchase_order_programmed_payment' => 'VPOPP' . $purchaseOrderPaymentTerm->getIdPurchaseOrderPaymentTerm(), 'id_proforma_invoice_payment_term' => $purchaseOrderPaymentTerm->getIdProformaInvoicePaymentTerm(), 'id_purchase_order_payment_term' => $purchaseOrderPaymentTerm->getIdPurchaseOrderPaymentTerm(), 'id_programmed_payment' => $programmedPayment->getIdProgrammedPayment(), 'pieces' => $purchaseOrderPaymentTerm->getPieces(), 'id_purchase_order' => $purchaseOrderPaymentTerm->getIdPurchaseOrder(), 'line' => $purchaseOrderPaymentTerm->getLine()) + $programmedPayment->toArray()); // $proformaInvoiceMissingProgrammedPayment->setIdProgrammedPayment($programmedPayment->getIdProgrammedPayment()); $purchaseOrderMissingProgrammedPaymentCollection->append($purchaseOrderMissingProgrammedPayment); $i++; } // print_r($this->condensePurchasePayments($purchaseOrderMissingProgrammedPaymentCollection, $proformaInvoicePaymentTerms));die; $condensedPayments = $condensedPayments->merge($this->condensePurchasePayments($purchaseOrderMissingProgrammedPaymentCollection, $proformaInvoicePaymentTerms)); return $condensedPayments; }
/** * * makeBean * @param array $resultset * @return \Application\Model\Bean\ProgrammedPayment */ protected function makeBean($resultset) { return ProgrammedPaymentFactory::createFromArray($resultset); }