Fixes for custom quote columns

This commit is contained in:
David Bomba 2023-05-17 20:46:12 +10:00
parent b47253ba45
commit 58cb6ec874
2 changed files with 11 additions and 3 deletions

View File

@ -874,6 +874,8 @@ class Design extends BaseDesign
// $task.cost => $task.rate
// $task.quantity => $task.hours
nlog("{$key} => {$cell}");
if ($cell == '$task.rate') {
$element['elements'][] = ['element' => 'td', 'content' => $row['$task.cost'], 'properties' => ['data-ref' => 'task_table-task.cost-td']];
} elseif ($cell == '$product.discount' && !$this->company->enable_product_discount) {

View File

@ -151,16 +151,22 @@ trait DesignHelpers
public function processTaxColumns(string $type): void
{
$column_type = $type;
if ($type == 'product' || $type == 'product_quote') {
if ($type == 'product') {
$type_id = 1;
$column_type = 'product_quote';
$type = 'product';
}
if ($type == 'task') {
$type_id = 2;
}
if ($type == 'product_quote') {
$type_id = 1;
$column_type = 'product_quote';
$type = 'product';
}
// At the moment we pass "task" or "product" as type.
// However, "pdf_variables" contains "$task.tax" or "$product.tax" <-- Notice the dollar sign.
// This sprintf() will help us convert "task" or "product" into "$task" or "$product" without