Improving document types generated
This commit is contained in:
parent
9c10d4c21f
commit
a464d48b88
|
|
@ -163,6 +163,8 @@ type QuotePDFRequest struct {
|
||||||
CmcReference string `json:"cmc_reference"`
|
CmcReference string `json:"cmc_reference"`
|
||||||
Revision int32 `json:"revision"`
|
Revision int32 `json:"revision"`
|
||||||
CreatedDate string `json:"created_date"` // YYYY-MM-DD
|
CreatedDate string `json:"created_date"` // YYYY-MM-DD
|
||||||
|
CreatedDateString string `json:"created_date_string"` // j M Y format
|
||||||
|
DateIssued string `json:"date_issued"`
|
||||||
CustomerName string `json:"customer_name"`
|
CustomerName string `json:"customer_name"`
|
||||||
ContactEmail string `json:"contact_email"`
|
ContactEmail string `json:"contact_email"`
|
||||||
ContactName string `json:"contact_name"`
|
ContactName string `json:"contact_name"`
|
||||||
|
|
@ -170,8 +172,19 @@ type QuotePDFRequest struct {
|
||||||
UserLastName string `json:"user_last_name"`
|
UserLastName string `json:"user_last_name"`
|
||||||
UserEmail string `json:"user_email"`
|
UserEmail string `json:"user_email"`
|
||||||
CurrencySymbol string `json:"currency_symbol"`
|
CurrencySymbol string `json:"currency_symbol"`
|
||||||
|
CurrencyCode string `json:"currency_code"`
|
||||||
ShowGST bool `json:"show_gst"`
|
ShowGST bool `json:"show_gst"`
|
||||||
CommercialComments string `json:"commercial_comments"`
|
CommercialComments string `json:"commercial_comments"`
|
||||||
|
DeliveryTime string `json:"delivery_time"`
|
||||||
|
PaymentTerms string `json:"payment_terms"`
|
||||||
|
DaysValid int32 `json:"daysValid"`
|
||||||
|
DeliveryPoint string `json:"delivery_point"`
|
||||||
|
ExchangeRate string `json:"exchange_rate"`
|
||||||
|
CustomsDuty string `json:"customs_duty"`
|
||||||
|
GSTPhrase string `json:"gst_phrase"`
|
||||||
|
SalesEngineer string `json:"sales_engineer"`
|
||||||
|
BillTo string `json:"bill_to"`
|
||||||
|
ShipTo string `json:"ship_to"`
|
||||||
LineItems []QuoteLineItemRequest `json:"line_items"`
|
LineItems []QuoteLineItemRequest `json:"line_items"`
|
||||||
Pages []string `json:"pages"`
|
Pages []string `json:"pages"`
|
||||||
OutputDir string `json:"output_dir"`
|
OutputDir string `json:"output_dir"`
|
||||||
|
|
@ -233,8 +246,20 @@ func GenerateQuotePDF(w http.ResponseWriter, r *http.Request) {
|
||||||
User: user,
|
User: user,
|
||||||
LineItems: lineItems,
|
LineItems: lineItems,
|
||||||
CurrencySymbol: req.CurrencySymbol,
|
CurrencySymbol: req.CurrencySymbol,
|
||||||
|
CurrencyCode: req.CurrencyCode,
|
||||||
ShowGST: req.ShowGST,
|
ShowGST: req.ShowGST,
|
||||||
CommercialComments: req.CommercialComments,
|
CommercialComments: req.CommercialComments,
|
||||||
|
DeliveryTime: req.DeliveryTime,
|
||||||
|
PaymentTerms: req.PaymentTerms,
|
||||||
|
DaysValid: int(req.DaysValid),
|
||||||
|
DeliveryPoint: req.DeliveryPoint,
|
||||||
|
ExchangeRate: req.ExchangeRate,
|
||||||
|
CustomsDuty: req.CustomsDuty,
|
||||||
|
GSTPhrase: req.GSTPhrase,
|
||||||
|
SalesEngineer: req.SalesEngineer,
|
||||||
|
BillTo: req.BillTo,
|
||||||
|
ShipTo: req.ShipTo,
|
||||||
|
IssueDateString: req.CreatedDateString,
|
||||||
Pages: req.Pages,
|
Pages: req.Pages,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -256,15 +281,20 @@ type PurchaseOrderLineItemRequest = InvoiceLineItemRequest
|
||||||
type PurchaseOrderPDFRequest struct {
|
type PurchaseOrderPDFRequest struct {
|
||||||
DocumentID int32 `json:"document_id"`
|
DocumentID int32 `json:"document_id"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
|
IssueDate string `json:"issue_date"` // YYYY-MM-DD
|
||||||
|
IssueDateString string `json:"issue_date_string"` // formatted date
|
||||||
PrincipleName string `json:"principle_name"`
|
PrincipleName string `json:"principle_name"`
|
||||||
PrincipleReference string `json:"principle_reference"`
|
PrincipleReference string `json:"principle_reference"`
|
||||||
IssueDate string `json:"issue_date"` // YYYY-MM-DD
|
|
||||||
OrderedFrom string `json:"ordered_from"`
|
OrderedFrom string `json:"ordered_from"`
|
||||||
DispatchBy string `json:"dispatch_by"`
|
DispatchBy string `json:"dispatch_by"`
|
||||||
DeliverTo string `json:"deliver_to"`
|
DeliverTo string `json:"deliver_to"`
|
||||||
ShippingInstructions string `json:"shipping_instructions"`
|
ShippingInstructions string `json:"shipping_instructions"`
|
||||||
CurrencySymbol string `json:"currency_symbol"`
|
CurrencySymbol string `json:"currency_symbol"`
|
||||||
|
CurrencyCode string `json:"currency_code"`
|
||||||
ShowGST bool `json:"show_gst"`
|
ShowGST bool `json:"show_gst"`
|
||||||
|
Subtotal float64 `json:"subtotal"`
|
||||||
|
GSTAmount float64 `json:"gst_amount"`
|
||||||
|
Total float64 `json:"total"`
|
||||||
LineItems []PurchaseOrderLineItemRequest `json:"line_items"`
|
LineItems []PurchaseOrderLineItemRequest `json:"line_items"`
|
||||||
OutputDir string `json:"output_dir"`
|
OutputDir string `json:"output_dir"`
|
||||||
}
|
}
|
||||||
|
|
@ -330,7 +360,12 @@ func GeneratePurchaseOrderPDF(w http.ResponseWriter, r *http.Request) {
|
||||||
Principle: principle,
|
Principle: principle,
|
||||||
LineItems: lineItems,
|
LineItems: lineItems,
|
||||||
CurrencySymbol: req.CurrencySymbol,
|
CurrencySymbol: req.CurrencySymbol,
|
||||||
|
CurrencyCode: req.CurrencyCode,
|
||||||
ShowGST: req.ShowGST,
|
ShowGST: req.ShowGST,
|
||||||
|
Subtotal: req.Subtotal,
|
||||||
|
GSTAmount: req.GSTAmount,
|
||||||
|
Total: req.Total,
|
||||||
|
IssueDateString: req.IssueDateString,
|
||||||
}
|
}
|
||||||
|
|
||||||
filename, err := pdf.GeneratePurchaseOrderPDF(data, outputDir)
|
filename, err := pdf.GeneratePurchaseOrderPDF(data, outputDir)
|
||||||
|
|
@ -388,8 +423,15 @@ func GeneratePackingListPDF(w http.ResponseWriter, r *http.Request) {
|
||||||
data := &pdf.PackingListPDFData{
|
data := &pdf.PackingListPDFData{
|
||||||
Document: doc,
|
Document: doc,
|
||||||
Customer: cust,
|
Customer: cust,
|
||||||
|
Title: req.Title,
|
||||||
|
JobTitle: req.JobTitle,
|
||||||
|
IssueDate: req.IssueDate,
|
||||||
|
IssueDateString: req.IssueDateString,
|
||||||
|
ShipVia: req.ShipVia,
|
||||||
|
FOB: req.FOB,
|
||||||
LineItems: lineItems,
|
LineItems: lineItems,
|
||||||
CurrencySymbol: req.CurrencySymbol,
|
CurrencySymbol: req.CurrencySymbol,
|
||||||
|
CurrencyCode: req.CurrencyCode,
|
||||||
ShowGST: req.ShowGST,
|
ShowGST: req.ShowGST,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -445,8 +487,16 @@ func GenerateOrderAckPDF(w http.ResponseWriter, r *http.Request) {
|
||||||
data := &pdf.OrderAckPDFData{
|
data := &pdf.OrderAckPDFData{
|
||||||
Document: doc,
|
Document: doc,
|
||||||
Customer: cust,
|
Customer: cust,
|
||||||
|
Title: req.Title,
|
||||||
|
JobTitle: req.JobTitle,
|
||||||
|
IssueDate: req.IssueDate,
|
||||||
|
IssueDateString: req.IssueDateString,
|
||||||
|
ShipVia: req.ShipVia,
|
||||||
|
FOB: req.FOB,
|
||||||
|
EstimatedDelivery: req.EstimatedDelivery,
|
||||||
LineItems: lineItems,
|
LineItems: lineItems,
|
||||||
CurrencySymbol: req.CurrencySymbol,
|
CurrencySymbol: req.CurrencySymbol,
|
||||||
|
CurrencyCode: req.CurrencyCode,
|
||||||
ShowGST: req.ShowGST,
|
ShowGST: req.ShowGST,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -466,8 +516,15 @@ type PackingListLineItemRequest = InvoiceLineItemRequest
|
||||||
// PackingListPDFRequest payload
|
// PackingListPDFRequest payload
|
||||||
type PackingListPDFRequest struct {
|
type PackingListPDFRequest struct {
|
||||||
DocumentID int32 `json:"document_id"`
|
DocumentID int32 `json:"document_id"`
|
||||||
|
Title string `json:"title"`
|
||||||
CustomerName string `json:"customer_name"`
|
CustomerName string `json:"customer_name"`
|
||||||
|
JobTitle string `json:"job_title"`
|
||||||
|
IssueDate string `json:"issue_date"` // YYYY-MM-DD
|
||||||
|
IssueDateString string `json:"issue_date_string"` // formatted date
|
||||||
|
ShipVia string `json:"ship_via"`
|
||||||
|
FOB string `json:"fob"`
|
||||||
CurrencySymbol string `json:"currency_symbol"`
|
CurrencySymbol string `json:"currency_symbol"`
|
||||||
|
CurrencyCode string `json:"currency_code"`
|
||||||
ShowGST bool `json:"show_gst"`
|
ShowGST bool `json:"show_gst"`
|
||||||
LineItems []PackingListLineItemRequest `json:"line_items"`
|
LineItems []PackingListLineItemRequest `json:"line_items"`
|
||||||
OutputDir string `json:"output_dir"`
|
OutputDir string `json:"output_dir"`
|
||||||
|
|
@ -479,8 +536,16 @@ type OrderAckLineItemRequest = InvoiceLineItemRequest
|
||||||
// OrderAckPDFRequest payload
|
// OrderAckPDFRequest payload
|
||||||
type OrderAckPDFRequest struct {
|
type OrderAckPDFRequest struct {
|
||||||
DocumentID int32 `json:"document_id"`
|
DocumentID int32 `json:"document_id"`
|
||||||
|
Title string `json:"title"`
|
||||||
CustomerName string `json:"customer_name"`
|
CustomerName string `json:"customer_name"`
|
||||||
|
JobTitle string `json:"job_title"`
|
||||||
|
IssueDate string `json:"issue_date"` // YYYY-MM-DD
|
||||||
|
IssueDateString string `json:"issue_date_string"` // formatted date
|
||||||
|
ShipVia string `json:"ship_via"`
|
||||||
|
FOB string `json:"fob"`
|
||||||
|
EstimatedDelivery string `json:"estimated_delivery"`
|
||||||
CurrencySymbol string `json:"currency_symbol"`
|
CurrencySymbol string `json:"currency_symbol"`
|
||||||
|
CurrencyCode string `json:"currency_code"`
|
||||||
ShowGST bool `json:"show_gst"`
|
ShowGST bool `json:"show_gst"`
|
||||||
LineItems []OrderAckLineItemRequest `json:"line_items"`
|
LineItems []OrderAckLineItemRequest `json:"line_items"`
|
||||||
OutputDir string `json:"output_dir"`
|
OutputDir string `json:"output_dir"`
|
||||||
|
|
|
||||||
|
|
@ -318,6 +318,55 @@ For full terms and conditions, please refer to our website or contact CMC TECHNO
|
||||||
g.pdf.MultiCell(0, 4, disclaimerText, "", "L", false)
|
g.pdf.MultiCell(0, 4, disclaimerText, "", "L", false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddQuoteDetailsTable adds quote commercial details table (delivery time, payment terms, etc.)
|
||||||
|
func (g *Generator) AddQuoteDetailsTable(data *QuotePDFData) {
|
||||||
|
g.pdf.Ln(8)
|
||||||
|
g.pdf.SetFont("Helvetica", "B", 10)
|
||||||
|
g.pdf.CellFormat(0, 5, "QUOTE DETAILS", "", 1, "L", false, 0, "")
|
||||||
|
g.pdf.Ln(2)
|
||||||
|
|
||||||
|
// Create a simple table for quote details
|
||||||
|
g.pdf.SetFont("Helvetica", "", 9)
|
||||||
|
g.pdf.SetLeftMargin(15)
|
||||||
|
|
||||||
|
// Set column widths for a 3-column table
|
||||||
|
colWidth := 50.0
|
||||||
|
colY := g.pdf.GetY()
|
||||||
|
|
||||||
|
// Row 1: Delivery Time | Payment Terms | Days Valid
|
||||||
|
g.pdf.SetX(15)
|
||||||
|
g.pdf.SetLeftMargin(15)
|
||||||
|
|
||||||
|
if data.DeliveryTime != "" {
|
||||||
|
g.pdf.SetFont("Helvetica", "B", 8)
|
||||||
|
g.pdf.CellFormat(colWidth, 4, "Delivery Time:", "L", 0, "L", false, 0, "")
|
||||||
|
g.pdf.SetFont("Helvetica", "", 8)
|
||||||
|
g.pdf.CellFormat(colWidth, 4, data.DeliveryTime, "", 0, "L", false, 0, "")
|
||||||
|
g.pdf.SetFont("Helvetica", "B", 8)
|
||||||
|
g.pdf.CellFormat(colWidth, 4, "Payment Terms:", "", 0, "L", false, 0, "")
|
||||||
|
g.pdf.SetFont("Helvetica", "", 8)
|
||||||
|
g.pdf.CellFormat(0, 4, data.PaymentTerms, "R", 1, "L", false, 0, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Row 2: Delivery Point | Days Valid
|
||||||
|
if data.DeliveryPoint != "" || data.DaysValid > 0 {
|
||||||
|
g.pdf.SetFont("Helvetica", "B", 8)
|
||||||
|
g.pdf.CellFormat(colWidth, 4, "Delivery Point:", "L", 0, "L", false, 0, "")
|
||||||
|
g.pdf.SetFont("Helvetica", "", 8)
|
||||||
|
g.pdf.CellFormat(colWidth, 4, data.DeliveryPoint, "", 0, "L", false, 0, "")
|
||||||
|
g.pdf.SetFont("Helvetica", "B", 8)
|
||||||
|
daysStr := ""
|
||||||
|
if data.DaysValid > 0 {
|
||||||
|
daysStr = fmt.Sprintf("%d days", data.DaysValid)
|
||||||
|
}
|
||||||
|
g.pdf.CellFormat(colWidth, 4, "Valid For:", "", 0, "L", false, 0, "")
|
||||||
|
g.pdf.SetFont("Helvetica", "", 8)
|
||||||
|
g.pdf.CellFormat(0, 4, daysStr, "R", 1, "L", false, 0, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
g.pdf.SetLeftMargin(10)
|
||||||
|
}
|
||||||
|
|
||||||
// AddInvoiceAddressBoxes adds the Sold To / Delivery Address boxes for invoices
|
// AddInvoiceAddressBoxes adds the Sold To / Delivery Address boxes for invoices
|
||||||
func (g *Generator) AddInvoiceAddressBoxes(data *InvoicePDFData) {
|
func (g *Generator) AddInvoiceAddressBoxes(data *InvoicePDFData) {
|
||||||
g.pdf.SetFont("Helvetica", "", 9)
|
g.pdf.SetFont("Helvetica", "", 9)
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,20 @@ type QuotePDFData struct {
|
||||||
LineItems []db.GetLineItemsTableRow
|
LineItems []db.GetLineItemsTableRow
|
||||||
Currency interface{} // Currency data
|
Currency interface{} // Currency data
|
||||||
CurrencySymbol string
|
CurrencySymbol string
|
||||||
|
CurrencyCode string
|
||||||
ShowGST bool
|
ShowGST bool
|
||||||
CommercialComments string
|
CommercialComments string
|
||||||
|
DeliveryTime string
|
||||||
|
PaymentTerms string
|
||||||
|
DaysValid int
|
||||||
|
DeliveryPoint string
|
||||||
|
ExchangeRate string
|
||||||
|
CustomsDuty string
|
||||||
|
GSTPhrase string
|
||||||
|
SalesEngineer string
|
||||||
|
BillTo string
|
||||||
|
ShipTo string
|
||||||
|
IssueDateString string
|
||||||
Pages []string
|
Pages []string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -50,7 +62,10 @@ func GenerateQuotePDF(data *QuotePDFData, outputDir string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
yourReference := fmt.Sprintf("Enquiry on %s", data.Document.Created.Format("2 Jan 2006"))
|
yourReference := fmt.Sprintf("Enquiry on %s", data.Document.Created.Format("2 Jan 2006"))
|
||||||
issueDate := data.Document.Created.Format("2 January 2006")
|
issueDate := data.IssueDateString
|
||||||
|
if issueDate == "" {
|
||||||
|
issueDate = data.Document.Created.Format("2 January 2006")
|
||||||
|
}
|
||||||
|
|
||||||
// Add details box
|
// Add details box
|
||||||
gen.DetailsBox("QUOTE", companyName, emailTo, attention, fromName, fromEmail, quoteNumber, yourReference, issueDate)
|
gen.DetailsBox("QUOTE", companyName, emailTo, attention, fromName, fromEmail, quoteNumber, yourReference, issueDate)
|
||||||
|
|
@ -115,6 +130,11 @@ func GenerateQuotePDF(data *QuotePDFData, outputDir string) (string, error) {
|
||||||
gen.pdf.MultiCell(0, 5, data.CommercialComments, "", "L", false)
|
gen.pdf.MultiCell(0, 5, data.CommercialComments, "", "L", false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add quote details table (delivery time, payment terms, etc.)
|
||||||
|
if data.DeliveryTime != "" || data.PaymentTerms != "" || data.DaysValid > 0 {
|
||||||
|
gen.AddQuoteDetailsTable(data)
|
||||||
|
}
|
||||||
|
|
||||||
// Add terms and conditions page
|
// Add terms and conditions page
|
||||||
gen.AddTermsAndConditions()
|
gen.AddTermsAndConditions()
|
||||||
|
|
||||||
|
|
@ -225,7 +245,12 @@ type PurchaseOrderPDFData struct {
|
||||||
LineItems []db.GetLineItemsTableRow
|
LineItems []db.GetLineItemsTableRow
|
||||||
Currency interface{} // Currency data
|
Currency interface{} // Currency data
|
||||||
CurrencySymbol string
|
CurrencySymbol string
|
||||||
|
CurrencyCode string
|
||||||
ShowGST bool
|
ShowGST bool
|
||||||
|
Subtotal float64
|
||||||
|
GSTAmount float64
|
||||||
|
Total float64
|
||||||
|
IssueDateString string
|
||||||
}
|
}
|
||||||
|
|
||||||
// GeneratePurchaseOrderPDF generates a PDF for a purchase order
|
// GeneratePurchaseOrderPDF generates a PDF for a purchase order
|
||||||
|
|
@ -245,7 +270,10 @@ func GeneratePurchaseOrderPDF(data *PurchaseOrderPDFData, outputDir string) (str
|
||||||
poNumber := data.PurchaseOrder.Title
|
poNumber := data.PurchaseOrder.Title
|
||||||
|
|
||||||
yourReference := data.PurchaseOrder.PrincipleReference
|
yourReference := data.PurchaseOrder.PrincipleReference
|
||||||
issueDate := data.PurchaseOrder.IssueDate.Format("Monday, 2 January 2006")
|
issueDate := data.IssueDateString
|
||||||
|
if issueDate == "" {
|
||||||
|
issueDate = data.PurchaseOrder.IssueDate.Format("Monday, 2 January 2006")
|
||||||
|
}
|
||||||
|
|
||||||
// Add details box
|
// Add details box
|
||||||
gen.DetailsBox("PURCHASE ORDER", companyName, emailTo, attention, fromName, fromEmail, poNumber, yourReference, issueDate)
|
gen.DetailsBox("PURCHASE ORDER", companyName, emailTo, attention, fromName, fromEmail, poNumber, yourReference, issueDate)
|
||||||
|
|
@ -305,9 +333,25 @@ func GeneratePurchaseOrderPDF(data *PurchaseOrderPDFData, outputDir string) (str
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add line items table
|
// Add line items table with totals
|
||||||
gen.AddLineItemsTable(pdfItems, data.CurrencySymbol, data.ShowGST)
|
gen.AddLineItemsTable(pdfItems, data.CurrencySymbol, data.ShowGST)
|
||||||
|
|
||||||
|
// Add totals section
|
||||||
|
gen.pdf.Ln(5)
|
||||||
|
gen.pdf.SetFont("Helvetica", "B", 10)
|
||||||
|
gen.pdf.CellFormat(120, 5, "SUBTOTAL:", "T", 0, "R", false, 0, "")
|
||||||
|
gen.pdf.CellFormat(0, 5, fmt.Sprintf("%s%.2f", data.CurrencySymbol, data.Subtotal), "T", 1, "R", false, 0, "")
|
||||||
|
|
||||||
|
if data.ShowGST && data.GSTAmount > 0 {
|
||||||
|
gen.pdf.SetFont("Helvetica", "", 10)
|
||||||
|
gen.pdf.CellFormat(120, 5, "GST:", "", 0, "R", false, 0, "")
|
||||||
|
gen.pdf.CellFormat(0, 5, fmt.Sprintf("%s%.2f", data.CurrencySymbol, data.GSTAmount), "", 1, "R", false, 0, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
gen.pdf.SetFont("Helvetica", "B", 10)
|
||||||
|
gen.pdf.CellFormat(120, 5, "TOTAL:", "T", 0, "R", false, 0, "")
|
||||||
|
gen.pdf.CellFormat(0, 5, fmt.Sprintf("%s%.2f", data.CurrencySymbol, data.Total), "T", 1, "R", false, 0, "")
|
||||||
|
|
||||||
// Add terms and conditions page
|
// Add terms and conditions page
|
||||||
gen.AddTermsAndConditions()
|
gen.AddTermsAndConditions()
|
||||||
|
|
||||||
|
|
@ -328,8 +372,15 @@ func GeneratePurchaseOrderPDF(data *PurchaseOrderPDFData, outputDir string) (str
|
||||||
type PackingListPDFData struct {
|
type PackingListPDFData struct {
|
||||||
Document *db.Document
|
Document *db.Document
|
||||||
Customer *db.Customer
|
Customer *db.Customer
|
||||||
|
Title string
|
||||||
|
JobTitle string
|
||||||
|
IssueDate string
|
||||||
|
IssueDateString string
|
||||||
|
ShipVia string
|
||||||
|
FOB string
|
||||||
LineItems []db.GetLineItemsTableRow
|
LineItems []db.GetLineItemsTableRow
|
||||||
CurrencySymbol string
|
CurrencySymbol string
|
||||||
|
CurrencyCode string
|
||||||
ShowGST bool
|
ShowGST bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -344,8 +395,40 @@ func GeneratePackingListPDF(data *PackingListPDFData, outputDir string) (string,
|
||||||
gen.pdf.CellFormat(0, 10, "PACKING LIST", "", 1, "C", false, 0, "")
|
gen.pdf.CellFormat(0, 10, "PACKING LIST", "", 1, "C", false, 0, "")
|
||||||
gen.pdf.Ln(5)
|
gen.pdf.Ln(5)
|
||||||
|
|
||||||
// Details box (minimal)
|
// Details box with proper title and date
|
||||||
gen.DetailsBox("PACKING LIST", data.Customer.Name, "", "", "", "", fmt.Sprintf("PL-%d", data.Document.ID), "", time.Now().Format("2 January 2006"))
|
issueDate := data.IssueDateString
|
||||||
|
if issueDate == "" {
|
||||||
|
issueDate = time.Now().Format("2 January 2006")
|
||||||
|
}
|
||||||
|
refNumber := data.Title
|
||||||
|
if refNumber == "" {
|
||||||
|
refNumber = fmt.Sprintf("PL-%d", data.Document.ID)
|
||||||
|
}
|
||||||
|
gen.DetailsBox("PACKING LIST", data.Customer.Name, "", "", "", "", refNumber, "", issueDate)
|
||||||
|
|
||||||
|
// Add shipping details section
|
||||||
|
gen.pdf.Ln(5)
|
||||||
|
if data.JobTitle != "" {
|
||||||
|
gen.pdf.SetFont("Helvetica", "B", 10)
|
||||||
|
gen.pdf.CellFormat(40, 5, "Job Reference:", "", 0, "L", false, 0, "")
|
||||||
|
gen.pdf.SetFont("Helvetica", "", 10)
|
||||||
|
gen.pdf.CellFormat(0, 5, data.JobTitle, "", 1, "L", false, 0, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
if data.ShipVia != "" {
|
||||||
|
gen.pdf.SetFont("Helvetica", "B", 10)
|
||||||
|
gen.pdf.CellFormat(40, 5, "Ship Via:", "", 0, "L", false, 0, "")
|
||||||
|
gen.pdf.SetFont("Helvetica", "", 10)
|
||||||
|
gen.pdf.CellFormat(0, 5, data.ShipVia, "", 1, "L", false, 0, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
if data.FOB != "" {
|
||||||
|
gen.pdf.SetFont("Helvetica", "B", 10)
|
||||||
|
gen.pdf.CellFormat(40, 5, "FOB:", "", 0, "L", false, 0, "")
|
||||||
|
gen.pdf.SetFont("Helvetica", "", 10)
|
||||||
|
gen.pdf.CellFormat(0, 5, data.FOB, "", 1, "L", false, 0, "")
|
||||||
|
}
|
||||||
|
|
||||||
gen.Page1Footer()
|
gen.Page1Footer()
|
||||||
|
|
||||||
// Line items
|
// Line items
|
||||||
|
|
@ -367,7 +450,11 @@ func GeneratePackingListPDF(data *PackingListPDFData, outputDir string) (string,
|
||||||
// Add terms and conditions page
|
// Add terms and conditions page
|
||||||
gen.AddTermsAndConditions()
|
gen.AddTermsAndConditions()
|
||||||
|
|
||||||
filename := fmt.Sprintf("PL-%d.pdf", data.Document.ID)
|
filename := data.Title
|
||||||
|
if filename == "" {
|
||||||
|
filename = fmt.Sprintf("PL-%d", data.Document.ID)
|
||||||
|
}
|
||||||
|
filename = fmt.Sprintf("%s.pdf", filename)
|
||||||
err := gen.Save(filename)
|
err := gen.Save(filename)
|
||||||
return filename, err
|
return filename, err
|
||||||
}
|
}
|
||||||
|
|
@ -376,8 +463,16 @@ func GeneratePackingListPDF(data *PackingListPDFData, outputDir string) (string,
|
||||||
type OrderAckPDFData struct {
|
type OrderAckPDFData struct {
|
||||||
Document *db.Document
|
Document *db.Document
|
||||||
Customer *db.Customer
|
Customer *db.Customer
|
||||||
|
Title string
|
||||||
|
JobTitle string
|
||||||
|
IssueDate string
|
||||||
|
IssueDateString string
|
||||||
|
ShipVia string
|
||||||
|
FOB string
|
||||||
|
EstimatedDelivery string
|
||||||
LineItems []db.GetLineItemsTableRow
|
LineItems []db.GetLineItemsTableRow
|
||||||
CurrencySymbol string
|
CurrencySymbol string
|
||||||
|
CurrencyCode string
|
||||||
ShowGST bool
|
ShowGST bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -392,8 +487,47 @@ func GenerateOrderAckPDF(data *OrderAckPDFData, outputDir string) (string, error
|
||||||
gen.pdf.CellFormat(0, 10, "ORDER ACKNOWLEDGEMENT", "", 1, "C", false, 0, "")
|
gen.pdf.CellFormat(0, 10, "ORDER ACKNOWLEDGEMENT", "", 1, "C", false, 0, "")
|
||||||
gen.pdf.Ln(5)
|
gen.pdf.Ln(5)
|
||||||
|
|
||||||
// Details box (minimal)
|
// Details box with proper title and date
|
||||||
gen.DetailsBox("ORDER ACK", data.Customer.Name, "", "", "", "", fmt.Sprintf("OA-%d", data.Document.ID), "", time.Now().Format("2 January 2006"))
|
issueDate := data.IssueDateString
|
||||||
|
if issueDate == "" {
|
||||||
|
issueDate = time.Now().Format("2 January 2006")
|
||||||
|
}
|
||||||
|
refNumber := data.Title
|
||||||
|
if refNumber == "" {
|
||||||
|
refNumber = fmt.Sprintf("OA-%d", data.Document.ID)
|
||||||
|
}
|
||||||
|
gen.DetailsBox("ORDER ACK", data.Customer.Name, "", "", "", "", refNumber, "", issueDate)
|
||||||
|
|
||||||
|
// Add shipping/delivery details section
|
||||||
|
gen.pdf.Ln(5)
|
||||||
|
if data.JobTitle != "" {
|
||||||
|
gen.pdf.SetFont("Helvetica", "B", 10)
|
||||||
|
gen.pdf.CellFormat(40, 5, "Job Reference:", "", 0, "L", false, 0, "")
|
||||||
|
gen.pdf.SetFont("Helvetica", "", 10)
|
||||||
|
gen.pdf.CellFormat(0, 5, data.JobTitle, "", 1, "L", false, 0, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
if data.ShipVia != "" {
|
||||||
|
gen.pdf.SetFont("Helvetica", "B", 10)
|
||||||
|
gen.pdf.CellFormat(40, 5, "Ship Via:", "", 0, "L", false, 0, "")
|
||||||
|
gen.pdf.SetFont("Helvetica", "", 10)
|
||||||
|
gen.pdf.CellFormat(0, 5, data.ShipVia, "", 1, "L", false, 0, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
if data.FOB != "" {
|
||||||
|
gen.pdf.SetFont("Helvetica", "B", 10)
|
||||||
|
gen.pdf.CellFormat(40, 5, "FOB:", "", 0, "L", false, 0, "")
|
||||||
|
gen.pdf.SetFont("Helvetica", "", 10)
|
||||||
|
gen.pdf.CellFormat(0, 5, data.FOB, "", 1, "L", false, 0, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
if data.EstimatedDelivery != "" {
|
||||||
|
gen.pdf.SetFont("Helvetica", "B", 10)
|
||||||
|
gen.pdf.CellFormat(40, 5, "Est. Delivery:", "", 0, "L", false, 0, "")
|
||||||
|
gen.pdf.SetFont("Helvetica", "", 10)
|
||||||
|
gen.pdf.CellFormat(0, 5, data.EstimatedDelivery, "", 1, "L", false, 0, "")
|
||||||
|
}
|
||||||
|
|
||||||
gen.Page1Footer()
|
gen.Page1Footer()
|
||||||
|
|
||||||
// Line items
|
// Line items
|
||||||
|
|
@ -415,7 +549,12 @@ func GenerateOrderAckPDF(data *OrderAckPDFData, outputDir string) (string, error
|
||||||
// Add terms and conditions page
|
// Add terms and conditions page
|
||||||
gen.AddTermsAndConditions()
|
gen.AddTermsAndConditions()
|
||||||
|
|
||||||
filename := fmt.Sprintf("OA-%d.pdf", data.Document.ID)
|
filename := data.Title
|
||||||
|
if filename == "" {
|
||||||
|
filename = fmt.Sprintf("OA-%d", data.Document.ID)
|
||||||
|
}
|
||||||
|
filename = fmt.Sprintf("%s.pdf", filename)
|
||||||
|
|
||||||
err := gen.Save(filename)
|
err := gen.Save(filename)
|
||||||
return filename, err
|
return filename, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,20 +7,40 @@ $goEndpoint = $goBaseUrl . '/go/pdf/generate-orderack';
|
||||||
$outputDir = Configure::read('pdf_directory');
|
$outputDir = Configure::read('pdf_directory');
|
||||||
|
|
||||||
$lineItems = array();
|
$lineItems = array();
|
||||||
|
if (isset($document['LineItem']) && is_array($document['LineItem'])) {
|
||||||
foreach ($document['LineItem'] as $li) {
|
foreach ($document['LineItem'] as $li) {
|
||||||
$lineItems[] = array(
|
$lineItems[] = array(
|
||||||
'item_number' => $li['item_number'],
|
'item_number' => isset($li['item_number']) ? $li['item_number'] : '',
|
||||||
'quantity' => $li['quantity'],
|
'quantity' => isset($li['quantity']) ? $li['quantity'] : '',
|
||||||
'title' => $li['title'],
|
'title' => isset($li['title']) ? $li['title'] : '',
|
||||||
'unit_price' => floatval($li['gross_unit_price']),
|
'description' => isset($li['description']) ? $li['description'] : '',
|
||||||
'total_price' => floatval($li['gross_price'])
|
'unit_price' => isset($li['gross_unit_price']) ? floatval($li['gross_unit_price']) : 0.0,
|
||||||
|
'total_price' => isset($li['gross_price']) ? floatval($li['gross_price']) : 0.0,
|
||||||
|
'net_unit_price' => isset($li['net_unit_price']) ? floatval($li['net_unit_price']) : 0.0,
|
||||||
|
'net_price' => isset($li['net_price']) ? floatval($li['net_price']) : 0.0,
|
||||||
|
'discount_percent' => isset($li['discount_percent']) ? floatval($li['discount_percent']) : 0.0,
|
||||||
|
'discount_amount_unit' => isset($li['discount_amount_unit']) ? floatval($li['discount_amount_unit']) : 0.0,
|
||||||
|
'discount_amount_total' => isset($li['discount_amount_total']) ? floatval($li['discount_amount_total']) : 0.0,
|
||||||
|
'option' => isset($li['option']) ? intval($li['option']) : 0,
|
||||||
|
'has_text_prices' => isset($li['has_text_prices']) ? (bool)$li['has_text_prices'] : false,
|
||||||
|
'unit_price_string' => isset($li['unit_price_string']) ? $li['unit_price_string'] : '',
|
||||||
|
'gross_price_string' => isset($li['gross_price_string']) ? $li['gross_price_string'] : ''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$payload = array(
|
$payload = array(
|
||||||
'document_id' => intval($document['Document']['id']),
|
'document_id' => intval($document['Document']['id']),
|
||||||
|
'title' => $document['OrderAcknowledgement']['title'],
|
||||||
'customer_name' => $enquiry['Customer']['name'],
|
'customer_name' => $enquiry['Customer']['name'],
|
||||||
|
'job_title' => isset($job['Job']['title']) ? $job['Job']['title'] : '',
|
||||||
|
'issue_date' => $document['OrderAcknowledgement']['issue_date'],
|
||||||
|
'issue_date_string' => isset($issue_date_string) ? $issue_date_string : '',
|
||||||
|
'ship_via' => $document['OrderAcknowledgement']['ship_via'],
|
||||||
|
'fob' => $document['OrderAcknowledgement']['fob'],
|
||||||
|
'estimated_delivery' => $document['OrderAcknowledgement']['estimated_delivery'],
|
||||||
'currency_symbol' => $currencySymbol,
|
'currency_symbol' => $currencySymbol,
|
||||||
|
'currency_code' => isset($currencyCode) ? $currencyCode : 'AUD',
|
||||||
'show_gst' => (bool)$gst,
|
'show_gst' => (bool)$gst,
|
||||||
'line_items' => $lineItems,
|
'line_items' => $lineItems,
|
||||||
'output_dir' => $outputDir
|
'output_dir' => $outputDir
|
||||||
|
|
|
||||||
|
|
@ -7,20 +7,39 @@ $goEndpoint = $goBaseUrl . '/go/pdf/generate-packinglist';
|
||||||
$outputDir = Configure::read('pdf_directory');
|
$outputDir = Configure::read('pdf_directory');
|
||||||
|
|
||||||
$lineItems = array();
|
$lineItems = array();
|
||||||
|
if (isset($document['LineItem']) && is_array($document['LineItem'])) {
|
||||||
foreach ($document['LineItem'] as $li) {
|
foreach ($document['LineItem'] as $li) {
|
||||||
$lineItems[] = array(
|
$lineItems[] = array(
|
||||||
'item_number' => $li['item_number'],
|
'item_number' => isset($li['item_number']) ? $li['item_number'] : '',
|
||||||
'quantity' => $li['quantity'],
|
'quantity' => isset($li['quantity']) ? $li['quantity'] : '',
|
||||||
'title' => $li['title'],
|
'title' => isset($li['title']) ? $li['title'] : '',
|
||||||
'unit_price' => floatval($li['gross_unit_price']),
|
'description' => isset($li['description']) ? $li['description'] : '',
|
||||||
'total_price' => floatval($li['gross_price'])
|
'unit_price' => isset($li['gross_unit_price']) ? floatval($li['gross_unit_price']) : 0.0,
|
||||||
|
'total_price' => isset($li['gross_price']) ? floatval($li['gross_price']) : 0.0,
|
||||||
|
'net_unit_price' => isset($li['net_unit_price']) ? floatval($li['net_unit_price']) : 0.0,
|
||||||
|
'net_price' => isset($li['net_price']) ? floatval($li['net_price']) : 0.0,
|
||||||
|
'discount_percent' => isset($li['discount_percent']) ? floatval($li['discount_percent']) : 0.0,
|
||||||
|
'discount_amount_unit' => isset($li['discount_amount_unit']) ? floatval($li['discount_amount_unit']) : 0.0,
|
||||||
|
'discount_amount_total' => isset($li['discount_amount_total']) ? floatval($li['discount_amount_total']) : 0.0,
|
||||||
|
'option' => isset($li['option']) ? intval($li['option']) : 0,
|
||||||
|
'has_text_prices' => isset($li['has_text_prices']) ? (bool)$li['has_text_prices'] : false,
|
||||||
|
'unit_price_string' => isset($li['unit_price_string']) ? $li['unit_price_string'] : '',
|
||||||
|
'gross_price_string' => isset($li['gross_price_string']) ? $li['gross_price_string'] : ''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$payload = array(
|
$payload = array(
|
||||||
'document_id' => intval($document['Document']['id']),
|
'document_id' => intval($document['Document']['id']),
|
||||||
|
'title' => $document['PackingList']['title'],
|
||||||
'customer_name' => $enquiry['Customer']['name'],
|
'customer_name' => $enquiry['Customer']['name'],
|
||||||
|
'job_title' => isset($job['Job']['title']) ? $job['Job']['title'] : '',
|
||||||
|
'issue_date' => $document['PackingList']['issue_date'],
|
||||||
|
'issue_date_string' => isset($issue_date_string) ? $issue_date_string : '',
|
||||||
|
'ship_via' => $document['PackingList']['ship_via'],
|
||||||
|
'fob' => $document['PackingList']['fob'],
|
||||||
'currency_symbol' => $currencySymbol,
|
'currency_symbol' => $currencySymbol,
|
||||||
|
'currency_code' => isset($currencyCode) ? $currencyCode : 'AUD',
|
||||||
'show_gst' => (bool)$gst,
|
'show_gst' => (bool)$gst,
|
||||||
'line_items' => $lineItems,
|
'line_items' => $lineItems,
|
||||||
'output_dir' => $outputDir
|
'output_dir' => $outputDir
|
||||||
|
|
|
||||||
|
|
@ -7,28 +7,45 @@ $goEndpoint = $goBaseUrl . '/go/pdf/generate-po';
|
||||||
$outputDir = Configure::read('pdf_directory');
|
$outputDir = Configure::read('pdf_directory');
|
||||||
|
|
||||||
$lineItems = array();
|
$lineItems = array();
|
||||||
|
if (isset($document['LineItem']) && is_array($document['LineItem'])) {
|
||||||
foreach ($document['LineItem'] as $li) {
|
foreach ($document['LineItem'] as $li) {
|
||||||
$lineItems[] = array(
|
$lineItems[] = array(
|
||||||
'item_number' => $li['item_number'],
|
'item_number' => isset($li['item_number']) ? $li['item_number'] : '',
|
||||||
'quantity' => $li['quantity'],
|
'quantity' => isset($li['quantity']) ? $li['quantity'] : '',
|
||||||
'title' => $li['title'],
|
'title' => isset($li['title']) ? $li['title'] : '',
|
||||||
'unit_price' => floatval($li['gross_unit_price']),
|
'description' => isset($li['description']) ? $li['description'] : '',
|
||||||
'total_price' => floatval($li['gross_price'])
|
'unit_price' => isset($li['gross_unit_price']) ? floatval($li['gross_unit_price']) : 0.0,
|
||||||
|
'total_price' => isset($li['gross_price']) ? floatval($li['gross_price']) : 0.0,
|
||||||
|
'net_unit_price' => isset($li['net_unit_price']) ? floatval($li['net_unit_price']) : 0.0,
|
||||||
|
'net_price' => isset($li['net_price']) ? floatval($li['net_price']) : 0.0,
|
||||||
|
'discount_percent' => isset($li['discount_percent']) ? floatval($li['discount_percent']) : 0.0,
|
||||||
|
'discount_amount_unit' => isset($li['discount_amount_unit']) ? floatval($li['discount_amount_unit']) : 0.0,
|
||||||
|
'discount_amount_total' => isset($li['discount_amount_total']) ? floatval($li['discount_amount_total']) : 0.0,
|
||||||
|
'option' => isset($li['option']) ? intval($li['option']) : 0,
|
||||||
|
'has_text_prices' => isset($li['has_text_prices']) ? (bool)$li['has_text_prices'] : false,
|
||||||
|
'unit_price_string' => isset($li['unit_price_string']) ? $li['unit_price_string'] : '',
|
||||||
|
'gross_price_string' => isset($li['gross_price_string']) ? $li['gross_price_string'] : ''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$payload = array(
|
$payload = array(
|
||||||
'document_id' => intval($document['Document']['id']),
|
'document_id' => intval($document['Document']['id']),
|
||||||
'title' => $document['PurchaseOrder']['title'],
|
'title' => $document['PurchaseOrder']['title'],
|
||||||
|
'issue_date' => $document['PurchaseOrder']['issue_date'],
|
||||||
|
'issue_date_string' => isset($issue_date) ? $issue_date : '',
|
||||||
'principle_name' => isset($principle['Principle']['name']) ? $principle['Principle']['name'] : $document['PurchaseOrder']['ordered_from'],
|
'principle_name' => isset($principle['Principle']['name']) ? $principle['Principle']['name'] : $document['PurchaseOrder']['ordered_from'],
|
||||||
'principle_reference' => $document['PurchaseOrder']['principle_reference'],
|
'principle_reference' => $document['PurchaseOrder']['principle_reference'],
|
||||||
'issue_date' => $document['PurchaseOrder']['issue_date'],
|
|
||||||
'ordered_from' => $document['PurchaseOrder']['ordered_from'],
|
'ordered_from' => $document['PurchaseOrder']['ordered_from'],
|
||||||
'dispatch_by' => $document['PurchaseOrder']['dispatch_by'],
|
'dispatch_by' => $document['PurchaseOrder']['dispatch_by'],
|
||||||
'deliver_to' => $document['PurchaseOrder']['deliver_to'],
|
'deliver_to' => $document['PurchaseOrder']['deliver_to'],
|
||||||
'shipping_instructions' => $document['PurchaseOrder']['shipping_instructions'],
|
'shipping_instructions' => $document['PurchaseOrder']['shipping_instructions'],
|
||||||
'currency_symbol' => $currencySymbol,
|
'currency_symbol' => $currencySymbol,
|
||||||
|
'currency_code' => isset($currencyCode) ? $currencyCode : 'AUD',
|
||||||
'show_gst' => (bool)$gst,
|
'show_gst' => (bool)$gst,
|
||||||
|
'subtotal' => isset($totals['subtotal']) ? floatval($totals['subtotal']) : 0.0,
|
||||||
|
'gst_amount' => isset($totals['gst']) ? floatval($totals['gst']) : 0.0,
|
||||||
|
'total' => isset($totals['total']) ? floatval($totals['total']) : 0.0,
|
||||||
'line_items' => $lineItems,
|
'line_items' => $lineItems,
|
||||||
'output_dir' => $outputDir
|
'output_dir' => $outputDir
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -13,17 +13,29 @@ if (isset($products) && is_array($products)) {
|
||||||
'item_number' => isset($li['item_number']) ? $li['item_number'] : '',
|
'item_number' => isset($li['item_number']) ? $li['item_number'] : '',
|
||||||
'quantity' => isset($li['quantity']) ? $li['quantity'] : '',
|
'quantity' => isset($li['quantity']) ? $li['quantity'] : '',
|
||||||
'title' => isset($li['title']) ? $li['title'] : '',
|
'title' => isset($li['title']) ? $li['title'] : '',
|
||||||
|
'description' => isset($li['description']) ? $li['description'] : '',
|
||||||
'unit_price' => isset($li['gross_unit_price']) ? floatval($li['gross_unit_price']) : 0.0,
|
'unit_price' => isset($li['gross_unit_price']) ? floatval($li['gross_unit_price']) : 0.0,
|
||||||
'total_price' => isset($li['gross_price']) ? floatval($li['gross_price']) : 0.0,
|
'total_price' => isset($li['gross_price']) ? floatval($li['gross_price']) : 0.0,
|
||||||
|
'net_unit_price' => isset($li['net_unit_price']) ? floatval($li['net_unit_price']) : 0.0,
|
||||||
|
'net_price' => isset($li['net_price']) ? floatval($li['net_price']) : 0.0,
|
||||||
|
'discount_percent' => isset($li['discount_percent']) ? floatval($li['discount_percent']) : 0.0,
|
||||||
|
'discount_amount_unit' => isset($li['discount_amount_unit']) ? floatval($li['discount_amount_unit']) : 0.0,
|
||||||
|
'discount_amount_total' => isset($li['discount_amount_total']) ? floatval($li['discount_amount_total']) : 0.0,
|
||||||
|
'option' => isset($li['option']) ? intval($li['option']) : 0,
|
||||||
|
'has_text_prices' => isset($li['has_text_prices']) ? (bool)$li['has_text_prices'] : false,
|
||||||
|
'unit_price_string' => isset($li['unit_price_string']) ? $li['unit_price_string'] : '',
|
||||||
|
'gross_price_string' => isset($li['gross_price_string']) ? $li['gross_price_string'] : ''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$payload = array(
|
$payload = array(
|
||||||
'document_id' => 0,
|
'document_id' => intval($quote['Quote']['id']),
|
||||||
'cmc_reference' => $enquiry['Enquiry']['title'],
|
'cmc_reference' => $enquiry['Enquiry']['title'],
|
||||||
'revision' => intval($quote['Quote']['revision']),
|
'revision' => intval($quote['Quote']['revision']),
|
||||||
'created_date' => date('Y-m-d', strtotime($enquiry['Enquiry']['created'])),
|
'created_date' => date('Y-m-d', strtotime($enquiry['Enquiry']['created'])),
|
||||||
|
'created_date_string' => date('j M Y', strtotime($enquiry['Enquiry']['created'])),
|
||||||
|
'date_issued' => isset($quote['Quote']['date_issued']) ? $quote['Quote']['date_issued'] : '',
|
||||||
'customer_name' => $enquiry['Customer']['name'],
|
'customer_name' => $enquiry['Customer']['name'],
|
||||||
'contact_email' => $enquiry['Contact']['email'],
|
'contact_email' => $enquiry['Contact']['email'],
|
||||||
'contact_name' => $enquiry['Contact']['first_name'].' '.$enquiry['Contact']['last_name'],
|
'contact_name' => $enquiry['Contact']['first_name'].' '.$enquiry['Contact']['last_name'],
|
||||||
|
|
@ -31,10 +43,21 @@ $payload = array(
|
||||||
'user_last_name' => $enquiry['User']['last_name'],
|
'user_last_name' => $enquiry['User']['last_name'],
|
||||||
'user_email' => $enquiry['User']['email'],
|
'user_email' => $enquiry['User']['email'],
|
||||||
'currency_symbol' => isset($quote['Currency']['symbol']) ? $quote['Currency']['symbol'] : '$',
|
'currency_symbol' => isset($quote['Currency']['symbol']) ? $quote['Currency']['symbol'] : '$',
|
||||||
|
'currency_code' => isset($quote['Currency']['iso4217']) ? $quote['Currency']['iso4217'] : 'AUD',
|
||||||
'show_gst' => (bool)$enquiry['Enquiry']['gst'],
|
'show_gst' => (bool)$enquiry['Enquiry']['gst'],
|
||||||
'commercial_comments' => isset($commercialDetails) ? $commercialDetails : '',
|
'commercial_comments' => isset($document['Quote']['commercial_comments']) ? $document['Quote']['commercial_comments'] : '',
|
||||||
|
'delivery_time' => isset($document['Quote']['delivery_time']) ? $document['Quote']['delivery_time'] : '',
|
||||||
|
'payment_terms' => isset($document['Quote']['payment_terms']) ? $document['Quote']['payment_terms'] : '',
|
||||||
|
'daysValid' => isset($document['Quote']['days_valid']) ? intval($document['Quote']['days_valid']) : 0,
|
||||||
|
'delivery_point' => isset($document['Quote']['delivery_point']) ? $document['Quote']['delivery_point'] : '',
|
||||||
|
'exchange_rate' => isset($document['Quote']['exchange_rate']) ? $document['Quote']['exchange_rate'] : '',
|
||||||
|
'customs_duty' => isset($document['Quote']['customs_duty']) ? $document['Quote']['customs_duty'] : '',
|
||||||
|
'gst_phrase' => isset($gstPhrase) ? $gstPhrase : '',
|
||||||
|
'sales_engineer' => isset($user['User']['first_name']) ? $user['User']['first_name'].' '.$user['User']['last_name'] : '',
|
||||||
|
'bill_to' => isset($enquiry['BillingAddress']['id']) ? formatAddress($enquiry['BillingAddress']) : '',
|
||||||
|
'ship_to' => isset($enquiry['ShippingAddress']['id']) ? formatAddress($enquiry['ShippingAddress']) : '',
|
||||||
'line_items' => $lineItems,
|
'line_items' => $lineItems,
|
||||||
'pages' => array_map(function($p) { return $p['content']; }, $quote['QuotePage']),
|
'pages' => array_map(function($p) { return $p['content']; }, isset($quote['QuotePage']) ? $quote['QuotePage'] : array()),
|
||||||
'output_dir' => $outputDir,
|
'output_dir' => $outputDir,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue