<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>

ERROR - 2020-09-07 12:14:17 --> Severity: Notice --> Array to string conversion /Users/saleem/Sites/sma/app/models/Site.php 1013
ERROR - 2020-09-07 12:14:17 --> Severity: Notice --> Array to string conversion /Users/saleem/Sites/sma/app/models/Site.php 1013
ERROR - 2020-09-07 12:14:40 --> Severity: Notice --> Array to string conversion /Users/saleem/Sites/sma/app/models/Site.php 1013
ERROR - 2020-09-07 12:14:40 --> Severity: Notice --> Array to string conversion /Users/saleem/Sites/sma/app/models/Site.php 1013
ERROR - 2020-09-07 12:16:46 --> Severity: Notice --> Array to string conversion /Users/saleem/Sites/sma/app/models/Site.php 1013
ERROR - 2020-09-07 12:16:46 --> Severity: Notice --> Array to string conversion /Users/saleem/Sites/sma/app/models/Site.php 1013
ERROR - 2020-09-07 12:17:23 --> Severity: Notice --> Array to string conversion /Users/saleem/Sites/sma/app/models/Site.php 1013
ERROR - 2020-09-07 12:17:23 --> Severity: Notice --> Array to string conversion /Users/saleem/Sites/sma/app/models/Site.php 1013
ERROR - 2020-09-07 12:17:23 --> Severity: Notice --> Array to string conversion /Users/saleem/Sites/sma/app/models/Site.php 1014
ERROR - 2020-09-07 12:17:58 --> Severity: Notice --> Array to string conversion /Users/saleem/Sites/sma/app/models/Site.php 1014
ERROR - 2020-09-07 12:19:34 --> Severity: Notice --> Undefined variable: detail /Users/saleem/Sites/sma/app/models/Site.php 1014
ERROR - 2020-09-07 12:31:20 --> Severity: Notice --> Undefined index: HTTP_REFERER /Users/saleem/Sites/sma/app/controllers/Notify.php 25
ERROR - 2020-09-07 12:31:50 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:31:50 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:31:50 --> Could not find the language line "model"
ERROR - 2020-09-07 12:33:20 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:33:20 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:33:20 --> Could not find the language line "model"
ERROR - 2020-09-07 12:34:27 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:34:27 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:34:27 --> Could not find the language line "model"
ERROR - 2020-09-07 12:35:17 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:35:17 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:35:17 --> Could not find the language line "model"
ERROR - 2020-09-07 12:35:53 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:35:53 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:35:53 --> Could not find the language line "model"
ERROR - 2020-09-07 12:36:54 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:36:54 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:36:54 --> Could not find the language line "model"
ERROR - 2020-09-07 12:37:06 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:37:06 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:37:06 --> Could not find the language line "model"
ERROR - 2020-09-07 12:37:46 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:37:46 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:37:46 --> Could not find the language line "model"
ERROR - 2020-09-07 12:38:38 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:38:38 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:38:38 --> Could not find the language line "model"
ERROR - 2020-09-07 12:39:27 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:39:27 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:39:27 --> Could not find the language line "model"
ERROR - 2020-09-07 12:39:37 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:39:37 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:39:37 --> Could not find the language line "model"
ERROR - 2020-09-07 12:40:05 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:40:05 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:40:05 --> Could not find the language line "model"
ERROR - 2020-09-07 12:40:14 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:40:14 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:40:14 --> Could not find the language line "model"
ERROR - 2020-09-07 12:40:41 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:40:41 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:40:41 --> Could not find the language line "model"
ERROR - 2020-09-07 12:41:02 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:41:02 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:41:02 --> Could not find the language line "model"
ERROR - 2020-09-07 12:41:22 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:41:22 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:41:22 --> Could not find the language line "model"
ERROR - 2020-09-07 12:41:44 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:41:44 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:41:44 --> Could not find the language line "model"
ERROR - 2020-09-07 12:42:06 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:42:06 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:42:06 --> Could not find the language line "model"
ERROR - 2020-09-07 12:42:20 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:42:20 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:42:20 --> Could not find the language line "model"
ERROR - 2020-09-07 12:42:38 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:42:38 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:42:38 --> Could not find the language line "model"
ERROR - 2020-09-07 12:43:26 --> More than zero: 10 = 9.0000 + 1.0000 PI: stdClass Object
(
    [id] => 39
    [purchase_id] => 5
    [transfer_id] => 
    [product_id] => 18
    [product_code] => TOY03
    [product_name] => Minion Crazy
    [option_id] => 
    [net_unit_cost] => 9.4300
    [quantity] => 10.0000
    [warehouse_id] => 1
    [item_tax] => 5.7000
    [tax_rate_id] => 3
    [tax] => 6%
    [discount] => 0
    [item_discount] => 0.0000
    [expiry] => 
    [subtotal] => 100.0000
    [quantity_balance] => 9.0000
    [date] => 2020-08-14
    [status] => received
    [unit_cost] => 10.0000
    [real_unit_cost] => 10.0000
    [quantity_received] => 10.0000
    [supplier_part_no] => 
    [purchase_item_id] => 
    [product_unit_id] => 4
    [product_unit_code] => pc
    [unit_quantity] => 10.0000
    [gst] => 
    [cgst] => 
    [sgst] => 
    [igst] => 
    [base_unit_cost] => 
)

ERROR - 2020-09-07 12:43:30 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:43:30 --> Could not find the language line "detail"
ERROR - 2020-09-07 12:43:30 --> Could not find the language line "model"
ERROR - 2020-09-07 12:44:08 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:44:08 --> Could not find the language line "details"
ERROR - 2020-09-07 12:44:08 --> Could not find the language line "model"
ERROR - 2020-09-07 12:44:39 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:45:39 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:46:01 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:46:32 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:46:49 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:50:54 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:51:49 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:52:11 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:53:17 --> Why else: Array
(
    [purchase_id] => 
    [transfer_id] => 
    [product_id] => 22
    [warehouse_id] => 1
    [option_id] => 
    [product_unit_id] => 4
    [product_unit_code] => pc
    [product_code] => TOY07
    [product_name] => Minion Amazed
    [item_tax] => 0.5660
    [unit_cost] => 10.0000
    [real_unit_cost] => 10.0000
    [net_unit_cost] => 9.434
    [quantity_received] => 1.0000
    [unit_quantity] => 1.0000
    [quantity] => 1.0000
    [quantity_balance] => 1.0000
    [subtotal] => 10
    [tax] => 6%
    [tax_rate_id] => 3
    [status] => received
    [date] => 2020-09-07
)

ERROR - 2020-09-07 12:53:17 --> Why else: Array
(
    [purchase_id] => 
    [transfer_id] => 
    [product_id] => 22
    [warehouse_id] => 2
    [option_id] => 
    [product_unit_id] => 4
    [product_unit_code] => pc
    [product_code] => TOY07
    [product_name] => Minion Amazed
    [item_tax] => 0.5660
    [unit_cost] => 10.0000
    [real_unit_cost] => 10.0000
    [net_unit_cost] => 9.434
    [quantity_received] => 0
    [unit_quantity] => 0
    [quantity] => 0
    [quantity_balance] => 0
    [subtotal] => 0
    [tax] => 6%
    [tax_rate_id] => 3
    [status] => received
    [date] => 2020-09-07
)

ERROR - 2020-09-07 12:53:36 --> Could not find the language line "purcahse"
ERROR - 2020-09-07 12:53:45 --> Could not find the language line "logs"
ERROR - 2020-09-07 12:55:00 --> Could not find the language line "logs"
ERROR - 2020-09-07 19:05:12 --> Severity: Notice --> Undefined index: HTTP_REFERER /Users/saleem/Sites/sma/app/controllers/Notify.php 25
ERROR - 2020-09-07 19:16:15 --> Severity: Notice --> Undefined index: return_purchase_ref /Users/saleem/Sites/sma/app/models/admin/Purchases_model.php 58
ERROR - 2020-09-07 19:16:55 --> Severity: Notice --> Undefined index: return_purchase_ref /Users/saleem/Sites/sma/app/models/admin/Purchases_model.php 58
ERROR - 2020-09-07 19:33:19 --> Severity: Notice --> Undefined variable: users /Users/saleem/Sites/sma/themes/default/admin/views/reports/products.php 322
ERROR - 2020-09-07 19:33:19 --> Severity: Warning --> Invalid argument supplied for foreach() /Users/saleem/Sites/sma/themes/default/admin/views/reports/products.php 322
ERROR - 2020-09-07 19:34:15 --> Query error: Unknown column 's.user_id' in 'where clause' - Invalid query: SELECT sma_products.code, sma_products.name, CONCAT(COALESCE( PCosts.purchasedQty, 0 ), '__', COALESCE( PCosts.totalPurchase, 0 )) as purchased, CONCAT(COALESCE( PSales.soldQty, 0 ), '__', COALESCE( PSales.totalSale, 0 )) as sold, (COALESCE( PSales.totalSale, 0 ) - COALESCE( PCosts.totalPurchase, 0 )) as Profit, CONCAT(COALESCE( PCosts.balacneQty, 0 ), '__', COALESCE( PCosts.balacneValue, 0 )) as balance, sma_products.id as id
FROM `sma_products`
LEFT JOIN ( SELECT si.product_id, SUM( si.quantity ) soldQty, SUM( si.subtotal ) totalSale from sma_sales s JOIN sma_sale_items si on s.id = si.sale_id  WHERE  s.user_id = '3'  GROUP BY si.product_id ) PSales ON `sma_products`.`id` = `PSales`.`product_id`
LEFT JOIN ( SELECT product_id, SUM(CASE WHEN pi.purchase_id IS NOT NULL THEN quantity ELSE 0 END) as purchasedQty, SUM(quantity_balance) as balacneQty, SUM( unit_cost * quantity_balance ) balacneValue, SUM( (CASE WHEN pi.purchase_id IS NOT NULL THEN (pi.subtotal) ELSE 0 END) ) totalPurchase from sma_purchase_items pi LEFT JOIN sma_purchases p on p.id = pi.purchase_id WHERE pi.status = 'received'  AND p.user_id = '3'  GROUP BY pi.product_id ) PCosts ON `sma_products`.`id` = `PCosts`.`product_id`
WHERE `sma_products`.`type` = 'standard'
GROUP BY `sma_products`.`code`
ORDER BY `sold` DESC, `purchased` DESC
 LIMIT 10
ERROR - 2020-09-07 19:34:25 --> Query error: Unknown column 's.user_id' in 'where clause' - Invalid query: SELECT sma_products.code, sma_products.name, CONCAT(COALESCE( PCosts.purchasedQty, 0 ), '__', COALESCE( PCosts.totalPurchase, 0 )) as purchased, CONCAT(COALESCE( PSales.soldQty, 0 ), '__', COALESCE( PSales.totalSale, 0 )) as sold, (COALESCE( PSales.totalSale, 0 ) - COALESCE( PCosts.totalPurchase, 0 )) as Profit, CONCAT(COALESCE( PCosts.balacneQty, 0 ), '__', COALESCE( PCosts.balacneValue, 0 )) as balance, sma_products.id as id
FROM `sma_products`
LEFT JOIN ( SELECT si.product_id, SUM( si.quantity ) soldQty, SUM( si.subtotal ) totalSale from sma_sales s JOIN sma_sale_items si on s.id = si.sale_id  WHERE  s.user_id = '3'  GROUP BY si.product_id ) PSales ON `sma_products`.`id` = `PSales`.`product_id`
LEFT JOIN ( SELECT product_id, SUM(CASE WHEN pi.purchase_id IS NOT NULL THEN quantity ELSE 0 END) as purchasedQty, SUM(quantity_balance) as balacneQty, SUM( unit_cost * quantity_balance ) balacneValue, SUM( (CASE WHEN pi.purchase_id IS NOT NULL THEN (pi.subtotal) ELSE 0 END) ) totalPurchase from sma_purchase_items pi LEFT JOIN sma_purchases p on p.id = pi.purchase_id WHERE pi.status = 'received'  AND p.user_id = '3'  GROUP BY pi.product_id ) PCosts ON `sma_products`.`id` = `PCosts`.`product_id`
WHERE `sma_products`.`type` = 'standard'
GROUP BY `sma_products`.`code`
ORDER BY `sold` DESC, `purchased` DESC
 LIMIT 10
ERROR - 2020-09-07 19:36:46 --> Query error: Unknown column 's.user_id' in 'field list' - Invalid query: SELECT sma_products.code, sma_products.name, CONCAT(COALESCE( PCosts.purchasedQty, 0 ), '__', COALESCE( PCosts.totalPurchase, 0 )) as purchased, CONCAT(COALESCE( PSales.soldQty, 0 ), '__', COALESCE( PSales.totalSale, 0 )) as sold, (COALESCE( PSales.totalSale, 0 ) - COALESCE( PCosts.totalPurchase, 0 )) as Profit, CONCAT(COALESCE( PCosts.balacneQty, 0 ), '__', COALESCE( PCosts.balacneValue, 0 )) as balance, sma_products.id as id
FROM `sma_products`
LEFT JOIN ( SELECT si.product_id, s.date as date, s.user_id as user_id, SUM( si.quantity ) soldQty, SUM( si.subtotal ) totalSale from sma_sale_items si JOIN sma_sales s on s.id = si.sale_id  WHERE  s.user_id = '3'  GROUP BY si.product_id ) PSales ON `sma_products`.`id` = `PSales`.`product_id`
LEFT JOIN ( SELECT product_id, p.date as date, p.user_id as user_id, SUM(CASE WHEN pi.purchase_id IS NOT NULL THEN quantity ELSE 0 END) as purchasedQty, SUM(quantity_balance) as balacneQty, SUM( unit_cost * quantity_balance ) balacneValue, SUM( (CASE WHEN pi.purchase_id IS NOT NULL THEN (pi.subtotal) ELSE 0 END) ) totalPurchase from sma_purchase_items pi LEFT JOIN sma_purchases p on p.id = pi.purchase_id WHERE pi.status = 'received'  AND p.user_id = '3'  GROUP BY pi.product_id ) PCosts ON `sma_products`.`id` = `PCosts`.`product_id`
WHERE `sma_products`.`type` = 'standard'
GROUP BY `sma_products`.`code`
ORDER BY `sold` DESC, `purchased` DESC
 LIMIT 10
ERROR - 2020-09-07 19:39:15 --> Query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's.created_by = '1'  GROUP BY si.product_id ) PSales ON `sma_products`.`id` = `PS' at line 3 - Invalid query: SELECT sma_products.code, sma_products.name, CONCAT(COALESCE( PCosts.purchasedQty, 0 ), '__', COALESCE( PCosts.totalPurchase, 0 )) as purchased, CONCAT(COALESCE( PSales.soldQty, 0 ), '__', COALESCE( PSales.totalSale, 0 )) as sold, (COALESCE( PSales.totalSale, 0 ) - COALESCE( PCosts.totalPurchase, 0 )) as Profit, CONCAT(COALESCE( PCosts.balacneQty, 0 ), '__', COALESCE( PCosts.balacneValue, 0 )) as balance, sma_products.id as id
FROM `sma_products`
LEFT JOIN ( SELECT si.product_id, s.date as date, s.created_by as created_by, SUM( si.quantity ) soldQty, SUM( si.subtotal ) totalSale from sma_sale_items si JOIN sma_sales s on s.id = si.sale_id  WHERE  s.date >= '2020-08-01 00:00' AND s.date < '2020-08-31 23:55'  s.created_by = '1'  GROUP BY si.product_id ) PSales ON `sma_products`.`id` = `PSales`.`product_id`
LEFT JOIN ( SELECT product_id, p.date as date, p.created_by as created_by, SUM(CASE WHEN pi.purchase_id IS NOT NULL THEN quantity ELSE 0 END) as purchasedQty, SUM(quantity_balance) as balacneQty, SUM( unit_cost * quantity_balance ) balacneValue, SUM( (CASE WHEN pi.purchase_id IS NOT NULL THEN (pi.subtotal) ELSE 0 END) ) totalPurchase from sma_purchase_items pi LEFT JOIN sma_purchases p on p.id = pi.purchase_id WHERE pi.status = 'received'  AND p.date >= '2020-08-01 00:00' AND p.date < '2020-08-31 23:55'  AND p.created_by = '1'  GROUP BY pi.product_id ) PCosts ON `sma_products`.`id` = `PCosts`.`product_id`
WHERE `sma_products`.`type` = 'standard'
GROUP BY `sma_products`.`code`
ORDER BY `sold` DESC, `purchased` DESC
 LIMIT 10
