Sunday 15 July 2012

Add total cost field in sales order report magento -



Add total cost field in sales order report magento -

i have tried total cost in sales order study without success. can see related info in "sales_order_aggregated_created" , "sales_order_aggregated_updated" tables in database unable see total cost of orders. info beingness managed through app/code/core/mage/sales/model/resource/order/collection.php

please help if 1 have thought same value.

finally have done same. have made corrections in 3 files total cost field in sales order report. first of re-create 3 core files local folder. 1.add total cost app/code/local/mage/sales/model/resource/report/order/createdat.php in columns array around line number 95 'total_base_cost' => new zend_db_expr('sum(oi.total_base_cost)') dont forget add together same column (total_base_cost) in sales_order_aggregated_created table in databse. $columns below: $columns = array( // convert dates utc current admin timezone 'period' => $periodexpr, 'store_id' => 'o.store_id', 'order_status' => 'o.status', 'orders_count' => new zend_db_expr('count(o.entity_id)'), 'total_qty_ordered' => new zend_db_expr('sum(oi.total_qty_ordered)'), 'total_base_cost' => new zend_db_expr('sum(oi.total_base_cost)'), 'total_qty_invoiced' => new zend_db_expr('sum(oi.total_qty_invoiced)'), 'total_income_amount' => new zend_db_expr( sprintf('sum((%s - %s) * %s)', $adapter->getifnullsql('o.base_grand_total', 0), $adapter->getifnullsql('o.base_total_canceled',0), $adapter->getifnullsql('o.base_to_global_rate',0) ) ), , add together same column in $cols array value sales/order_item table around line number 204 'total_base_cost' => new zend_db_expr('sum(base_cost)') $cols array is: $cols = array( 'order_id' => 'order_id', 'total_qty_ordered' => new zend_db_expr("sum(qty_ordered - {$qtycanceledexpr})"), 'total_base_cost' => new zend_db_expr('sum(base_cost)'), 'total_qty_invoiced' => new zend_db_expr('sum(qty_invoiced)'), ); 2. add together same column in app/code/local/mage/sales/model/resource/report/order/collection.php arround line 87 'total_base_cost' => 'sum(total_base_cost)', $this->_selected array below: $this->_selectedcolumns = array( 'period' => $this->_periodformat, 'orders_count' => 'sum(orders_count)', 'total_qty_ordered' => 'sum(total_qty_ordered)', 'total_base_cost' => 'sum(total_base_cost)', 'total_qty_invoiced' => 'sum(total_qty_invoiced)', 'total_income_amount' => 'sum(total_income_amount)', 'total_revenue_amount' => 'sum(total_revenue_amount)', 'total_profit_amount' => 'sum(total_profit_amount)', 'total_invoiced_amount' => 'sum(total_invoiced_amount)', 'total_canceled_amount' => 'sum(total_canceled_amount)', 'total_paid_amount' => 'sum(total_paid_amount)', 'total_refunded_amount' => 'sum(total_refunded_amount)', 'total_tax_amount' => 'sum(total_tax_amount)', 'total_tax_amount_actual' => 'sum(total_tax_amount_actual)', 'total_shipping_amount' => 'sum(total_shipping_amount)', 'total_shipping_amount_actual' => 'sum(total_shipping_amount_actual)', 'total_discount_amount' => 'sum(total_discount_amount)', 'total_discount_amount_actual' => 'sum(total_discount_amount_actual)', ); 3. final display column in sales order study grid adding same column in file app/code/local/mage/adminhtml/block/report/sales/sales/grid.php $this->addcolumn('total_base_cost', array( 'header' => mage::helper('sales')->__('cost'), 'type' => 'currency', 'currency_code' => $currencycode, 'index' => 'total_base_cost', 'total' => 'sum', 'sortable' => false, 'rate' => $rate, )); may help else wants add together same column.

magento

No comments:

Post a Comment