From 03b9924d573fc92897a1e8ac7152606e37158cd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20P=C3=A9rez=20S?= Date: Mon, 10 Aug 2015 10:14:03 +0200 Subject: [PATCH 1/2] Create table if not exists --- application/models/receiving.php | 2 +- application/models/sale.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/application/models/receiving.php b/application/models/receiving.php index 7b7ac409c..b6ee9c13f 100644 --- a/application/models/receiving.php +++ b/application/models/receiving.php @@ -213,7 +213,7 @@ class Receiving extends CI_Model //We create a temp table that allows us to do easy report/receiving queries public function create_receivings_items_temp_table() { - $this->db->query("CREATE TEMPORARY TABLE ".$this->db->dbprefix('receivings_items_temp')." + $this->db->query("CREATE TEMPORARY TABLE IF NOT EXISTS ".$this->db->dbprefix('receivings_items_temp')." (SELECT date(receiving_time) as receiving_date, ".$this->db->dbprefix('receivings_items').".receiving_id, comment, item_location, invoice_number, payment_type, employee_id, ".$this->db->dbprefix('items').".item_id, ".$this->db->dbprefix('receivings').".supplier_id, quantity_purchased, ".$this->db->dbprefix('receivings_items').".receiving_quantity, item_cost_price, item_unit_price, discount_percent, (item_unit_price*quantity_purchased-item_unit_price*quantity_purchased*discount_percent/100) as subtotal, diff --git a/application/models/sale.php b/application/models/sale.php index 167cdaa41..ad4e6fc33 100644 --- a/application/models/sale.php +++ b/application/models/sale.php @@ -395,7 +395,7 @@ class Sale extends CI_Model $subtotal = "1"; } - $this->db->query("CREATE TEMPORARY TABLE ".$this->db->dbprefix('sales_items_temp')." + $this->db->query("CREATE TEMPORARY TABLE IF NOT EXISTS ".$this->db->dbprefix('sales_items_temp')." (SELECT date(sale_time) as sale_date, sale_time, ".$this->db->dbprefix('sales_items').".sale_id, comment,payments.payment_type, item_location, customer_id, employee_id, ".$this->db->dbprefix('items').".item_id, supplier_id, quantity_purchased, item_cost_price, item_unit_price, SUM(percent) as item_tax_percent, discount_percent, ROUND((item_unit_price*quantity_purchased-item_unit_price*quantity_purchased*discount_percent/100)*$subtotal,2) as subtotal, From da41aec0d105b6211b2d4fd5f418f7676fbbac95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20P=C3=A9rez=20S?= Date: Mon, 10 Aug 2015 10:26:11 +0200 Subject: [PATCH 2/2] Spanish traslation --- system/language/es/db_lang.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 system/language/es/db_lang.php diff --git a/system/language/es/db_lang.php b/system/language/es/db_lang.php new file mode 100644 index 000000000..ceaaf20b1 --- /dev/null +++ b/system/language/es/db_lang.php @@ -0,0 +1,29 @@ +