Order Ack largely working
This commit is contained in:
parent
fe2db6d597
commit
ab17a17f25
|
|
@ -33,20 +33,6 @@ services:
|
|||
networks:
|
||||
- cmc-network
|
||||
restart: unless-stopped
|
||||
develop:
|
||||
watch:
|
||||
- action: rebuild
|
||||
path: ./php/app
|
||||
ignore:
|
||||
- ./php/app/webroot/pdf
|
||||
- ./php/app/webroot/attachments_files
|
||||
- ./php/app/tmp
|
||||
- action: sync
|
||||
path: ./php/app/webroot/css
|
||||
target: /var/www/cmc-sales/app/webroot/css
|
||||
- action: sync
|
||||
path: ./php/app/webroot/js
|
||||
target: /var/www/cmc-sales/app/webroot/js
|
||||
|
||||
db:
|
||||
image: mariadb:latest
|
||||
|
|
|
|||
12
go/.env
Normal file
12
go/.env
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# Database configuration
|
||||
DB_HOST=db
|
||||
DB_PORT=3306
|
||||
DB_USER=cmc
|
||||
DB_PASSWORD=xVRQI&cA?7AU=hqJ!%au
|
||||
DB_NAME=cmc
|
||||
|
||||
# Root database password (for dbshell-root)
|
||||
DB_ROOT_PASSWORD=secureRootPassword
|
||||
|
||||
# Server configuration
|
||||
PORT=8080
|
||||
BIN
go/bin/server
BIN
go/bin/server
Binary file not shown.
BIN
go/bin/vault
Executable file
BIN
go/bin/vault
Executable file
Binary file not shown.
|
|
@ -101,11 +101,14 @@ type PackingListPDFData struct {
|
|||
type OrderAckPDFData struct {
|
||||
OrderAcknowledgement *db.Document
|
||||
Customer *db.Customer
|
||||
CmcReference string
|
||||
EmailTo string
|
||||
Attention string
|
||||
IssueDateString string
|
||||
YourReference string
|
||||
JobTitle string
|
||||
CustomerOrderNumber string
|
||||
CustomerABN string
|
||||
BillTo string
|
||||
ShipTo string
|
||||
ShipVia string
|
||||
|
|
|
|||
|
|
@ -81,12 +81,14 @@ func (g *HTMLDocumentGenerator) BuildOrderAckHTML(data *OrderAckPDFData, totalPa
|
|||
// Prepare template data
|
||||
templateData := struct {
|
||||
OrderAckNumber string
|
||||
CmcReference string
|
||||
CompanyName string
|
||||
EmailTo string
|
||||
Attention string
|
||||
IssueDateString string
|
||||
YourReference string
|
||||
JobTitle string
|
||||
CustomerOrderNumber string
|
||||
BillTo template.HTML
|
||||
ShipTo template.HTML
|
||||
ShipVia string
|
||||
|
|
@ -106,18 +108,20 @@ func (g *HTMLDocumentGenerator) BuildOrderAckHTML(data *OrderAckPDFData, totalPa
|
|||
LogoDataURI string
|
||||
}{
|
||||
OrderAckNumber: orderAckNumber,
|
||||
CmcReference: data.CmcReference,
|
||||
CompanyName: data.Customer.Name,
|
||||
EmailTo: data.EmailTo,
|
||||
Attention: data.Attention,
|
||||
IssueDateString: data.IssueDateString,
|
||||
YourReference: data.YourReference,
|
||||
JobTitle: data.JobTitle,
|
||||
CustomerOrderNumber: data.CustomerOrderNumber,
|
||||
BillTo: template.HTML(data.BillTo),
|
||||
ShipTo: template.HTML(data.ShipTo),
|
||||
ShipVia: data.ShipVia,
|
||||
FOB: data.FOB,
|
||||
PaymentTerms: data.PaymentTerms,
|
||||
CustomerABN: "",
|
||||
CustomerABN: data.CustomerABN,
|
||||
CurrencyCode: data.CurrencyCode,
|
||||
CurrencySymbol: data.CurrencySymbol,
|
||||
LineItems: lineItemsData,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@
|
|||
|
||||
.header {
|
||||
text-align: center;
|
||||
margin-bottom: 10mm;
|
||||
margin-top: -5mm;
|
||||
margin-bottom: 8mm;
|
||||
}
|
||||
|
||||
.header h1 {
|
||||
|
|
@ -46,6 +47,10 @@
|
|||
font-size: 9pt;
|
||||
}
|
||||
|
||||
.details-table td:last-child {
|
||||
padding-right: 3mm;
|
||||
}
|
||||
|
||||
.details-table td.label {
|
||||
font-weight: bold;
|
||||
width: 25%;
|
||||
|
|
@ -237,8 +242,8 @@
|
|||
<tr>
|
||||
<td class="label">COMPANY NAME:</td>
|
||||
<td>{{.CompanyName}}</td>
|
||||
<td class="label">YOUR REFERENCE:</td>
|
||||
<td>{{.YourReference}}</td>
|
||||
<td class="label">CMC JOB#:</td>
|
||||
<td>{{.JobTitle}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">CONTACT:</td>
|
||||
|
|
@ -246,10 +251,6 @@
|
|||
<td class="label">EMAIL:</td>
|
||||
<td>{{.EmailTo}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">JOB TITLE:</td>
|
||||
<td colspan="3">{{.JobTitle}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- Address Boxes -->
|
||||
|
|
@ -269,7 +270,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th style="width: 20%;">CUSTOMER ORDER NO</th>
|
||||
<th style="width: 20%;">CMC JOB #</th>
|
||||
<th style="width: 20%;">CMC REF</th>
|
||||
<th style="width: 20%;">INCOTERMS 2010</th>
|
||||
<th style="width: 20%;">PAYMENT TERMS</th>
|
||||
<th style="width: 20%;">CUSTOMER ABN</th>
|
||||
|
|
@ -277,21 +278,19 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{{.YourReference}}</td>
|
||||
<td>{{.JobTitle}}</td>
|
||||
<td>{{if .CustomerOrderNumber}}{{.CustomerOrderNumber}}{{else}}-{{end}}</td>
|
||||
<td>{{if .CmcReference}}{{.CmcReference}}{{else}}-{{end}}</td>
|
||||
<td>{{.FOB}}</td>
|
||||
<td>{{.PaymentTerms}}</td>
|
||||
<td>{{.CustomerABN}}</td>
|
||||
<td>{{if .CustomerABN}}{{.CustomerABN}}{{else}}-{{end}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- Currency Code Header -->
|
||||
<!-- Line Items Table with Currency Code -->
|
||||
<div style="margin-bottom: 1mm; text-align: right; font-weight: bold; font-size: 9pt;">
|
||||
Shown in {{.CurrencyCode}}
|
||||
</div>
|
||||
|
||||
<!-- Line Items Table -->
|
||||
<table class="line-items">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
@ -362,20 +361,5 @@
|
|||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<div class="footer">
|
||||
<div class="services-title">CMC TECHNOLOGIES Provides Solutions in the Following Fields</div>
|
||||
<div class="services-line1">
|
||||
<span class="service-explosion">EXPLOSION PREVENTION AND PROTECTION</span> —
|
||||
<span class="service-fire">FIRE PROTECTION</span> —
|
||||
<span class="service-pressure">PRESSURE RELIEF</span> —
|
||||
<span class="service-vision">VISION IN THE PROCESS</span>
|
||||
</div>
|
||||
<div class="services-line2">
|
||||
<span class="service-flow">FLOW MEASUREMENT</span> —
|
||||
<span class="service-process">PROCESS INSTRUMENTATION</span>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -552,7 +552,7 @@ func GenerateOrderAckPDF(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
doc := &db.Document{ID: req.DocumentID}
|
||||
doc := &db.Document{ID: req.DocumentID, CmcReference: req.CmcReference}
|
||||
cust := &db.Customer{Name: req.CustomerName}
|
||||
|
||||
lineItems := make([]db.GetLineItemsTableRow, len(req.LineItems))
|
||||
|
|
@ -574,11 +574,14 @@ func GenerateOrderAckPDF(w http.ResponseWriter, r *http.Request) {
|
|||
data := &pdf.OrderAckPDFData{
|
||||
OrderAcknowledgement: doc,
|
||||
Customer: cust,
|
||||
CmcReference: req.CmcReference,
|
||||
EmailTo: req.EmailTo,
|
||||
Attention: req.Attention,
|
||||
IssueDateString: req.IssueDateString,
|
||||
YourReference: req.YourReference,
|
||||
JobTitle: req.JobTitle,
|
||||
CustomerOrderNumber: req.CustomerOrderNumber,
|
||||
CustomerABN: req.CustomerABN,
|
||||
BillTo: req.BillTo,
|
||||
ShipTo: req.ShipTo,
|
||||
ShipVia: req.ShipVia,
|
||||
|
|
@ -633,6 +636,9 @@ type OrderAckPDFRequest struct {
|
|||
DocumentID int32 `json:"document_id"`
|
||||
Title string `json:"title"`
|
||||
CustomerName string `json:"customer_name"`
|
||||
CmcReference string `json:"cmc_reference"`
|
||||
CustomerOrderNumber string `json:"customer_order_number"`
|
||||
CustomerABN string `json:"customer_abn"`
|
||||
EmailTo string `json:"email_to"`
|
||||
Attention string `json:"attention"`
|
||||
YourReference string `json:"your_reference"`
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1
|
||||
exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1
|
||||
5
php/app/.htaccess
Normal file
5
php/app/.htaccess
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine on
|
||||
RewriteRule ^$ webroot/ [L]
|
||||
RewriteRule (.*) webroot/$1 [L]
|
||||
</IfModule>
|
||||
|
|
@ -77,6 +77,12 @@ Configure::write('email_directory', '/var/www/emails');
|
|||
Configure::write('pdf_directory', $basedir.'webroot/pdf/');
|
||||
Configure::write('attachments_directory', $basedir.'webroot/attachments_files/');
|
||||
|
||||
// Ensure Go service base URL is available to PHP when provided via environment
|
||||
$goBaseUrl = getenv('GO_BASE_URL');
|
||||
if (!empty($goBaseUrl)) {
|
||||
Configure::write('go_base_url', rtrim($goBaseUrl, '/'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Application wide charset encoding
|
||||
|
|
|
|||
|
|
@ -819,6 +819,12 @@ ENDINSTRUCTIONS;
|
|||
$docType = $this->Document->getDocType($document);
|
||||
$docTypeFullName = $this->Document->getDocFullName($docType);
|
||||
|
||||
// Normalize docType when missing or unexpected: infer orderAck if OrderAcknowledgement data exists
|
||||
if (empty($docType) && !empty($document['OrderAcknowledgement']['id'])) {
|
||||
$docType = 'orderAck';
|
||||
$docTypeFullName = $this->Document->getDocFullName($docType);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$currency = $this->Document->getCurrency($document);
|
||||
|
|
@ -933,11 +939,17 @@ ENDINSTRUCTIONS;
|
|||
|
||||
$job = $this->Document->OrderAcknowledgement->Job->find('first', array('conditions'=>array('Job.id'=>$document['OrderAcknowledgement']['job_id'])));
|
||||
|
||||
// Load enquiry from job
|
||||
if ($job && isset($job['Job']['enquiry_id'])) {
|
||||
$enquiry = $this->Document->OrderAcknowledgement->Job->Enquiry->read(null, $job['Job']['enquiry_id']);
|
||||
}
|
||||
|
||||
$filename = $job['Job']['title'].'_OrderAcknowledgement';
|
||||
$this->set('docTitle', $job['Job']['title']);
|
||||
|
||||
$this->set('docTypeFullName', 'JOB'); //So it doesnt say CMC order Ack # in the pdf_shipping_billing_box. This string is too long
|
||||
$this->set('job', $job);
|
||||
$this->set('enquiry', $enquiry);
|
||||
$this->set('issue_date_string', date('d F Y', strtotime($document['OrderAcknowledgement']['issue_date'])));
|
||||
|
||||
$this->set('ship_via', $document['OrderAcknowledgement']['ship_via']);
|
||||
|
|
@ -958,6 +970,11 @@ ENDINSTRUCTIONS;
|
|||
$template_name = 'pdf_packinglist';
|
||||
|
||||
break;
|
||||
default:
|
||||
// No matching template - log and render error
|
||||
error_log("PDF generation: Unknown document type: " . $docType . " for Document ID: " . $document['Document']['id']);
|
||||
echo "ERROR: Unknown document type for PDF generation";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Don't set filename here - let the Go service and view handle it
|
||||
|
|
@ -981,6 +998,12 @@ ENDINSTRUCTIONS;
|
|||
|
||||
$this->set('colWidths',$colWidths);
|
||||
|
||||
// Ensure template_name was set by the switch; otherwise show error
|
||||
if (!isset($template_name)) {
|
||||
echo "<p>ERROR: Unknown document type '$docType' for document ID $id. Cannot render PDF.</p>";
|
||||
exit;
|
||||
}
|
||||
|
||||
$this->render($template_name);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,17 @@
|
|||
<?php
|
||||
// Generate the Order Acknowledgement PDF by calling the Go service (similar to invoice)
|
||||
error_log("=== pdf_orderack.ctp: Starting order ack PDF generation ===");
|
||||
error_log("=== pdf_orderack.ctp: Document ID: " . (isset($document['Document']['id']) ? $document['Document']['id'] : 'UNDEFINED') . " ===");
|
||||
|
||||
if (!isset($document) || !isset($document['Document'])) {
|
||||
error_log("=== pdf_orderack.ctp: ERROR - Document not set in view! ===");
|
||||
echo "ERROR: Document data not available in view";
|
||||
exit;
|
||||
}
|
||||
|
||||
$goBaseUrl = AppController::getGoBaseUrlOrFail();
|
||||
$goEndpoint = $goBaseUrl . '/go/document/generate/order-acknowledgement';
|
||||
error_log("=== pdf_orderack.ctp: Go endpoint: " . $goEndpoint . " ===");
|
||||
|
||||
$outputDir = Configure::read('pdf_directory');
|
||||
|
||||
|
|
@ -67,40 +76,32 @@ if (isset($enquiry['Enquiry']['customer_reference']) && !empty($enquiry['Enquiry
|
|||
$yourReference = 'Enquiry on ' . date('j M Y');
|
||||
}
|
||||
|
||||
// Calculate totals (match invoice structure)
|
||||
$subtotal = isset($totals['subtotal']) ? $totals['subtotal'] : 0.0;
|
||||
$gstAmount = isset($totals['gst']) ? $totals['gst'] : 0.0;
|
||||
$total = isset($totals['total']) ? $totals['total'] : 0.0;
|
||||
|
||||
$payload = array(
|
||||
'document_id' => intval($document['Document']['id']),
|
||||
'order_ack_number' => $orderAckNumber,
|
||||
'title' => $orderAckTitle,
|
||||
'customer_name' => $customerName,
|
||||
'contact_email' => $contactEmail,
|
||||
'contact_name' => $contactName,
|
||||
'user_first_name' => $userFirstName,
|
||||
'user_last_name' => $userLastName,
|
||||
'user_email' => $userEmail,
|
||||
'cmc_reference' => isset($document['Document']['cmc_reference']) ? $document['Document']['cmc_reference'] : '',
|
||||
'email_to' => $contactEmail,
|
||||
'attention' => $contactName,
|
||||
'your_reference' => $yourReference,
|
||||
'customer_order_number' => isset($job['Job']['customer_order_number']) ? $job['Job']['customer_order_number'] : '',
|
||||
'job_title' => isset($job['Job']['title']) ? $job['Job']['title'] : '',
|
||||
'issue_date' => isset($document['OrderAcknowledgement']['issue_date']) ? $document['OrderAcknowledgement']['issue_date'] : date('Y-m-d'),
|
||||
'issue_date_string' => isset($issue_date_string) ? $issue_date_string : '',
|
||||
'bill_to' => isset($document['Document']['bill_to']) ? $document['Document']['bill_to'] : '',
|
||||
'ship_to' => isset($document['Document']['ship_to']) ? $document['Document']['ship_to'] : '',
|
||||
'ship_via' => isset($document['OrderAcknowledgement']['ship_via']) ? $document['OrderAcknowledgement']['ship_via'] : '',
|
||||
'fob' => isset($document['OrderAcknowledgement']['fob']) ? $document['OrderAcknowledgement']['fob'] : '',
|
||||
'payment_terms' => isset($job['Customer']['payment_terms']) ? $job['Customer']['payment_terms'] : '',
|
||||
'customer_abn' => isset($job['Customer']['abn']) ? $job['Customer']['abn'] : '',
|
||||
'freight_details' => isset($document['Document']['shipping_details']) ? $document['Document']['shipping_details'] : '',
|
||||
'estimated_delivery' => isset($document['OrderAcknowledgement']['estimated_delivery']) ? $document['OrderAcknowledgement']['estimated_delivery'] : '',
|
||||
'issue_date' => $document['OrderAcknowledgement']['issue_date'],
|
||||
'issue_date_string' => isset($issue_date_string) ? $issue_date_string : '',
|
||||
'currency_symbol' => $currencySymbol,
|
||||
'currency_code' => $currencyCode,
|
||||
'show_gst' => (bool)$gst,
|
||||
'bill_to' => isset($document['Document']['bill_to']) ? $document['Document']['bill_to'] : '',
|
||||
'ship_to' => isset($document['Document']['ship_to']) ? $document['Document']['ship_to'] : '',
|
||||
'shipping_details' => isset($document['Document']['shipping_details']) ? $document['Document']['shipping_details'] : '',
|
||||
'customer_order_number' => isset($job['Job']['customer_order_number']) ? $job['Job']['customer_order_number'] : '',
|
||||
'job_title' => isset($job['Job']['title']) ? $job['Job']['title'] : '',
|
||||
'payment_terms' => isset($job['Customer']['payment_terms']) ? $job['Customer']['payment_terms'] : '',
|
||||
'customer_abn' => isset($job['Customer']['abn']) ? $job['Customer']['abn'] : '',
|
||||
'subtotal' => $subtotal,
|
||||
'gst_amount' => $gstAmount,
|
||||
'total' => $total,
|
||||
'subtotal' => $totals['subtotal'],
|
||||
'gst_amount' => $totals['gst'],
|
||||
'total' => $totals['total'],
|
||||
'line_items' => $lineItems,
|
||||
'output_dir' => $outputDir
|
||||
);
|
||||
|
|
@ -111,15 +112,22 @@ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
|
||||
|
||||
error_log("=== pdf_orderack.ctp: Making curl request to Go service ===");
|
||||
$response = curl_exec($ch);
|
||||
error_log("=== pdf_orderack.ctp: Curl response received: " . substr($response, 0, 200) . " ===");
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
$curlErr = curl_error($ch);
|
||||
error_log("=== pdf_orderack.ctp: HTTP Code: " . $httpCode . ", Curl Error: " . $curlErr . " ===");
|
||||
curl_close($ch);
|
||||
|
||||
if ($httpCode < 200 || $httpCode >= 300) {
|
||||
echo "<p>Failed to generate Order Acknowledgement PDF via Go service (HTTP $httpCode).";
|
||||
echo "<p>Failed to generate PDF via Go service (HTTP $httpCode).<br>";
|
||||
echo "Endpoint: " . htmlspecialchars($goEndpoint) . "<br>";
|
||||
if ($curlErr) {
|
||||
echo " Error: $curlErr";
|
||||
echo "Error: " . htmlspecialchars($curlErr) . "<br>";
|
||||
}
|
||||
if (!empty($response)) {
|
||||
echo "Response: " . htmlspecialchars($response) . "<br>";
|
||||
}
|
||||
echo "</p>";
|
||||
exit;
|
||||
|
|
|
|||
Loading…
Reference in a new issue