update
This commit is contained in:
@@ -119,6 +119,8 @@ class EcmInvoiceOut extends SugarBean {
|
||||
var $total_netto;
|
||||
var $total_brutto;
|
||||
var $vats_summary;
|
||||
var $payment_date;
|
||||
var $currency_value;
|
||||
// RELATED FIELDS
|
||||
var $created_by;
|
||||
var $created_by_name;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
@@ -96,44 +96,52 @@ if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
********************************************************************************/
|
||||
|
||||
$json = getJSONobj();
|
||||
require_once("modules/EcmInvoiceOuts/EcmInvoiceOut.php");
|
||||
require_once('include/formbase.php');
|
||||
$focus = new EcmInvoiceOut();
|
||||
$json = getJSONobj();
|
||||
require_once("modules/EcmInvoiceOuts/EcmInvoiceOut.php");
|
||||
require_once('include/formbase.php');
|
||||
$focus = new EcmInvoiceOut();
|
||||
|
||||
|
||||
|
||||
if(isset($_POST['record']) && $_POST['record'] != '') {
|
||||
$focus->retrieve($_POST['record']);
|
||||
if (isset($_POST['record']) && $_POST['record'] != '') {
|
||||
$focus->retrieve($_POST['record']);
|
||||
}
|
||||
|
||||
|
||||
$check_notify = FALSE;
|
||||
|
||||
foreach ($focus->column_fields as $field) {
|
||||
if (isset($_POST[$field])) {
|
||||
$value = $_POST[$field];
|
||||
$focus->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$focus->ACLAccess('Save')){
|
||||
ACLController::displayNoAccess(true);
|
||||
sugar_cleanup(true);
|
||||
foreach ($focus->additional_column_fields as $field) {
|
||||
if (isset($_POST[$field])) {
|
||||
$value = $_POST[$field];
|
||||
$focus->$field = $value;
|
||||
}
|
||||
$check_notify = FALSE;
|
||||
}
|
||||
|
||||
foreach($focus->column_fields as $field){
|
||||
if(isset($_POST[$field])){
|
||||
$value = $_POST[$field];
|
||||
$focus->$field = $value;
|
||||
}
|
||||
}
|
||||
$focus->position_list = $json->decode(htmlspecialchars_decode($_POST['position_list']));
|
||||
// die(var_dump( $focus->position_list));
|
||||
$focus->save($check_notify);
|
||||
|
||||
foreach($focus->additional_column_fields as $field){
|
||||
if(isset($_POST[$field])){
|
||||
$value = $_POST[$field];
|
||||
$focus->$field = $value;
|
||||
}
|
||||
}
|
||||
$return_id = $focus->id;
|
||||
|
||||
$focus->position_list = $json->decode(htmlspecialchars_decode($_POST['position_list']));
|
||||
// die(var_dump( $focus->position_list));
|
||||
$focus->save($check_notify);
|
||||
// create document in twinpol crm
|
||||
if ($focus->parent_id == '1b9643ca-5b1a-8f9b-b809-586b5619b068') {
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
|
||||
curl_setopt($curl, CURLOPT_VERBOSE, 1);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_setopt($curl, CURLOPT_URL, "https://crm.twinpol.com/REST/index.php?key=d68dac4c-f784-4e1b-8267-9ffcfa0eda4c&action=createCostDocumentFromInvoice&record=" . $return_id);
|
||||
$res = curl_exec($curl);
|
||||
}
|
||||
|
||||
$return_id = $focus->id;
|
||||
echo $return_id;
|
||||
|
||||
echo $return_id;
|
||||
|
||||
handleRedirect($return_id,'EcmInvoiceOuts');
|
||||
?>
|
||||
handleRedirect($return_id, 'EcmInvoiceOuts');
|
||||
|
||||
@@ -222,7 +222,7 @@ class invoiceEdiXML
|
||||
$db = $GLOBALS['db'];
|
||||
$i = $this->i;
|
||||
$oldInvoice = $db->fetchByAssoc($db->query("
|
||||
SELECT total_netto, total_brutto, total_vat, vats_summary, document_no, register_date
|
||||
SELECT total_netto, total_brutto, total_vat, vats_summary, document_no, register_date, order_no
|
||||
FROM ecminvoiceouts WHERE id='".$i->ecminvoiceout_id."'"));
|
||||
$xml = new XMLWriter();
|
||||
$name = str_replace('/', '_', $i->document_no);
|
||||
@@ -232,12 +232,10 @@ class invoiceEdiXML
|
||||
$xml->startDocument('1.0', 'UTF-8');
|
||||
$xml->startElement('Document-Invoice');
|
||||
$xml->startElement('Invoice-Header');
|
||||
// FIX $xml->writeElement('InvoiceNumber', $i->document_no);
|
||||
$xml->writeElement('InvoiceNumber', 'FVKOR 04/TEST/23');
|
||||
// FIX $xml->writeElement('InvoiceDate',
|
||||
// $timedate->to_db_date($i->register_date));
|
||||
$xml->writeElement('InvoiceNumber', $i->document_no.'-TEST');
|
||||
$xml->writeElement('InvoiceDate', $timedate->to_db_date($i->register_date));
|
||||
$xml->writeElement('InvoiceDate', '2023-08-01');
|
||||
// FIX $xml->writeElement('SalesDate', $timedate->to_db_date($i->sell_date));
|
||||
$xml->writeElement('SalesDate', $timedate->to_db_date($i->sell_date));
|
||||
$xml->writeElement('SalesDate', '2023-08-01');
|
||||
$c = new Currency();
|
||||
$c->retrieve($i->currency_id);
|
||||
@@ -254,9 +252,8 @@ class invoiceEdiXML
|
||||
$xml->writeElement('DocumentFunctionCode', 'C');
|
||||
$xml->writeElement('CorrectionReason', 'zgł. rekl.030/19/P320');
|
||||
$xml->startElement('Order');
|
||||
$xml->writeElement('BuyerOrderNumber', end(explode(' ', $i->order_no)));
|
||||
// FIX $xml->writeElement('BuyerOrderDate', $timedate->to_db_date($i->register_date));
|
||||
$xml->writeElement('BuyerOrderDate', '2023-08-01');
|
||||
$xml->writeElement('BuyerOrderNumber', $oldInvoice['order_no']);
|
||||
$xml->writeElement('BuyerOrderDate', $timedate->to_db_date($i->register_date));
|
||||
$xml->endElement(); // </Line-Order>
|
||||
$xml->startElement('Reference');
|
||||
$xml->writeElement('InvoiceReferenceNumber', $oldInvoice['document_no']);
|
||||
@@ -334,23 +331,16 @@ class invoiceEdiXML
|
||||
);
|
||||
foreach ($e5_info as $val) {
|
||||
$xml->startElement($val);
|
||||
// FIX $xml->writeElement('ILN', '5909000035836');
|
||||
$xml->writeElement('ILN', '5909000896239');
|
||||
$xml->writeElement('ILN', '5909000035836');
|
||||
if ($val != 'SellerHeadquarters')
|
||||
// FIX $xml->writeElement('TaxID', '5252173990');
|
||||
$xml->writeElement('TaxID', '8792676609');
|
||||
// FIX $xml->writeElement('Name', 'e5 Polska Sp. z o.o.');
|
||||
$xml->writeElement('Name', 'Twinpol Sp. z o.o.');
|
||||
// FIX $xml->writeElement('StreetAndNumber', 'Wąwozowa 11');
|
||||
$xml->writeElement('StreetAndNumber', 'Al. Lipowa 48');
|
||||
// FIX $xml->writeElement('CityName', 'Warszawa');
|
||||
$xml->writeElement('CityName', 'Obrowo');
|
||||
// FIX $xml->writeElement('PostalCode', '02-796');
|
||||
$xml->writeElement('PostalCode', '87-126');
|
||||
$xml->writeElement('TaxID', '5252173990');
|
||||
$xml->writeElement('Name', 'e5 Polska Sp. z o.o.');
|
||||
$xml->writeElement('StreetAndNumber', 'Wąwozowa 11');
|
||||
$xml->writeElement('CityName', 'Warszawa');
|
||||
$xml->writeElement('PostalCode', '02-796');
|
||||
$xml->writeElement('Country', 'PL');
|
||||
if ($val == 'Seller')
|
||||
// FIX $xml->writeElement('CodeByBuyer', '23862');
|
||||
$xml->writeElement('CodeByBuyer', '017776');
|
||||
$xml->writeElement('CodeByBuyer', '23862');
|
||||
$xml->endElement();
|
||||
}
|
||||
$xml->endElement(); // </Invoice-Parties>
|
||||
|
||||
Reference in New Issue
Block a user