From 15a4e24a21ea2662c94bdd2b4155722a7987aa81 Mon Sep 17 00:00:00 2001 From: Rohit Sharma Date: Tue, 9 May 2017 00:25:42 +0530 Subject: [PATCH 1/2] Fetching Quantity through database --- modules/report/includes/commerce_pos_report.pages.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/report/includes/commerce_pos_report.pages.inc b/modules/report/includes/commerce_pos_report.pages.inc index 12a7b95..e8e00e8 100644 --- a/modules/report/includes/commerce_pos_report.pages.inc +++ b/modules/report/includes/commerce_pos_report.pages.inc @@ -841,6 +841,7 @@ function commerce_pos_report_build_journal_role_table(array $filters = array()) // Join line item data. $query->join('commerce_line_item', 'l', 'l.order_id = t.order_id'); + $query->addField( 'l', 'quantity' ); $query->addExpression('COUNT(DISTINCT l.line_item_id)', 'item_count'); $line_item_types = commerce_product_line_item_types(); @@ -889,11 +890,11 @@ function commerce_pos_report_build_journal_role_table(array $filters = array()) switch ($row->type) { case CommercePosService::TRANSACTION_TYPE_RETURN: - $return_count = $row->item_count; + $return_count = (int)$row->quantity; break; default: - $purchase_count = $row->item_count; + $purchase_count = (int)$row->quantity; break; } From 69917a82c8661f0b169eeaf3bbcf6676217aade3 Mon Sep 17 00:00:00 2001 From: Rohit Sharma Date: Wed, 10 May 2017 00:30:11 +0530 Subject: [PATCH 2/2] Fixed spacing issues --- .../report/includes/commerce_pos_report.pages.inc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/report/includes/commerce_pos_report.pages.inc b/modules/report/includes/commerce_pos_report.pages.inc index e8e00e8..9db71a6 100644 --- a/modules/report/includes/commerce_pos_report.pages.inc +++ b/modules/report/includes/commerce_pos_report.pages.inc @@ -801,7 +801,7 @@ function commerce_pos_report_build_journal_role_table(array $filters = array()) array('data' => t('Discount')), array( 'data' => t('Order Total'), - 'field' => 'ot.commerce_order_total_amount' + 'field' => 'ot.commerce_order_total_amount', ), ); @@ -836,12 +836,12 @@ function commerce_pos_report_build_journal_role_table(array $filters = array()) $query->fields('ot', array( 'commerce_order_total_amount', 'commerce_order_total_currency_code', - 'commerce_order_total_data' + 'commerce_order_total_data', )); // Join line item data. $query->join('commerce_line_item', 'l', 'l.order_id = t.order_id'); - $query->addField( 'l', 'quantity' ); + $query->addField('l', 'quantity'); $query->addExpression('COUNT(DISTINCT l.line_item_id)', 'item_count'); $line_item_types = commerce_product_line_item_types(); @@ -890,11 +890,11 @@ function commerce_pos_report_build_journal_role_table(array $filters = array()) switch ($row->type) { case CommercePosService::TRANSACTION_TYPE_RETURN: - $return_count = (int)$row->quantity; + $return_count = (int) $row->quantity; break; default: - $purchase_count = (int)$row->quantity; + $purchase_count = (int) $row->quantity; break; } @@ -904,7 +904,7 @@ function commerce_pos_report_build_journal_role_table(array $filters = array()) 'attributes' => array( 'class' => array('commerce-pos-report-journal-role-order use-ajax'), 'data-order-id' => $row->order_id, - ) + ), )); $table_row[] = format_date($row->completed, 'custom', 'g:i a');