From d567a10b7925c8bb97c734e213d6651a979af29d Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Mon, 9 Mar 2009 18:13:09 +0000 Subject: [PATCH] Merging version 2.1 RC to main trunk. --- CHANGELOG.txt | 1751 +++- access/login.php | 36 +- access/logout.php | 11 +- admin/backups.php | 128 +- admin/change_current_user_password.php | 19 +- admin/company_preferences.php | 58 +- admin/create_coy.php | 24 +- admin/db/company_db.inc | 24 +- admin/db/maintenance_db.inc | 161 +- admin/db/users_db.inc | 43 +- admin/db/v_banktrans.inc | 11 +- admin/db/voiding_db.inc | 15 +- admin/display_prefs.php | 91 +- admin/fiscalyears.php | 13 +- admin/forms_setup.php | 24 +- admin/gl_setup.php | 44 +- admin/inst_lang.php | 90 +- admin/inst_module.php | 22 +- admin/payment_terms.php | 13 +- admin/shipping_companies.php | 14 +- admin/users.php | 49 +- admin/view_print_transaction.php | 107 +- admin/void_transaction.php | 13 +- applications/application.php | 11 +- applications/customers.php | 57 +- applications/dimensions.php | 22 +- applications/generalledger.php | 52 +- applications/inventory.php | 46 +- applications/manufacturing.php | 28 +- applications/setup.php | 51 +- applications/suppliers.php | 36 +- company/0/images/logo_frontaccounting.png | Bin 10792 -> 0 bytes config.php | 65 +- dimensions/dimension_entry.php | 16 +- dimensions/includes/dimensions_db.inc | 11 +- dimensions/includes/dimensions_ui.inc | 74 +- dimensions/inquiry/search_dimensions.php | 148 +- dimensions/view/view_dimension.php | 46 +- frontaccounting.php | 58 +- gl/bank_transfer.php | 24 +- gl/gl_bank.php | 63 +- gl/gl_budget.php | 11 +- gl/gl_journal.php | 21 +- gl/includes/db/gl_db_account_types.inc | 17 +- gl/includes/db/gl_db_accounts.inc | 25 +- gl/includes/db/gl_db_bank_accounts.inc | 170 +- gl/includes/db/gl_db_bank_trans.inc | 26 +- gl/includes/db/gl_db_bank_trans_types.inc | 40 - gl/includes/db/gl_db_banking.inc | 63 +- gl/includes/db/gl_db_currencies.inc | 11 +- gl/includes/db/gl_db_rates.inc | 84 +- gl/includes/db/gl_db_trans.inc | 139 +- gl/includes/gl_db.inc | 17 +- gl/includes/gl_ui.inc | 12 +- gl/includes/ui/gl_bank_ui.inc | 71 +- gl/includes/ui/gl_journal_ui.inc | 81 +- gl/inquiry/bank_inquiry.php | 23 +- gl/inquiry/gl_account_inquiry.php | 13 +- gl/inquiry/gl_trial_balance.php | 13 +- gl/manage/bank_accounts.php | 73 +- gl/manage/bank_trans_types.php | 136 - gl/manage/currencies.php | 13 +- gl/manage/exchange_rates.php | 69 +- gl/manage/gl_account_classes.php | 13 +- gl/manage/gl_account_types.php | 63 +- gl/manage/gl_accounts.php | 22 +- gl/view/bank_transfer_view.php | 13 +- gl/view/gl_deposit_view.php | 13 +- gl/view/gl_payment_view.php | 13 +- gl/view/gl_trans_view.php | 12 +- includes/ajax.inc | 27 +- includes/banking.inc | 38 +- includes/current_user.inc | 69 +- includes/data_checks.inc | 31 +- includes/date_functions.inc | 23 +- includes/db/comments_db.inc | 11 +- includes/db/connect_db.inc | 34 +- includes/db/inventory_db.inc | 17 +- includes/db/manufacturing_db.inc | 11 +- includes/db/references_db.inc | 11 +- includes/db/sql_functions.inc | 11 +- includes/errors.inc | 33 +- includes/lang/gettext.php | 6 +- includes/lang/language.php | 112 +- includes/main.inc | 145 +- includes/manufacturing.inc | 11 +- includes/page/footer.inc | 11 +- includes/page/header.inc | 16 +- includes/prefs/sysprefs.inc | 11 +- includes/prefs/userprefs.inc | 89 +- includes/references.inc | 11 +- includes/reserved.inc | 11 +- includes/session.inc | 286 +- includes/systypes.inc | 11 +- includes/types.inc | 80 +- includes/ui.inc | 11 +- includes/ui/allocation_cart.inc | 11 +- includes/ui/items_cart.inc | 13 +- includes/ui/ui_controls.inc | 138 +- includes/ui/ui_globals.inc | 11 +- includes/ui/ui_input.inc | 173 +- includes/ui/ui_lists.inc | 432 +- includes/ui/ui_msgs.inc | 11 +- includes/ui/ui_view.inc | 289 +- index.php | 16 +- install.html | 13 +- install/index.php | 17 +- install/save.php | 59 +- inventory/adjustments.php | 27 +- inventory/cost_update.php | 11 +- inventory/includes/db/items_adjust_db.inc | 11 +- inventory/includes/db/items_category_db.inc | 12 +- inventory/includes/db/items_db.inc | 17 +- inventory/includes/db/items_locations_db.inc | 11 +- inventory/includes/db/items_prices_db.inc | 11 +- inventory/includes/db/items_trans_db.inc | 11 +- inventory/includes/db/items_transfer_db.inc | 11 +- inventory/includes/db/items_units_db.inc | 11 +- inventory/includes/db/movement_types_db.inc | 11 +- inventory/includes/inventory_db.inc | 12 +- inventory/includes/item_adjustments_ui.inc | 48 +- inventory/includes/stock_transfers_ui.inc | 46 +- inventory/inquiry/stock_movements.php | 30 +- inventory/inquiry/stock_status.php | 15 +- inventory/manage/image/0/102.jpg | Bin 14949 -> 0 bytes inventory/manage/image/0/103.jpg | Bin 14412 -> 0 bytes inventory/manage/image/0/104.jpg | Bin 11055 -> 0 bytes inventory/manage/item_categories.php | 15 +- inventory/manage/item_units.php | 16 +- inventory/manage/items.php | 120 +- inventory/manage/locations.php | 16 +- inventory/manage/movement_types.php | 15 +- inventory/prices.php | 28 +- inventory/purchasing_data.php | 12 +- inventory/reorder_level.php | 12 +- inventory/transfers.php | 15 +- inventory/view/view_adjustment.php | 11 +- inventory/view/view_transfer.php | 11 +- js/JsHttpRequest.js | 2 +- js/allocate.js | 10 + js/budget.js | 11 +- js/inserts.js | 107 +- js/utils.js | 50 +- lang/en_US/LC_MESSAGES/en_US.mo | Bin 879 -> 901 bytes lang/en_US/stylesheet.css | 17 - lang/installed_languages.inc | 4 +- .../LC_MESSAGES/empty.po | 8940 ++++++++--------- lang/new_language_template/stylesheet.css | 17 - manufacturing/includes/db/work_centres_db.inc | 11 +- .../includes/db/work_order_issues_db.inc | 11 +- .../db/work_order_produce_items_db.inc | 11 +- .../db/work_order_requirements_db.inc | 11 +- manufacturing/includes/db/work_orders_db.inc | 11 +- .../includes/db/work_orders_quick_db.inc | 11 +- manufacturing/includes/manufacturing_db.inc | 11 +- manufacturing/includes/manufacturing_ui.inc | 11 +- .../includes/work_order_issue_ui.inc | 24 +- manufacturing/inquiry/bom_cost_inquiry.php | 11 +- manufacturing/inquiry/where_used_inquiry.php | 99 +- manufacturing/manage/bom_edit.php | 56 +- manufacturing/manage/work_centres.php | 13 +- manufacturing/search_work_orders.php | 225 +- manufacturing/view/wo_issue_view.php | 11 +- manufacturing/view/wo_production_view.php | 11 +- manufacturing/view/work_order_view.php | 11 +- manufacturing/work_order_add_finished.php | 13 +- manufacturing/work_order_entry.php | 11 +- manufacturing/work_order_issue.php | 13 +- manufacturing/work_order_release.php | 13 +- purchasing/allocations/supplier_allocate.php | 11 +- .../allocations/supplier_allocation_main.php | 131 +- purchasing/includes/db/grn_db.inc | 37 +- purchasing/includes/db/invoice_db.inc | 58 +- purchasing/includes/db/invoice_items_db.inc | 46 +- purchasing/includes/db/po_db.inc | 19 +- purchasing/includes/db/supp_payment_db.inc | 18 +- purchasing/includes/db/supp_trans_db.inc | 44 +- purchasing/includes/db/suppalloc_db.inc | 75 +- purchasing/includes/db/suppliers_db.inc | 11 +- purchasing/includes/po_class.inc | 11 +- purchasing/includes/purchasing_db.inc | 42 +- purchasing/includes/purchasing_ui.inc | 17 +- purchasing/includes/supp_trans_class.inc | 11 +- purchasing/includes/ui/grn_ui.inc | 11 +- purchasing/includes/ui/invoice_ui.inc | 174 +- purchasing/includes/ui/po_ui.inc | 49 +- purchasing/inquiry/po_search.php | 173 +- purchasing/inquiry/po_search_completed.php | 133 +- .../inquiry/supplier_allocation_inquiry.php | 236 +- purchasing/inquiry/supplier_inquiry.php | 245 +- purchasing/manage/suppliers.php | 84 +- purchasing/po_entry_items.php | 25 +- purchasing/po_receive_items.php | 16 +- purchasing/supplier_credit.php | 53 +- purchasing/supplier_invoice.php | 49 +- purchasing/supplier_payment.php | 53 +- purchasing/view/view_grn.php | 11 +- purchasing/view/view_po.php | 17 +- purchasing/view/view_supp_credit.php | 16 +- purchasing/view/view_supp_invoice.php | 13 +- purchasing/view/view_supp_payment.php | 13 +- reporting/fonts/Vera.afm | 1818 ---- reporting/includes/class.pdf.inc | 16 +- reporting/includes/doctext.inc | 14 +- reporting/includes/doctext2.inc | 13 +- reporting/includes/header2.inc | 310 +- reporting/includes/pdf_report.inc | 125 +- reporting/includes/reporting.inc | 140 +- reporting/includes/reports_classes.inc | 177 +- reporting/includes/tcpdf.php | 10 +- reporting/rep101.php | 48 +- reporting/rep102.php | 68 +- reporting/rep103.php | 31 +- reporting/rep104.php | 87 +- reporting/rep105.php | 43 +- reporting/rep106.php | 57 +- reporting/rep107.php | 42 +- reporting/rep108.php | 32 +- reporting/rep109.php | 44 +- reporting/rep110.php | 40 +- reporting/rep201.php | 50 +- reporting/rep202.php | 66 +- reporting/rep203.php | 44 +- reporting/rep204.php | 48 +- reporting/rep209.php | 46 +- reporting/rep301.php | 46 +- reporting/rep302.php | 54 +- reporting/rep303.php | 44 +- reporting/rep304.php | 99 +- reporting/rep401.php | 36 +- reporting/rep501.php | 40 +- reporting/rep601.php | 64 +- reporting/rep701.php | 40 +- reporting/rep702.php | 40 +- reporting/rep704.php | 50 +- reporting/rep705.php | 84 +- reporting/rep706.php | 115 +- reporting/rep707.php | 107 +- reporting/rep708.php | 83 +- reporting/rep709.php | 469 +- reporting/reports_main.php | 214 +- sales/allocations/customer_allocate.php | 11 +- .../allocations/customer_allocation_main.php | 124 +- sales/credit_note_entry.php | 34 +- sales/customer_credit_invoice.php | 30 +- sales/customer_delivery.php | 29 +- sales/customer_invoice.php | 59 +- sales/customer_payments.php | 44 +- sales/includes/cart_class.inc | 83 +- sales/includes/db/branches_db.inc | 19 +- sales/includes/db/credit_status_db.inc | 11 +- sales/includes/db/cust_trans_db.inc | 54 +- sales/includes/db/cust_trans_details_db.inc | 47 +- sales/includes/db/custalloc_db.inc | 80 +- sales/includes/db/customers_db.inc | 11 +- sales/includes/db/payment_db.inc | 18 +- sales/includes/db/sales_credit_db.inc | 30 +- sales/includes/db/sales_delivery_db.inc | 30 +- sales/includes/db/sales_invoice_db.inc | 51 +- sales/includes/db/sales_order_db.inc | 18 +- sales/includes/db/sales_types_db.inc | 11 +- sales/includes/sales_db.inc | 84 +- sales/includes/sales_ui.inc | 25 +- sales/includes/ui/sales_credit_ui.inc | 87 +- sales/includes/ui/sales_order_ui.inc | 366 +- sales/inquiry/customer_allocation_inquiry.php | 295 +- sales/inquiry/customer_inquiry.php | 364 +- sales/inquiry/sales_deliveries_view.php | 295 +- sales/inquiry/sales_orders_view.php | 369 +- sales/manage/credit_status.php | 15 +- sales/manage/customer_branches.php | 46 +- sales/manage/customers.php | 49 +- sales/manage/sales_areas.php | 18 +- sales/manage/sales_people.php | 21 +- sales/manage/sales_types.php | 15 +- sales/sales_order_entry.php | 200 +- sales/view/view_credit.php | 13 +- sales/view/view_dispatch.php | 13 +- sales/view/view_invoice.php | 15 +- sales/view/view_receipt.php | 14 +- sales/view/view_sales_order.php | 47 +- sql/en_US-demo.sql | 2808 +++--- sql/en_US-new.sql | 1715 ++-- taxes/db/item_tax_types_db.inc | 11 +- taxes/db/tax_groups_db.inc | 11 +- taxes/db/tax_types_db.inc | 11 +- taxes/item_tax_types.php | 13 +- taxes/tax_calc.inc | 92 +- taxes/tax_groups.php | 13 +- taxes/tax_types.php | 12 +- themes/aqua/default.css | 151 +- themes/aqua/renderer.php | 59 +- themes/cool/default.css | 145 +- themes/cool/renderer.php | 58 +- themes/default/default.css | 146 +- themes/default/login.css | 11 +- themes/default/renderer.php | 59 +- update.html | 21 +- update_db.php | 174 - 299 files changed, 18633 insertions(+), 14357 deletions(-) delete mode 100644 company/0/images/logo_frontaccounting.png delete mode 100644 gl/includes/db/gl_db_bank_trans_types.inc delete mode 100644 gl/manage/bank_trans_types.php delete mode 100644 inventory/manage/image/0/102.jpg delete mode 100644 inventory/manage/image/0/103.jpg delete mode 100644 inventory/manage/image/0/104.jpg delete mode 100644 lang/en_US/stylesheet.css delete mode 100644 lang/new_language_template/stylesheet.css delete mode 100644 reporting/fonts/Vera.afm delete mode 100644 update_db.php diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d99c67cc..f7a62e7e 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,8 +1,8 @@ /** * @version $Id$ * @package FrontAccounting -* @copyright (C) 2005 - 2009 FrontAccounting -* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL +* @copyright (C) 2005 - 2009 FrontAccounting, LLC +* @license http://www.gnu.org/copyleft/gpl-3.0.html GNU/GPL * FrontAccounting is Free Software */ @@ -19,6 +19,265 @@ Legend: ! -> Note $ -> Affected files +------------------------------- Release 2.1.0 RC ------------------------------------------------ +09-Mar-2009 Joe Hunt +! Release 2.1.0 Release Candidate (RC). +$ config.php +! Report clean up +$ /reporting/includes/excel_report.inc + +09-Mar-2009 Janusz Dobrowolski +# Initial prefs for new created user now copied form current admin settings. +$ /admin/users.php +# Changed page_security level to 1 +$ /admin/display_prefs.php +# Fixed item code display after item delete +$ /inventory/manage/items.php +# Cosmetic cleanup +$ /includes/session.inc + +08-Mar-2009 Joe Hunt +! XLS engine now compatible with PEAR Excel Writer. +$ /reporting/includes/excel_report.inc + /reporting/includes/Workbook.php + +05-Mar-2009 Joe Hunt +! Replaced the Excel Writer engine with XLS driver (the XML driver can later be downloaded) +$ /reporting/includes/ExcelWriterXML.php, ExcelWriterXML_Sheet.php and ExcelWriterXM__Style.php removed. + /reporting/includes/Workbook.php (new file) + /reporting/includes/excel_report.inc + /reporting/includes/pdf_report.inc + /reporting/prn_redirect.php + /reporting all repXXX.php files + +03-Mar-2009 Joe Hunt/Janusz Dobrowolski ++ Preparation for Excel Writer continued +$ /reporting/includes/ExcelWriterXML.php + /reporting/includes/ExcelWriterXML_Sheet.php + /reporting/includes/ExcelWriterXML_Style.php + /reporting/includes/excel_report.inc + /reporting all repXXX.php that are not documents + +02-Mar-2009 Joe Hunt ++ Preparation for report destination PDF/Printer and Excel (and Open Office Calc) +$ /reporting/includes/reports_classes.inc + /reporting/includes/pdf_report.inc + /reporting/includes/ExcelWriterXML.php (new file) + /reporting/includes/ExcelWriterXML_Sheet.php (new file) + /reporting/includes/ExcelWriterXM__Style (new file) + /reporting/includes/excel_report.inc (new file) + /reporting/reports_main.php + /reporting/rep701.php + /reporting/rep705.php + /reporting/rep706.php + /reporting/rep707.php + +01-Mar-2009 Janusz Dobrowolski +# Setting magic_quotes_gpc and register_globals to off in htaccess file +$ /.htaccess (new) + +28-Feb-2009 Joe Hunt +! Improved layout in standard themes (graphics) +$ /themes/aqua/renderer.php + /themes/aqua/help.gif (new file) + /themes/aqua/login.gif (new file) + /themes/aqua/right.gif (new file) + /themes/cool/renderer.php + /themes/cool/help.gif (new file) + /themes/cool/login.gif (new file) + /themes/cool/right.gif (new file) + /themes/default/renderer.php + /themes/default/help.gif (new file) + /themes/default/login.gif (new file) + /themes/default/right.gif (new file) + /themes/themes/login.css + +27-Feb-2009 Janusz Dobrowolski +# Security fix to my last commit. +$ /frontaccounting.php + /includes/lang/language.php + +25-Feb-2009 Joe Hunt +! Improved layout +$ /inventory/prices.php + /inventory/reorder_level.php + /inventory/inquiry/stock_status.php + +24-Feb-2009 Janusz Dobrowolski +# Cleaning startup code +$ /index.php + /frontaccounting.php + /includes/session.inc + /includes/db/connect_db.inc + /includes/lang/gettext.php + /includes/lang/language.php +# Language changed on display prefs page stored to database. +$ /admin/display_prefs.php + /admin/db/users_db.inc + /includes/current_user.inc +# Fixed tab hot keys +$ /applications/customers.php + /applications/dimensions.php + /applications/generalledger.php + /applications/inventory.php + /applications/manufacturing.php + /applications/setup.php + /applications/suppliers.php + +23-Feb-2009 Joe Hunt +! Changed extension include to be outside function. Didn't work in submenus. +$ frontaccounting.php + /includes/main.inc +! Better color in data picker +$ /themes/aqua/default.css + /themes/cool/default.css + /themes/default/default.css + +22-Feb-2009 Janusz Dobrowolski +! Application startup code cleanup. +$ /frontaccounting.php + /index.php + /applications/customers.php + /applications/dimensions.php + /applications/generalledger.php + /applications/inventory.php + /applications/manufacturing.php + /applications/setup.php + /applications/suppliers.php + /includes/session.inc + /includes/lang/language.php + /themes/default/renderer.php + /themes/aqua/renderer.php + /themes/cool/renderer.php +! Removed obsolete $applications array. +$ /config.php +! Cosmetic cleanup +$ /includes/main.inc +! Calendar style moved to theme default.css +$ /includes/ui/ui_view.inc + /themes/aqua/default.css + /themes/cool/default.css + /themes/default/default.css +# Fixed charset selection on login screen +$ /access/login.php +# Blocked password changes in demo mode +$ /admin/change_current_user_password.php +! Default theme and language set for not logged user +$ /includes/current_user.inc + /includes/prefs/userprefs.inc +# Fixed initial query order. +$ /purchasing/inquiry/po_search.php + +21-Feb-2009 Joe Hunt +! Added nowrap for date type fields in db_pager_view.inc. Problems with (-) sep. +$ /includes/ui/db_pager_view.inc +! Better layout in stock_movements.php +$ /inventory/inquiry/stock_movements.php + +18-Feb-2009 Joe Hunt +! Better layout in Items form. +$ /inventory/manage/items.php + +16-Feb-2009 Joe Hunt +# Instruction in update.html should include switch to standard theme before upgrade +$ update.html +# Bug in function get_ecb_rate when no function curl_init (missing url part) +$ /gl/includes/db/gl_db_rates.inc + +------------------------------- Release 2.1.0 beta 2 ------------------------------------------- +15-Feb-2009 Joe Hunt +! Release 2.1.0 beta 2 +$ config.php + +14-Feb-2009 Janusz Dobrowolski +# Removed obsolete bank_trans field +$ /sql/alter2.1.sql + /sql/en_US-demo.sql + /sql/en_US-new.sql +# Drop column queries executed also in not forced upgrade install +$ /admin/db/maintenance_db.inc + +13-Feb-2009 Janusz Dobrowolski +! Added login page language setting +$ /access/login.php + /admin/inst_lang.php + /includes/lang/language.php + /lang/installed_languages.inc +# Message typo fixed +$ /admin/display_prefs.php +# Unified display_error function name in install wizard and main code +$ /install/save.php + +13-Feb-2009 Joe Hunt +# Minor bug fix in Quick Entry tax account choice for Journal Entry. +$ /includes/ui/ui_view.inc + +12-Feb-2009 Janusz Dobrowolski +! Changed extension menu file placement, added support for gettext in extensions. +$ /frontaccounting.php +# Fix for some buggy curl versions. +$ /gl/includes/db/gl_db_rates.inc + /gl/manage/exchange_rates.php +# Fixed get_amount() to return 0 for invalid input. +$ /js/utils.js + /js/budget.js + +------------------------------- Release 2.1.0 beta -------------------------------------------- + +08-Feb-2009 Janusz Dobrowolski +# Fixed division by zero bug in empty pager +$ includes/db_pager.inc +# Fixed special char display issue in item name [0000116] +$ sales/includes/cart_class.inc + +08-Feb-2009 Joe Hunt +! Changed license type to GNU GPLv3. Stamped headers changed. +$ all appropriate source files + +04-Feb-2009 Joe Hunt +! Removed ALTER TABLE DROP columns +$ /sql/alter2.1.sql +! Removed files from CVS +/company/0/images/logo_frontaccounting.png +/reporting/fonts/vera.afm ++ Added files to CVS +/doc/2.1_Beta.txt +/doc/extensions.txt +/themes/default/images/escape.png + +04-Feb-2009 Joe Hunt +# Software Upgrade (re-read of current user needed) +$ /admin/inst_upgrade.php + +03-Feb-2009 Joe Hunt +! install/index.php link to AGPL license +$ /install/index.php + +03-Feb-2009 Janusz Dobrowolski +! Merging bugfixes since 2.0.6 from main trunk (see below) +$ /config.php + /gl/includes/db/gl_db_banking.inc + /gl/manage/gl_account_classes.php + /includes/ui/items_cart.inc + /includes/ui/ui_view.inc + /purchasing/includes/db/invoice_db.inc + /reporting/rep101.php + /reporting/rep201.php + /reporting/includes/class.pdf.inc + /sales/credit_note_entry.php + /sales/customer_credit_invoice.php + /sales/customer_delivery.php + /sales/customer_invoice.php + /sales/includes/db/payment_db.inc + /sales/includes/db/sales_credit_db.inc + /sales/includes/db/sales_delivery_db.inc + /sales/includes/db/sales_invoice_db.inc + /sales/includes/ui/sales_order_ui.inc + /sales/view/view_credit.php +# Due date display finally fixed. +$ /purchasing/inquiry/supplier_inquiry.php + /sales/inquiry/customer_inquiry.php + ------------------------------- Release 2.0.7 -------------------------------------------- 03-Feb-2009 Joe Hunt ! New release 2.0.7 @@ -89,85 +348,688 @@ $ /sales/customer_credit_invoice.php $ /sales/includes/db/sales_invoice_db.inc # Fixed to hide empty credit note lines. $ /sales/view/view_credit.php +------------------------------------------------------------------------------- -------------------------------- Release 2.0.6 -------------------------------------------- -08-Dec-2008 Joe Hunt -! New release 2.0.6 -$ config.php +03-Feb-2009 Janusz Dobrowolski +# sql2date around row[date] in due date. +$ /purchasing/inquiry/supplier_inquiry.php +# Bugfix [0000115] once again. +$ /sales/inquiry/sales_orders_view.php +# Division by zero avoided in db_pager +$ /includes/db_pager.inc -05-Dec-2008 Joe Hunt -# [0000095] Bad behaviour of routine number_format and round in Windows. -$ /gl/includes/gl_db_trans.inc - /includes/banking.inc - /includes/current_user.inc - /purchasing/includes/ui/invoice_ui.inc - /reporting/rep107.php - /reporting/rep109.php - /reporting/rep110.php - /reporting/rep209.php - /sales/view/view_credit.php - /sales/view/view_dispatch.php - /sales/view/view_invoice.php - /sales/view/view_sales_order.php +02-Feb-2009 Joe Hunt +! Better layout in Form setup +$ /admin/forms_setup.php +# sql2date around row[date] in due date. +$ /sales/inquiry/customer_inquiry.php -04-Dec-2008 Janusz Dobrowolski -# Check write permissions and create per company subdirectory structure. -$ /update.html - /update_db.php -# Fixed index.php files in new company dirs. -$ /admin/create_coy.php - /admin/db/maintenance_db.inc +02-Feb-2009 Janusz Dobrowolski +# Fixed initial sort order in pagers +$ /dimensions/inquiry/search_dimensions.php + /includes/db_pager.inc + /purchasing/allocations/supplier_allocation_main.php + /purchasing/inquiry/po_search_completed.php + /purchasing/inquiry/supplier_allocation_inquiry.php + /purchasing/inquiry/supplier_inquiry.php + /sales/allocations/customer_allocation_main.php + /sales/inquiry/customer_allocation_inquiry.php + /sales/inquiry/customer_inquiry.php +# Fixed due date display for invoices. +$ /sales/inquiry/customer_inquiry.php +# Bugfix [0000115] - error on empty table update in fallback mode. +$ /sales/inquiry/customer_allocation_inquiry.php -04-Dec-2008 Joe Hunt -# [0000095] Inbalance double entry on Documents +30-Jan-2009 Joe Hunt ++ Outputs/Inputs on tax inquiry as well (why not) +$ /gl/includes/db/gl_db_trans.inc + /gl/inquiry/tax_inquiry.php +! Updated en_US-demo.sql, en_US-new.sql and alter2.1.sql +$ /sql/alter2.1.sql + /sql/en_US-demo.sql + /sql/en_US-new.sql + +29-Jan-2009 Joe Hunt +# A few minor fixes to get the tax report and inquiry right and syncronized $ /gl/includes/db/gl_db_trans.inc + /gl/inquiry/tax_inquiry.php + /reporting/rep709.php +# Missing parameter to add_trans_tax_details +$ /sales/includes/db/sales_credit_db.inc + /sales/includes/db/sales_delivery_db.inc + /sales/includes/db/sales_invoice_db.inc + +29-Jan-2009 Janusz Dobrowolski +# Changes related to rewrite and optimalization of tax registration +$ /gl/includes/db/gl_db_bank_trans.inc /gl/includes/db/gl_db_banking.inc + /gl/includes/db/gl_db_trans.inc /purchasing/includes/db/invoice_db.inc - /purchasing/includes/db/supp_payment_db.inc - /sales/includes/db/payment_db.inc + /purchasing/includes/db/invoice_items_db.inc + /purchasing/view/view_supp_credit.php + /purchasing/view/view_supp_invoice.php + /reporting/rep107.php + /reporting/rep110.php + /reporting/rep709.php + /sales/includes/db/cust_trans_details_db.inc /sales/includes/db/sales_credit_db.inc + /sales/includes/db/sales_delivery_db.inc /sales/includes/db/sales_invoice_db.inc + /sales/view/view_credit.php + /sales/view/view_dispatch.php + /sales/view/view_invoice.php + /sql/alter2.1.php + /sql/alter2.1.sql + /taxes/tax_calc.inc + /gl/inquiry/tax_inquiry.php +# Added precheck before system upgrade +$ /admin/inst_upgrade.php +# Reduced delay when ECB currency exrates page is unavailable. +$ /gl/includes/db/gl_db_rates.inc +# Small fixes +$ /inventory/prices.php + /includes/ui/ui_view.inc +# Fixed bug in checks before group delete. +$ /sales/manage/sales_groups.php +# Removing obsolete tax group in GL account definition +$ /gl/includes/db/gl_db_accounts.inc + /gl/manage/gl_accounts.php + +28-Jan-2009 Joe Hunt +! Changes to committed tax report routines. +$ /sales/includes/db/sales_invoice_db.inc + /sales/includes/db/sales_delivery_db.inc + /sales/includes/db/sales_credit_db.inc + /purchasing/includes/db/invoice_db.inc + /reporting/rep709.php -29-Nov-2008 Joe Hunt -# [0000094] Report does not show items that have 0 qty but have demand qty -$ /reporting/rep302.php - /reporting/rep303.php +28-Jan-2009 Joe Hunt ++ Copyright notes at top op every source file +$ All files still missing + +27-Jan-2009 Joe Hunt +- Removed file update_db.php (obsolete). Finetuning en_US-demo.sql +$ update_db.php + /sql/en_US-demo.sql +# fixed underline in db pager for sortable columns. +$ /themes/aqua/default.css + /themes/cool/default.css + /themes/default/default.css -28-Nov-2008 Joe Hunt -# [0000093] Voiding Supplier Invoices Causes some lines cost update to go to 0 and exchange rate change -$ /purchasing/includes/db/invoice_db.inc +26-Jan-2009 Joe Hunt ++ Added one Post option to Post options in Quick Entry Lines (amount without decrease or increase). Minor bug fixes. +$ /gl/manage/gl_quick_entries.php + /includes/types.inc + /includes/ui/ui_view.inc ++ Added 'inactive' field in most 'catalog' tables. +$ /sql/alter2.1.sql + /sql/en_US-new.sql + /sql/en_US-demo.sql ++ Added graphics for cancel. (door-out) + /themes/aqua/images/cancel.png + /themes/cool/images/cancel.png + /themes/default/images/cancel.png + +24-Jan-2009 Janusz Dobrowolski +! Set maximum width for select to avoid broken layout in two column layout. +$ /themes/aqua/default.css + /themes/cool/default.css + /themes/default/default.css +# Voiding tax records included via GL/bank transactions +$ /admin/db/voiding_db.inc + /gl/includes/db/gl_db_bank_trans.inc + /gl/includes/db/gl_db_trans.inc +# Fixed quick entry types values. +$ /includes/types.inc + +23-Jan-2009 Joe Hunt ++ Added new files in doc subdirectory +$ /doc/attachments.txt + /doc/bank_reconciliation.txt + /doc/dim_on_invoice.txt + /doc/license.txt + /doc/quick_entries.txt + /doc/recurrent_invoice.txt + +22-Jan-2009 Janusz Dobrowolski +# Added attachments to company sub_dirs +$ /update_db.php +# Added hot key for Quick Entries +$ /applications/generalledger.php +# Improved quick entries. +$ /gl/gl_bank.php + /gl/gl_journal.php + /gl/includes/db/gl_db_bank_accounts.inc + /gl/includes/ui/gl_bank_ui.inc + /gl/includes/ui/gl_journal_ui.inc + /includes/types.inc + /includes/ui/items_cart.inc + /gl/manage/gl_quick_entries.php + /includes/ui/ui_lists.inc + /includes/ui/ui_view.inc + /purchasing/supplier_credit.php + /purchasing/supplier_invoice.php + /purchasing/includes/ui/invoice_ui.inc + /sql/alter2.1.sql + /sql/en_US-demo.sql + /sql/en_US-new.sql +! Registration of changes on GL tax accounts in debtor_trans_tax_details/supp_invoice_tax_details. +$ /gl/includes/db/gl_db_banking.inc + /gl/includes/db/gl_db_trans.inc + /purchasing/includes/db/invoice_db.inc + /sales/includes/db/cust_trans_details_db.inc + /taxes/tax_calc.inc +# Allocation bug for cash sales. +$ /sales/includes/db/sales_invoice_db.inc +# Hiding voided gl transactions. +$ /gl/view/gl_trans_view.php +! Icons removed from form buttons for now. +$ /sales/sales_order_entry.php -27_Nov-2008 Joe Hunt -# [0000092] Stock Sheet Report. Bad Page break. -$ /reporting/includes/pdf_report.inc +20-Jan-2009 Joe Hunt +! Preparing for installing of extensions +$ installed_extensions.php (new file) + frontaccounting.php + /includes/main.inc +# Bad handling of graphic links in certain browsers + /includes/ui/ui_input.inc + +19-Jan-2009 Joe Hunt +! Changed direct sales document line descriptions to be editable (via edit link) +$ /sales/sales_order_entry.php + /includes/cart_class.inc + /includes/ui/sales_order_ui.inc +! Fixed so the printed documents can handle multiple lines of description +$ /reporting/rep107.php + /reporting/rep109.php + /reporting/rep110.php + +17-Jan-2009 Joe Hunt +! Changed all smaller forms and tables to be uniform. Copyright notes. +$ All files with small forms and tables. -26-Nov-2008 Joe Hunt -# [0000091] Tax for 2 decimal places doesn't compute properly -$ /taxes/tax_calc.inc +16-Jan-2009 Janusz Dobrowolski +! Fixed new pager generation on first display. +$ /gl/manage/exchange_rates.php -25-Nov-2008 Janusz Dobrowolski -# [0000084] Low inventory items are not marked properly. -$ /sales/customer_delivery.php -# [0000086] New line added to document sometimes overwrites old one. -$ /sales/includes/cart_class.inc -# [0000087] Change of order date always updates prices. -$ /sales/includes/ui/sales_credit_ui.inc - /sales/includes/ui/sales_order_ui.inc -# Fixed automatic price calculations always on. -$ /sales/includes/sales_db.inc +15-Jan-2009 Joe Hunt +! Adjustment of db pager width. Copyright notes. +$ All files with db pager + /db_pager_view.inc + /themes/default/default.css + /themes/aqua/default.css + /themes/cool/default.css -------------------------------- Release 2.0.5 -------------------------------------------- -24-Nov.2008 Joe Hunt -! Release 2.0.5 -$ config.php -! Changed update.html -$ update.html -# Small bug fixes -$ /reporting/includes/header2.inc - /sales/view/view_receipt.php +15-Jan-2009 Janusz Dobrowolski +! Rewritten reconciliation page. +$ /gl/bank_account_reconcile.php + /includes/ui/ui_lists.inc + /sql/alter2.1.php + /sql/alter2.1.sql + /js/reconcile.js (added) +! Standard mysql separator in date functions +$ /includes/date_functions.inc ++ Separated checkbox generation for indirect display use +$ /includes/ui/ui_input.inc +! Standard checkbox helper use. +$ /sales/inquiry/sales_orders_view.php -20-Nov-2008 Janusz Dobrowolski -# [0000082] Bad js allocation on All/None button press. +14-Jan-2009 Joe Hunt +! Page reload problem, progress bar in backup/restore, +$ /admin/backups.php + /admin/display_prefs.php + /includes/lang/language.php + +12-Jan-2009 Joe Hunt +! Updating install and update helpers +$ install.html + update.html + /install/index.php +# Fixing price formatting of left to allocate +$ /purchasing/allocations/supplier_allocation_main.php + /sales/allocations/customer_allocation_main.php + +11-Jan-2009 Janusz Dobrowolski +! Added table pager. +$ /admin/view_print_transaction.php +! Improved check_cells(). +$ /includes/ui/ui_input.inc +# Added new attachments per company subdirectory. +$ /admin/create_coy.php +# Added hotkey for reconciliation menu option. +$ /applications/generalledger.php +# Fixed false qoh alerts. +$ /sales/includes/ui/sales_order_ui.inc +# Fixed page title. +$ /sales/manage/sales_points.php + +11-Jan-2009 Joe Hunt +! Changed notice msg to warnings and changed bg color for warning +$ /admin/company_preferences.php + /admin/void_transaction.php + /includes/errors.inc + /inventory/manage/items.php + +10-Jan-2009 Joe Hunt ++ Addition of Bank Reconciliation. Author Rob Mallon +$ /applications/generalledger.php + /gl/bank_account_reconcile.php (new file) + /sql/alter2.1.sql ++ Added more fields to suppliers table and fixed PO document +$ /sql/alter2.1.sql + /includes/ui/ui_input.inc (new link_row) + /purchasing/manage/suppliers.php + /reporting/includes/header2.inc + /reporting/rep209.php + +09-Jan-2009 Janusz Dobrowolski ++ Added hook file for localized functions. +$ /includes/lang/language.php +! Removed obsolete local css file inclusion. +$ /includes/page/header.inc +! Optional params in table_header() added. +$ /includes/ui/ui_controls.inc +! Added table pager in exchange rates editor. +$ /gl/includes/db/gl_db_rates.inc + /gl/manage/exchange_rates.php +! Fixed rate column, added width table parameter +$ /includes/db_pager.inc + /includes/ui/db_pager_view.inc +# Added hot key for attachments menu option. +$ /applications/setup.php +# Removed bank_trans_types_db.inc inclusion. +$ /gl/includes/gl_db.inc +- Removed obsolete files +$ /gl/manage/bank_trans_types.php (removed) + /gl/includes/db/bank_trans_types.inc (removed) + /lang/en_US/stylesheet.css (removed) + /lang/new_language_template/stylesheet.css (removed) +- Example picture files moved to company/0 +$ /inventory/manage/image (removed) + /inventory/manage/image/0 (removed) + /inventory/manage/image/0/102.jpg (removed) + /inventory/manage/image/0/103.jpg (removed) + /inventory/manage/image/0/104.jpg (removed) + +09-Jan-2009 Joe Hunt +! Changed $path_to_root in report files and stamped copyright +$ All report files ++ Added Sales kits to Items price list. +$ /reporting/rep104.php +# Company logo can not be deleted. +$ /admin/company_preferences.php +# Bug [0000107] and [0000108] +$ /inventory/includes/db/items_codes_db.inc + /gl/manage/gl_account_types.php + +08-Jan-2009 Joe Hunt +! Changed attachments to use unique files store instead of blobs +$ /admin/attachments/attachments.php + /sql/alter2.1.sql + +07-Jan-2009 Joe Hunt +! Changed supplier credit note to only show items for a period, default 30 days back. +$ /purchasing/includes/db/grn_db.inc + /purchasing/includes/invoice_ui.inc + /purchasing/supplier_credit.php + +07-Jan-2009 Janusz Dobrowolski +# [0000105] Not initialized user pos numbers after upgrade, fixed some new table fields. +$ /sql/alter2.1.sql +# [0000106] Error blocking direct invoice for currencies not listed by ECB. +$ sales/includes/cart_class.inc +# Fixed error handling in forced upgrade mode. +$ admin/db/maintenance_db.inc ++ Added backtrace debugging function; +$ /includes/ui/ui_view.inc + +05-Jan-2009 Joe Hunt ++ Possibility to 'Credit This' in supplier transactions like in customer transaction. + If there are many invoice items during a year, there would be many rows suggestions. +$ /purchasing/includes/db/grn_db.inc + /purchasing/includes/db/invoice_db.inc + /purchasing/includes/ui/invoice_ui.inc + /purchasing/supplier_credit.php + /purchasing/inquiry/supplier_inquiry.php + /purchasing/view/view_supp_credit.php + +22-Dec-2008 Janusz Dobrowolski +# Fixed item_code database update on item creation. +$ /inventory/includes/db/item_codes_db.inc + /inventory/includes/db/items_db.inc + +21-Dec-2008 Joe Hunt +# Minor bugs in layout and quick entries. +$ /Includes/ui/ui_view.inc + /purchasing/includes/ui/invoice_ui.inc + /purchasing/supplier_invoice.php +# Minor bugs in doctext.inc and doctext2.inc +$ /reporting/includes/doctext.inc + /reporting/includes/doctext2.inc + +20-Dec-2008 Joe Hunt +! Replaced the ajax paging in stock movements with the old file. +$ /inventory/inquiry/stock_movements.php +! Better layout in big forms +$ /includes/ui/ui_controls.inc + +18-Dec-2008 Joe Hunt ++ Added quick entries in supplier invoice/credit note as well. Based on bank payments +$ /gl/gl_bank.php + /gl/gl_journal.php + /gl/includes/db/gl_db_banking.inc + /includes/ui/ui_view.inc + /purchasing/supplier_credit.php + /purchasing/supplier_invoice.php + /purchasing/includes/ui/invoice_ui.inc + +15-Dec-2008 Janusz Dobrowolski +# [0000085] Fixed session conflicts during document edition in multiply tabs. +$ /sales/includes/cart_class.inc + /sales/includes/sales_ui.inc + /sales/credit_note_entry.php + /sales/customer_credit_invoice.php + /sales/customer_delivery.php + /sales/customer_invoice.php + /sales/sales_order_entry.php + /sales/view/view_sales_order.php +# Fixed initial form values. +$ /sales/manage/recurrent_invoices.php +! Code cleanup. +$ /purchasing/view/view_po.php + /sales/includes/ui/sales_credit_ui.inc + /sales/includes/ui/sales_order_ui.inc + +12-Dec-2008 Joe Hunt +! Changed so document Sales Invoice now shows delivery notes instead of sales order +$ /reporting/includes/header2.inc + +11-Dec-2008 Joe Hunt ++ Two new fields in company table, accumulate_shipping and logal_text + Accumulat shipping is for accumulating shipping on batch invoice + Legal text is a last line legal info on sales invoices. +$ /sql/alter2.1.sql + /admin/db/company_db.inc + /admin/gl_setup.php + /reporting/includes/header2.inc + /sales/customer_invoice.php + +10-Dec-2008 Janusz Dobrowolski +# File and line was not displayed for devel error messages. +$ /includes/errors.inc +# Fixed duplicate groups in list selectors. +$ /includes/ui/ui_lists.inc + +09-Dec-2008 Joe Hunt +# Bug in document right-margin when more than 1 page. +$ /reporting/includes/header2.inc +! Changed so input of account type is possible (like classes) +$ /gl/manage/gl_account_types.php + /gl/includes/db/gl_db_account_types.inc + +08-Dec-2008 Janusz Dobrowolski ++ Added helpers for list editor F4 calls. +$ /includes/ui/ui_controls.inc + /sales/sales_order_entry.php ++ Added development/bugtracking sql trail +$ /config.php + /sql/alter2.1.sql + /includes/db/connect_db.inc +! GL accounts in list selector always grouped by type +$ /admin/gl_setup.php + /gl/includes/ui/gl_bank_ui.inc + /gl/includes/ui/gl_journal_ui.inc + /gl/manage/bank_accounts.php + /gl/manage/gl_accounts.php + /gl/manage/gl_quick_entries.php + /includes/ui/ui_lists.inc + /purchasing/includes/ui/invoice_ui.inc + /sales/manage/customer_branches.php +# Fixed Win AltGr issue in hotkeys system. +$ /js/inserts.js +# Fixed sales_items selector for MySql 3.xx compatibility +$ /includes/ui/ui_lists.inc +# Fixed broken syntax in delete_item_code() +$ /inventory/includes/db/items_codes_db.inc +# Additional fixes to foreign/kit codes +$ /inventory/manage/item_codes.php + /inventory/manage/sales_kits.php +! Merged changes from main trunk up to version 2.0.6 (see below) +$ /config.php + /update.html + /update_db.php + /admin/create_coy.php + /admin/db/maintenance_db.inc + /gl/includes/db/gl_db_banking.inc + /gl/includes/db/gl_db_trans.inc + /includes/banking.inc + /includes/current_user.inc + /manufacturing/view/wo_production_view.php + /purchasing/includes/db/invoice_db.inc + /purchasing/includes/db/supp_payment_db.inc + /purchasing/includes/ui/invoice_ui.inc + /reporting/rep107.php + /reporting/rep109.php + /reporting/rep110.php + /reporting/rep209.php + /reporting/rep302.php + /reporting/rep303.php + /reporting/includes/pdf_report.inc + /sales/customer_delivery.php + /sales/includes/cart_class.inc + /sales/includes/sales_db.inc + /sales/includes/db/payment_db.inc + /sales/includes/db/sales_credit_db.inc + /sales/includes/db/sales_invoice_db.inc + /sales/includes/ui/sales_credit_ui.inc + /sales/includes/ui/sales_order_ui.inc + /sales/view/view_credit.php + /sales/view/view_dispatch.php + /sales/view/view_invoice.php + /sales/view/view_sales_order.php + /taxes/tax_calc.inc +------------------------------- Release 2.0.6 -------------------------------------------- +08-Dec-2008 Joe Hunt +! New release 2.0.6 +$ config.php + +05-Dec-2008 Joe Hunt +# [0000095] Bad behaviour of routine number_format and round in Windows. +$ /gl/includes/gl_db_trans.inc + /includes/banking.inc + /includes/current_user.inc + /purchasing/includes/ui/invoice_ui.inc + /reporting/rep107.php + /reporting/rep109.php + /reporting/rep110.php + /reporting/rep209.php + /sales/view/view_credit.php + /sales/view/view_dispatch.php + /sales/view/view_invoice.php + /sales/view/view_sales_order.php + +04-Dec-2008 Janusz Dobrowolski +# Check write permissions and create per company subdirectory structure. +$ /update.html + /update_db.php +# Fixed index.php files in new company dirs. +$ /admin/create_coy.php + /admin/db/maintenance_db.inc + +04-Dec-2008 Joe Hunt +# [0000095] Inbalance double entry on Documents +$ /gl/includes/db/gl_db_trans.inc + /gl/includes/db/gl_db_banking.inc + /purchasing/includes/db/invoice_db.inc + /purchasing/includes/db/supp_payment_db.inc + /sales/includes/db/payment_db.inc + /sales/includes/db/sales_credit_db.inc + /sales/includes/db/sales_invoice_db.inc + +29-Nov-2008 Joe Hunt +# [0000094] Report does not show items that have 0 qty but have demand qty +$ /reporting/rep302.php + /reporting/rep303.php + +28-Nov-2008 Joe Hunt +# [0000093] Voiding Supplier Invoices Causes some lines cost update to go to 0 and exchange rate change +$ /purchasing/includes/db/invoice_db.inc + +27_Nov-2008 Joe Hunt +# [0000092] Stock Sheet Report. Bad Page break. +$ /reporting/includes/pdf_report.inc + +26-Nov-2008 Joe Hunt +# [0000091] Tax for 2 decimal places doesn't compute properly +$ /taxes/tax_calc.inc + +25-Nov-2008 Janusz Dobrowolski +# [0000084] Low inventory items are not marked properly. +$ /sales/customer_delivery.php +# [0000086] New line added to document sometimes overwrites old one. +$ /sales/includes/cart_class.inc +# [0000087] Change of order date always updates prices. +$ /sales/includes/ui/sales_credit_ui.inc + /sales/includes/ui/sales_order_ui.inc +# Fixed automatic price calculations always on. +$ /sales/includes/sales_db.inc + +08-Dec-2008 Joe Hunt +! Better support for purchasing data (automatic updating from PO receive) +$ /purchasing/includes/db/grn_db.inc + /purchasing/includes/db/invoice_db.inc + /purchasing/includes/db/po_db.inc + /purchasing/includes/ui/invoice_ui.inc + /purchasing/includes/purchasing_db.inc + /reporting/rep209.php + +07-Dec-2008 Janusz Dobrowolski ++ Added list category grouping. +$ /includes/ui/ui_lists.inc +! Changed branch/customer invoice address/name selection on reports +$ /reporting/includes/doctext.inc + /reporting/includes/doctext2.inc + /reporting/includes/header2.inc +! Fixed default delivery address selection +$ /sales/includes/ui/sales_order_ui.inc ++ Added delivery links +$ /sales/view/view_invoice.php +# Small syntax fix. +$ /sql/alter2.1.php +# Fixed error handling during upgrade +$ /admin/db/maintenance_db.inc +# Fixed warnings display +$ /includes/errors.inc + +08-Dec-2008 Joe Hunt +# Bad and missing parameter to header2 funciton +$ /reporting/rep109.php + /reporting/rep209.php +! Rerun of invoice_ui.inc +$ /purchasing/includes/ui/invoice_ui.inc + +07-Dec-2008 Joe Hunt +! Better layout. Copyright notes. Mailto links, outer table routines. +$ /admin/company_preferences.php + /admin/display_prefs.php + /admin/gl_setup.php + /admin/users.php + /gl/includes/ui/gl_bank_ui.inc + /gl/includes/ui/gl_journal_ui.inc + /includes/ui_controls.inc + /includes/ui_input.inc + /inventory/adjustments.php + /inventory/transfers.php + /inventory/includes/item_adjustments_ui.inc + /inventory/includes/stock_transfers_ui.inc + /inventory/manage/locations.php + /purchasing/includes/ui/invoice_ui.inc + /purchasing/includes/ui/po_ui.inc + /purchasing/manage/suppliers.php + /purchasing/supplier_credit.php + /purchasing/supplier_invoice.php + /purchasing/supplier_payment.php + /sales/includes/ui/sales_credit_ui.inc + /sales/includes/ui/sales_order_ui.inc + /sales/manage/customer_branches.php + /sales/manage/customers.php + /sales/manage/sales_people.php + /sales/customer_payments.php + +05-Dec-2008 Joe Hunt ++ New fields in suppliers, phone, fax, vat no, contact and credit limit +$ /purchasing/suppliers.php + /sql/alter2.1.sql +! Changed dimension view to show result instead of ledger trans +$ /dimensions/view/view_dimension.php + /dimensions/includes/dimension_ui.inc + +05-Dec-2008 Janusz Dobrowolski +! Allowed optional ORDER BY option in base db_pager sql query +$ /includes/db_pager.inc +# Small fixes to pager layout +$ /includes/ui/db_pager_view.inc +! Reusable button code +$ /includes/ui/ui_controls.inc +! Button helpers moved from ui_controls.inc +$ /includes/ui/ui_input.inc + /includes/ui/ui_controls.inc +# Fixed errors during focus on nonexistent elements +$ /js/utils.js + +26-Nov-2008 Janusz Dobrowolski +# Fixed layout of amount_ex() fields with label. +$ /includes/ui/ui_input.inc +# Fixed combo_input for $sql with GROUP BY option +$ /includes/ui/ui_lists.inc + +25-Nov-2008 Janusz Dobrowolski +! Merged all changes from main trunk up to 2.0.5 (see details below) +$ /CHANGELOG.txt + /update.html + /admin/void_transaction.php + /admin/db/voiding_db.inc + /gl/includes/db/gl_db_trans.inc + /gl/inquiry/gl_trial_balance.php + /includes/banking.inc + /includes/ui/ui_input.inc + /includes/ui/ui_view.inc + /manufacturing/manage/bom_edit.php + /purchasing/po_receive_items.php + /purchasing/supplier_credit.php + /purchasing/supplier_invoice.php + /purchasing/supplier_payment.php + /purchasing/includes/purchasing_db.inc + /purchasing/includes/db/invoice_db.inc + /purchasing/includes/db/supp_payment_db.inc + /purchasing/includes/db/supp_trans_db.inc + /purchasing/includes/ui/invoice_ui.inc + /reporting/rep101.php + /reporting/rep106.php + /reporting/rep201.php + /reporting/rep203.php + /reporting/rep209.php + /reporting/rep708.php + /reporting/reports_main.php + /reporting/includes/class.pdf.inc + /sales/customer_payments.php + /sales/allocations/customer_allocate.php + /sales/includes/sales_db.inc + /sales/includes/db/cust_trans_db.inc + /sales/includes/db/payment_db.inc + /sales/view/view_receipt.php +------------------------------- Release 2.0.5 -------------------------------------------- +24-Nov.2008 Joe Hunt +! Release 2.0.5 +$ config.php +! Changed update.html +$ update.html +# Small bug fixes +$ /reporting/includes/header2.inc + /sales/view/view_receipt.php + +20-Nov-2008 Janusz Dobrowolski +# [0000082] Bad js allocation on All/None button press. $ /sales/allocations/customer_allocate.php 20-Nov-2008 Joe Hunt @@ -189,105 +1051,718 @@ $ /purchasing/po_receive_items.php $ /gl/inquiry/gl_trial_balance.php /reporting/rep708.php -07-Nov-2008 Joe Hunt -! [0000081] Changed Trial Balance to show all debits and credits (option to only show balances) -$ /gl/inquiry/gl_trial_balance.php - /reporting/reports_main.php - /reporting/rep708.php +07-Nov-2008 Joe Hunt +! [0000081] Changed Trial Balance to show all debits and credits (option to only show balances) +$ /gl/inquiry/gl_trial_balance.php + /reporting/reports_main.php + /reporting/rep708.php + +03-Nov-2008 Janusz Dobrowolski +# Fixed price priority in automatic calculations. +$ sales/includes/sales_db.inc + +30-Oct-2008 Janusz Dobrowolski +# [0000080] BOM elements was not editable after entry. +$ /manufacturing/manage/bom_edit.php + +29-Oct-2008 Joe Hunt +# Voiding a supplier invoice/credit note with GL Postings creates a database error +$ /purchasing/includes/db/invoice_db.inc + +28-Oct-2008 Joe Hunt +# [0000079] Delivery Note/Sales Invoice should not be editable after it has been voided. +$ /admin/db/voiding_db.inc + /sales/inquiry/sales_deliveries_view.php + /sales/inquiry/customer_inquiry.php + +27-Oct-2008 Joe Hunt +! [0000078] Opened Exchange rate for editing (without storing) in sales/purchasing module payment +# Fixed exchange rate display bugs in Supplier Payment (earlier dates). +$ /gl/includes/db/gl_db_trans.inc + /includes/banking.inc + /includes/ui/ui_view.inc + /purchasing/supplier_payment.php + /purchasing/includes/purchasing_db.inc + /purchasing/includes/db/supp_payment_db.inc + /purchasing/includes/db/supp_trans_db.inc + /sales/customer_payments.php + /sales/includes/sales_db.inc + /sales/includes/db/cust_trans_db.inc + /sales/includes/db/payment_db.inc +# [0000078] Fixed some reports with wrong exchange rates. +$ /reporting/rep101.php + /reporting/rep106.php + /reporting/rep201.php + /reporting/rep203.php + /reporting/rep209.php ++ Added confirm box when admins are about to remove PO GRNs from Supplier Invoice +$ /purchasing/supplier_invoice.php + +24-Oct-2008 Joe Hunt +! [0000077] Added a total before ending balance in trial balance (also in report) +$ /gl/inquiry/gl_trial_balance.php + /reporting/rep708.php +! Increased memory limit if reports in unicode (48M) as suggested in forum. + /reporting/includes/class.pdf.inc +! Improved layout of Supplier Invoice/Credit. All Items can now be added in one sweep. +$ /purchasing/supplier_invoice.php + /purchasing/supplier_credit.php + /purchasing/includes/ui/invoice_ui.inc + +------------------------------- Release 2.0.4 -------------------------------------------- +23-Oct-2008 Joe Hunt +! Release 2.0.4 +25-Nov-2008 Joe Hunt +! Inserted Copyright Notice and fixed graphic items +$ /access/login.php + /access/logout.php + /admin/attachments.php + /admin/backups.php + /admin/change_current_user_password.php + /admin/db/company_db.inc + /admin/db/maintenence_db.inc + /admin/db/printers_db.inc + /admin/db/users_db.inc + /admin/db/v_banktrans.inc + /admin/db/voiding_db.inc + /admin/display_prefs.php + /admin/fiscalyears.php + /admin/forms_setup.php + /admin/gl_setup.php + /admin/inst_upgrade.php + /admin/payment_terms.php + /admin/print_profiles.php + /admin/printers.php + /admin/shipping_companies.php + /admin/users.php + /admin/view_print_transaction.php + /admin/void_transaction.php + /gl/gl_journal.php + /gl/includes/ui/gl_bank_ui.inc + /gl/includes/ui/gl_journal_ui.inc + /gl/inquiry/bank_inquiry.php + /gl/inquiry/tax_inquiry.php + /gl/manage/bank_accounts.php + /includes/ui/ui_controls.inc + /reporting/includes/pdf_report.inc + /reporting/rep709.php + /sales/includes/ui/sales_credit_ui.inc + /sql/alter2.1.php + +24-Nov-2008 Janusz Dobrowolski ++ Added alias/foreign item codes and sales kits support. +$ /applications/inventory.php + /includes/ui/ui_lists.inc + /inventory/prices.php + /inventory/includes/inventory_db.inc + /inventory/includes/db/items_category_db.inc + /inventory/includes/db/items_db.inc + /inventory/manage/items.php + /inventory/includes/db/items_codes_db.inc (new) + /inventory/manage/item_codes.php (new) + /inventory/manage/sales_kits.php (new) + /sales/includes/sales_db.inc + /sales/includes/ui/sales_order_ui.inc +! Added decimals to get_item_edit_info() return (sql usage optimization). +$ /includes/db/inventory_db.inc + /inventory/includes/item_adjustments_ui.inc + /inventory/includes/stock_transfers_ui.inc + /manufacturing/includes/work_order_issue_ui.inc + /purchasing/includes/ui/po_ui.inc + /sales/includes/ui/sales_credit_ui.inc +! Added postlabel update in amount_cells_ex() and derivative helpers, fixed qty_cell $dec handling +$ /includes/ui/ui_input.inc +# Fixed _vd() debug function for use also in ajax mode. +$ /includes/ui/ui_view.inc +! Changed foreign column name to avoid mysql syntax problems, added category. +$ /sql/alter2.1.sql + /sql/alter2.1.php +# Fixed unconsistent units of measure. +$ /sql/en_US-demo.sql + /sql/en_US-new.sql + +24-Nov-2008 Joe Hunt +! Preparing for graphic Links +$ config.php + /includes/ui/ui_input.inc + /sales/sales_order_entry.php + /sales/includes/ui/sales_order_ui.inc + /themes/aqua/images/ok.gif + /themes/cool/images/ok.gif + /themes/default/images/ok.gif +# Small layout bug in header2.inc +$ /reporting/includes/header2.inc +# Small layout bug in report bank statement +$ /reporting/rep601.php +# Restriction on links +$ /sales/inquiry/customer_inquiry.php + +22-Nov-2008 Joe Hunt ++ Preparing for Graphic Links final.Optimized. +$ config.php + /admin/create_coy.php + /admin/inst_lang.php + /admin/inst_module.php + /dimensions/inquiry/search_dimensions.php + /includes/ui/ui_controls.inc + /includes/ui/ui_view.inc + /includes/db_pager_view.inc + /manufacturing/search_work_orders.php + /purchasing/inquiry/po_search.php + /purchasing/inquiry/po_search_completed.php + /purchasing/inquiry/supplier_allocation_inquiry.php + /purchasing/allocations/supplier_allocation_main.php + /reporting/includes/reporting.inc + /sales/allocations/customer_allocation_main.php + /sales/inquiry/customer_allocation_inquiry.php + /sales/inquiry/customer_inquiry.php + /sales/inquiry/sales_orders_view.php + /sales/inquiry/sales_deliveries_view.php + /themes/default/images/receive.gif (new file) + /themes/aquat/images/receive.gif (new file) + /themes/cool/images/receive.gif (new file) + + +21-Nov-2008 Joe Hunt ++ Preparing for Graphic Links instead of Text Links (user display option, default) + (new field in 0_users, graphic_links) +$ config.php + /admin/display_prefs.php + /admin/create_coy.php + /admin/inst_lang.php + /admin/inst_module.php + /admin/db/users_db.inc + /includes/current_user.inc + /includes/prefs/userprefs.inc + /includes/ui/ui_controls.inc + /includes/ui/ui_input.inc + /includes/ui/ui_view.inc + /reporting/includes/reporting.inc + /sql/alter2.1.sql + /themes/default/images/add.png, credit.gif, delete.gif, download.gif, edit.gif, gl.png, + invoice.gif, money.png, pdf.gif, print.png, remove.png, report.png, view.gif + /themes/aqua/images/add.png, credit.gif, delete.gif, download.gif, edit.gif, gl.png, + invoice.gif, money.png, pdf.gif, print.png, remove.png, report.png, view.gif + /themes/cool/images/add.png, credit.gif, delete.gif, download.gif, edit.gif, gl.png, + invoice.gif, money.png, pdf.gif, print.png, remove.png, report.png, view.gif + +20-Nov-2008 Joe Hunt ++ Added new AGPL license file +$ /doc/license.txt (new file) + +19-Nov-2008 Janusz Dobrowolski +# Fixed error handling during database upgrade in normal and forced mode. +$ /admin/db/maintenance_db.inc +! Additions needed for foreign item codes support. +$ /sql/alter2.1.php + /sql/alter2.1.sql + +19-Nov-2008 Joe Hunt +! Changed the default header2.inc. +$ /reporting/includes/header2.inc + +18-Nov-2008 Janusz Dobrowolski ++ System upgrade page for site admins +$ /admin/db/maintenance_db.inc + /applications/setup.php + /admin/inst_upgrade.php (new) + /sql/alter2.1.php (new) +! Added $tbpref parameter to get_user_prefs() +$ /admin/db/company_db.inc +# Next fixes to db_pager behaviour. +$ /includes/db_pager.inc + /includes/ui/db_pager_view.inc + /dimensions/inquiry/search_dimensions.php + /inventory/inquiry/stock_movements.php + /manufacturing/search_work_orders.php + /manufacturing/inquiry/where_used_inquiry.php + /purchasing/allocations/supplier_allocation_main.php + /purchasing/inquiry/po_search.php + /purchasing/inquiry/po_search_completed.php + /purchasing/inquiry/supplier_allocation_inquiry.php + /purchasing/inquiry/supplier_inquiry.php + /sales/allocations/customer_allocation_main.php + /sales/inquiry/customer_allocation_inquiry.php + /sales/inquiry/customer_inquiry.php + /sales/inquiry/sales_deliveries_view.php + /sales/inquiry/sales_orders_view.php + +16-Nov-2008 Janusz Dobrowolski +! Rewritten for paged query results. +$ /inventory/inquiry/stock_movements.php ++ Added optional footer and header in db_pager, simplified usage. +$ /includes/db_pager.inc + /includes/ui/db_pager_view.inc +! Code cleanup. +$ /dimensions/inquiry/search_dimensions.php + /manufacturing/search_work_orders.php + /manufacturing/inquiry/where_used_inquiry.php + /purchasing/inquiry/po_search.php + /purchasing/inquiry/po_search_completed.php + /purchasing/inquiry/supplier_allocation_inquiry.php + /purchasing/inquiry/supplier_inquiry.php + /sales/inquiry/customer_allocation_inquiry.php + /sales/inquiry/customer_inquiry.php + /sales/inquiry/sales_deliveries_view.php + /sales/inquiry/sales_orders_view.php + +16-Nov-2008 Joe Hunt ++ Added Attachment of Documents and a couple of links from supplier invoice/credit note +$ /admin/attachments.php (new file) + /applications/setup.php + /purchasing/supplier_credit,php + /purchasing/supplier_invoice.php + /sql/alter2.1.sql +# Minor bug in view_print_transactions.php +$ /admin/view_print_transactions.php + +15-Nov-2008 Joe Hunt ++ Added Quick Entries in GL Journal Entry and changed some needed fixes. +$ /gl/gl_bank.php + /gl/gl_journal.php + /gl/includes/db/gl_db_bank_accounts.inc + /gl/includes/ui/gl_bank_ui.inc + /gl/includes/ui/gl_journal_ui.inc + /includes/ui/ui_lists.inc + +15-Nov-2008 Joe Hunt ++ Added Tax Inquiry in Banking and General Ledger tab. +$ /applications/generalledger.php + /gl/inquiry/tax_inquiry.php (new file) + +14-Nov-2008 Joe Hunt ++ Added Sales Groups and Recurrent Invoices. +$ /applications/customers.php + /includes/ui/ui_lists.inc + /reporting/includes/reporting.inc + /reporting/rep108.php + /sales/includes/db/branches_db.inc + /sales/includes/db/sales_credit_db.inc + /sales/includes/db/sales_delivery_db.inc + /sales/includes/db/sales_invoice_db.inc + /sales/inquiry/sales_orders_view.php + /sales/manage/customer_branches.php + /sales/manage/customers.php + /sql/alter2.1.sql + /sales/create_recurrent_invoices.php (new file) + /sales/manage/recurrent_invoices.php (new file) + /sales/manage/sales_groups.php (new file) + +13-Nov-2008 Janusz Dobrowolski +! Rewritten for paged query results. +$ /dimensions/inquiry/search_dimensions.php +# Removed obsolete dimension list submit_on_change option. +$ /sales/includes/ui/sales_order_ui.inc + /sales/credit_note_entry.php + /sales/includes/ui/sales_credit_ui.inc + +12-Nov-2008 Janusz Dobrowolski +! Rewritten for paged query results. +$ /manufacturing/search_work_orders.php + /manufacturing/inquiry/where_used_inquiry.php + /purchasing/allocations/supplier_allocation_main.php + /sales/allocations/customer_allocation_main.php +! Code reorganization to reuse sql query by db_pager. + /purchasing/includes/db/supp_trans_db.inc + /purchasing/includes/db/suppalloc_db.inc + /sales/includes/db/custalloc_db.inc +! Added $echo parameter to view_stock_status() +$ /includes/ui/ui_view.inc +# Fixed sql query (duplicated rows in query result) +$ /sales/inquiry/customer_inquiry.php +# Fixed bom selection via $_GET['stock_id'] +$ /manufacturing/manage/bom_edit.php + +12-Nov-2008 Joe Hunt +! Added dimension entries in delivery and invoice forms +$ /includes/ui/ui_lists.inc + /sales/credit_note_entry.php + /sales/includes/cart_class.inc + /sales/includes/db/cust_trans_db.inc + /sales/includes/db/sales_credit_db.inc + /sales/includes/db/sales_delivery_db.inc + /sales/includes/db/sales_invoice_db.inc + /sales/includes/db/sales_order_db.inc + /sales/includes/sales_db.inc + /sales/includes/ui/sales_credit_ui.inc + /sales/includes/ui/sales_order_ui.inc + /sales/sales_order_entry.php + /sql/alter2.1.sql -03-Nov-2008 Janusz Dobrowolski -# Fixed price priority in automatic calculations. -$ sales/includes/sales_db.inc - -30-Oct-2008 Janusz Dobrowolski -# [0000080] BOM elements was not editable after entry. -$ /manufacturing/manage/bom_edit.php +12-Nov-2008 Janusz Dobrowolski +! Changed db_pager API for inserted columns. +$ /includes/db_pager.inc + /includes/ui/db_pager_view.inc +! Fixed $cols according to api change. +$ /purchasing/inquiry/supplier_inquiry.php + /sales/inquiry/customer_allocation_inquiry.php + /sales/inquiry/customer_inquiry.php + /sales/inquiry/sales_deliveries_view.php + /sales/inquiry/sales_orders_view.php +! Rewritten for paged query results. +$ /purchasing/inquiry/po_search.php + /purchasing/inquiry/po_search_completed.php + /purchasing/inquiry/supplier_allocation_inquiry.php -29-Oct-2008 Joe Hunt -# Voiding a supplier invoice/credit note with GL Postings creates a database error -$ /purchasing/includes/db/invoice_db.inc +10-Nov-2008 Janusz Dobrowolski +# Suppressed page update after import errors +$ /admin/backups.php +# More fail safe db_import() +$ /admin/db/maintenance_db.inc +# Added check for POS relations before account delete. +$ /gl/manage/bank_accounts.php +# Fixed for MySQL <4.0.18, removed bank_trans_types +$ /sql/alter2.1.sql +# Fixed page update after branch/customer change. +$ /sales/includes/ui/sales_order_ui.inc -28-Oct-2008 Joe Hunt -# [0000079] Delivery Note/Sales Invoice should not be editable after it has been voided. -$ /admin/db/voiding_db.inc - /sales/inquiry/sales_deliveries_view.php - /sales/inquiry/customer_inquiry.php +10-Nov-2008 Joe Hunt +! changing the default.css style sheets to handle the new navibar/buttons +$ /themes/default/default.css + /themes/aqua/default.css + /themes/cool/default.css + /themes/cool/images/sort_asc.gif + /themes/cool/images/sort_desc.gif -27-Oct-2008 Joe Hunt -! [0000078] Opened Exchange rate for editing (without storing) in sales/purchasing module payment -# Fixed exchange rate display bugs in Supplier Payment (earlier dates). -$ /gl/includes/db/gl_db_trans.inc +10-Nov-2008 Joe Hunt +! Changed Bank Statement Report in accourding to Bank Account Change +$ /reporting/rep601.php + /reporting/includes/reports_classes.inc +# Removed Type header from bank inquiry. + /gl/inquiry/bank_inquiry.php + +09-Nov-2008 Janusz Dobrowolski +! Allowed multiply bank accounts on one GL account, removed obsolete bank trans type. +$ /applications/generalledger.php + /gl/bank_transfer.php + /gl/gl_bank.php + /gl/includes/db/gl_db_bank_accounts.inc + /gl/includes/db/gl_db_bank_trans.inc + /gl/includes/db/gl_db_banking.inc + /gl/includes/db/gl_db_trans.inc + /gl/includes/ui/gl_bank_ui.inc + /gl/inquiry/bank_inquiry.php + /gl/manage/bank_accounts.php + /gl/view/bank_transfer_view.php + /gl/view/gl_deposit_view.php + /gl/view/gl_payment_view.php /includes/banking.inc - /includes/ui/ui_view.inc + /includes/data_checks.inc + /includes/types.inc + /includes/ui/ui_lists.inc /purchasing/supplier_payment.php - /purchasing/includes/purchasing_db.inc /purchasing/includes/db/supp_payment_db.inc /purchasing/includes/db/supp_trans_db.inc + /purchasing/view/view_supp_payment.php /sales/customer_payments.php - /sales/includes/sales_db.inc - /sales/includes/db/cust_trans_db.inc /sales/includes/db/payment_db.inc -# [0000078] Fixed some reports with wrong exchange rates. -$ /reporting/rep101.php - /reporting/rep106.php - /reporting/rep201.php - /reporting/rep203.php - /reporting/rep209.php -+ Added confirm box when admins are about to remove PO GRNs from Supplier Invoice -$ /purchasing/supplier_invoice.php + /sales/includes/db/sales_invoice_db.inc + /sales/view/view_receipt.php + /sql/alter2.1.sql +! Fixed session name for multiuser debuging tests. + /includes/lang/language.php +! Preparing to paged table view in customer_allocation_main.php +$ /sales/includes/db/cust_trans_db.inc + /sales/includes/db/custalloc_db.inc +# Small fix to avoid sql conflicts +$ /sales/includes/db/sales_points_db.inc +# Changes to POS addition related to above changes. +$ /includes/ui/ui_lists.inc + /sales/includes/db/sales_points_db.inc + /sales/manage/sales_points.php + /sql/alter2.1.sql + +09-Nov-2008 Joe Hunt +! changed Quick Entries in Bank Payments/Deposits (Banking and General Ledger) to also work as Automatic Codings. +$ /includes/ui/ui_lists.inc + /includes/ui/ui_input.inc + /gl/gl_bank.php + /gl/includes/db/gl_db_bank_accounts.inc + /gl/includes/ui/gl_bank_ui.inc + /gl/manage/gl_quick_entries.php +! New table, 0:quick_entry_lines, change to 0_quick_entries +$ /sql/alter2.1.sql -24-Oct-2008 Joe Hunt -! [0000077] Added a total before ending balance in trial balance (also in report) -$ /gl/inquiry/gl_trial_balance.php - /reporting/rep708.php -! Increased memory limit if reports in unicode (48M) as suggested in forum. +08-Nov-2008 Janusz Dobrowolski +! Rewritten for paged query results. +$ /purchasing/inquiry/supplier_inquiry.php +# Fixed broken table content after customer selector change. +$ /sales/inquiry/customer_allocation_inquiry.php + /sales/inquiry/customer_inquiry.php + /sales/inquiry/sales_deliveries_view.php + /sales/inquiry/sales_orders_view.php + +05-Nov-2008 Janusz Dobrowolski +! Changed dbpager API. +$ /includes/ui/db_pager_view.inc +# Polishing db_pager code. +$ /includes/db_pager.inc ++ Added array_replace() and array_append() helpers. +$ /includes/main.inc +# Fixed multiply sales document view links. +$ /includes/ui/ui_view.inc +! Rewritten for paged query results. +$ /sales/inquiry/customer_allocation_inquiry.php + /sales/inquiry/customer_inquiry.php + /sales/inquiry/sales_deliveries_view.php +! Code cleanup. +$ /sales/inquiry/sales_orders_view.php + +04-Nov-2008 Janusz Dobrowolski ++ Added db_pager widget for paged/sorted sql query display. +$ /includes/db_pager.inc (New) + /includes/ui/db_pager_view.inc (New) + /themes/aqua/images/sort_asc.gif (New) + /themes/aqua/images/sort_desc.gif (New) + /themes/aqua/images/sort_none.gif (New) + /themes/cool/images/sort_asc.gif (New) + /themes/cool/images/sort_desc.gif (New) + /themes/cool/images/sort_none.gif (New) + /themes/default/images/sort_asc.gif (New) + /themes/default/images/sort_desc.gif (New) + /themes/default/images/sort_none.gif (New) + /themes/default/default.css + /themes/aqua/default.css ++ Added query size user preference. +$ /admin/display_prefs.php + /admin/db/users_db.inc + /includes/current_user.inc + /includes/prefs/userprefs.inc + /sql/alter2.1.sql ++ Added helper functions for array manipulation. +$ /includes/main.inc ++ Added mysql_fetch_assoc() wrapper. +$ /includes/db/connect_db.inc +! Paged query result. +$ /sales/inquiry/sales_orders_view.php +# Two smaller fixes. +$ /js/inserts.js + +31-Oct-2008 Janusz Dobrowolski ++ POS and cash sale support. +$ /admin/users.php + /admin/db/users_db.inc + /applications/setup.php + /includes/current_user.inc + /includes/ui/ui_lists.inc + /sales/sales_order_entry.php + /sales/includes/cart_class.inc + /sales/includes/sales_db.inc + /sales/includes/ui/sales_order_ui.inc + /sales/manage/sales_points.php (New) + /sales/includes/db/sales_points_db.inc (New) + /sales/includes/cart_class.inc + /sales/includes/db/sales_invoice_db.inc + /sales/includes/db/sales_order_db.inc + /sql/alter2.1.sql +# Fixed focus after error display. +$ /js/utils.js +# Fixed buggy output when SetLineWidth is used before first AddPage call. +$ /reporting/includes/tcpdf.php +# Fixed sign in payment view. +$ /sales/view/view_receipt.php +# Fixed missing hotkeys support for print links. +$ /reporting/includes/reporting.inc + +30-Oct-2008 Joe Hunt +! Added Quick Entries in Bank Payments/Deposits (Banking and General Ledger). +$ /applications/generalledger.php + /includes/data_checks.inc + /includes/types.inc + /includes/ui/ui_lists.inc + /gl/gl_bank.php + /gl/includes/db/gl_db_bank_accounts.inc + /gl/includes/ui/gl_bank_ui.inc + /gl/manage/gl_quick_entries.php + /sales/manage/customer_branches.php +! New table, 0_quick_entries +$ /sql/alter2.1.sql +! Changed GL Accounts form. The tax_code is now Tax Group instead of Tax Type. +$ /gl/manage/gl_accounts.php + +24-Oct-2008 Janusz Dobrowolski +! Added hotkeys to final menu options. +$ /dimensions/dimension_entry.php + /gl/bank_transfer.php + /gl/gl_bank.php + /gl/gl_journal.php + /inventory/adjustments.php + /inventory/transfers.php + /manufacturing/work_order_add_finished.php + /manufacturing/work_order_issue.php + /manufacturing/work_order_release.php + /purchasing/po_entry_items.php + /purchasing/po_receive_items.php + /purchasing/supplier_payment.php + /sales/credit_note_entry.php + /sales/customer_credit_invoice.php + /sales/customer_invoice.php + /sales/customer_payments.php + /sales/sales_order_entry.php +# Fixed TCPDF errors display. +$ /reporting/includes/tcpdf.php +# Fixed page position after message display. +$ /js/utils.js + +23-Oct-2008 Janusz Dobrowolski ++ Improved report module performance, also usable without javascript. +$ /reporting/reports_main.php /reporting/includes/class.pdf.inc -! Improved layout of Supplier Invoice/Credit. All Items can now be added in one sweep. -$ /purchasing/supplier_invoice.php - /purchasing/supplier_credit.php - /purchasing/includes/ui/invoice_ui.inc - -------------------------------- Release 2.0.4 -------------------------------------------- + /reporting/includes/pdf_report.inc + /reporting/includes/reports_classes.inc + /reporting/includes/header2.inc ++ Hotkey support for viewer links. +$ /includes/ui/ui_view.inc + /js/inserts.js ++ Added purchase order printing after entry. +$ /purchasing/po_entry_items.php ++ Added hotkeys to credit note final menu. +$ /sales/credit_note_entry.php +# Fixed submit button for IE7 +$ /includes/ui/ui_input.inc +# Fixed ajax popup flicker. +$ /js/utils.js +# Fix after 2.0.4 merge +$ /sales/inquiry/sales_orders_view.php + 23-Oct-2008 Joe Hunt -! Release 2.0.4 -$ config.php -! Changed design of Supplier Invoice/Credit. Everything is now done in one document form. +! Merging the changes up to 2-0-4 $ /purchasing/supplier_invoice.php /purchasing/supplier_credit.php + /purchasing/includes/db/invoice_db.inc + /purchasing/includes/db/grn_db.inc /purchasing/includes/ui/invoice_ui.inc /purchasing/supplier_invoice_grns.php (File removed) /purchasing/supplier_credit_grns.php (File removed) /purchasing/supplier_trans_gl.php (File removed) - -22-Oct-2008 Joe Hunt -+ Added Ending Balance in trial balance (also in report) -$ /gl/inquiry/gl_trial_balance.php + /gl/inquiry/gl_trial_balance.php + /gl/inquiry/gl_account_inquiry.php /reporting/rep704.php /reporting/rep708.php -! Bad balance in GL trans for chart en_US-demo.sql -$ /sql/en_US-demo.sql + /sql/en_US-demo.sql + /sales/includes/ui/sales_order_ui.inc + /sales/inquiry/sales_orders_view.php -21-Oct-2008 Joe Hunt -# Bug [0000076] Voiding Supplier Invoice does a purchase delivery void as well -$ /purchasing/includes/db/invoice_db.inc +20-Oct-2008 Janusz Dobrowolski +# Fix for pdf reports (php 5.2.4 issue) +$ /reporting/includes/pdf_report.inc -18-Oct-2008 Joe Hunt -# Bug [0000075] Cost Update problems still (voiding supplier invoice). Can't remove GRNs from - Yet to be invoiced (supplier invoice). Can now be done with admin access. -$ /purchasing/supplier_invoice_grns.php - /purchasing/includes/db/grn_db.inc - /purchasing/includes/db/invoice_db.inc - -15-Oct-2008 Joe Hunt -# Bug [0000074] Marked items are overdue. For Filled (fully delivered) Sales Order -$ /sales/inquiry/sales_orders_view.php +19-Oct-2008 Janusz Dobrowolski ++ User interface mode (full vs fallback) detected and set on login +$ /access/login.php + /includes/current_user.inc + /includes/session.inc + /includes/ui/ui_input.inc + /includes/ui/ui_lists.inc ++ More sales documents available for printing from inquiry page. +$ /sales/inquiry/customer_inquiry.php + /reporting/includes/header2.inc +! Changed version info. +$ /config.php +# Fixed ajax popup/redirection. +$ /reporting/includes/pdf_report.inc + /includes/ajax.inc -08-Oct-2008 Janusz Dobrowolski -# [0000071] Ordering from customer on hold was possible after double exact search in list. -$ /sales/includes/ui/sales_order_ui.inc +17-Oct-2008 Janusz Dobrowolski ++ Added ajax request indicator. +$ /js/utils.js + /themes/aqua/renderer.php + /themes/aqua/images/ajax-loader.gif (new) + /themes/cool/renderer.php + /themes/cool/images/ajax-loader.gif (new) + /themes/default/renderer.php + /themes/default/images/ajax-loader.gif (new) ++ Added optional popup for pdf reports display. +$ /admin/display_prefs.php + /admin/users.php + /admin/db/users_db.inc + /includes/current_user.inc + /includes/prefs/userprefs.inc + /reporting/includes/pdf_report.inc + /sql/alter2.1.sql +# Changed message for missing currency rate. +$ /includes/banking.inc +# Fixed submit/button behaviour. +$ /js/inserts.js +# Fixed canceling order. +$ /sales/sales_order_entry.php +# Fixed typo in css +$ /themes/aqua/default.css +# Fixed pdf_debug mode +$ /reporting/includes/reporting.inc + /reporting/includes/reports_classes.inc + +15-Oct-2008 Janusz Dobrowolski ++ Added remote printing support +$ /admin/print_profiles.php (new) + /admin/printers.php (new) + /admin/db/printers_db.inc (new) + /reporting/prn_redirect.php (new) + /reporting/includes/printer_class.inc (new) + /sql/alter2.1.sql (new) + /config.php + /admin/display_prefs.php + /admin/users.php + /admin/db/users_db.inc + /applications/setup.php + /includes/current_user.inc + /includes/prefs/userprefs.inc + /includes/ui/ui_lists.inc + /js/inserts.js + /js/utils.js + /reporting/rep109.php + /reporting/reports_main.php + /reporting/includes/pdf_report.inc + /reporting/includes/reporting.inc + /reporting/includes/reports_classes.inc +!Fixes related to changed printing api. +$ /admin/view_print_transaction.php + /purchasing/inquiry/po_search.php + /purchasing/inquiry/po_search_completed.php + /sales/customer_credit_invoice.php + /sales/customer_delivery.php + /sales/customer_invoice.php + /sales/sales_order_entry.php + /sales/inquiry/customer_inquiry.php + /sales/inquiry/sales_deliveries_view.php + /sales/inquiry/sales_orders_view.php ++ Added optional id parameter for label helpers; added value for buttons. +$ /includes/ui/ui_input.inc ++ Added ajax popup screen command. +$ /includes/ajax.inc +# Skipping index.php file during flush_dir() +$ /includes/main.inc + +06-Oct-2008 Janusz Dobrowolski ++ Menu hotkeys system implementation. +$ /includes/page/header.inc + /includes/ui/ui_controls.inc + /includes/ui/ui_input.inc + /js/JsHttpRequest.js + /js/inserts.js + /js/utils.js + /reporting/includes/reports_classes.inc + /sales/sales_order_entry.php + /sales/manage/customers.php + /themes/aqua/default.css + /themes/aqua/renderer.php + /themes/cool/default.css + /themes/cool/renderer.php + /themes/default/default.css + /themes/default/renderer.php ++ Access keys added to menu options strings. +$ /config.php + /applications/customers.php + /applications/dimensions.php + /applications/generalledger.php + /applications/inventory.php + /applications/manufacturing.php + /applications/setup.php + /applications/suppliers.php + /reporting/reports_main.php ------------------------------- Release 2.0.3 -------------------------------------------- -07-Oct-2008 Joe Hunt +06-Oct-2008 Joe Hunt ! Release 2.0.3 $ config.php # Bug [0000072] Item stock movement should check for if there is empty Inventory. diff --git a/access/login.php b/access/login.php index 0b961a97..295fd537 100644 --- a/access/login.php +++ b/access/login.php @@ -1,16 +1,26 @@ . +***********************************************************************/ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_to_root'])) - die("Restricted access"); + die(_("Restricted access")); include_once($path_to_root . "/includes/ui/ui_view.inc"); + // Display demo user name and password within login form if "$allow_demo_mode" is true - $demo_text = ""; - if ($allow_demo_mode == True) + if ($allow_demo_mode == true) { - $demo_text = "Login as user: demouser and password: cooldemo"; + $demo_text = _("Login as user: demouser and password: password"); } else { - $demo_text = "Please login here"; + $demo_text = _("Please login here"); } if (!isset($def_coy)) $def_coy = 0; @@ -23,10 +33,11 @@ function defaultCompany() { document.forms[0].company_login_name.options[].selected = true; + document.getElementById('ui_mode').value = 1; } <?php echo $app_title . " " . $version;?> - + @@ -45,6 +56,7 @@ function defaultCompany() + @@ -66,12 +78,12 @@ function defaultCompany() - - +
User name:
-
- Password:
- +
:
+ "/>
+ :
+ ">
- Company:
+ :
");?> " name="SubmitUser" />
diff --git a/access/logout.php b/access/logout.php index a52b4249..716bbfe1 100644 --- a/access/logout.php +++ b/access/logout.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 1; $path_to_root=".."; include($path_to_root . "/includes/session.inc"); diff --git a/admin/backups.php b/admin/backups.php index 9796a492..f1353193 100644 --- a/admin/backups.php +++ b/admin/backups.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 15; $path_to_root=".."; @@ -18,7 +27,7 @@ if ($valid_paths != "") } $db_name = $_SESSION["wa_current_user"]->company; -$msg = handle_form($db_connections[$db_name]); +handle_form($db_connections[$db_name]); page(_("Backup and Restore Database"), false, false, '', '', true); @@ -31,11 +40,13 @@ $compr = get_compr_combo(); echo "
- @@ -109,92 +120,75 @@ end_page(); function handle_form($conn) { - global $path_to_root; - //Generate Only - if (isset($_GET['c'])) +if(isset($_GET['c'])) + switch($_GET['c']) { - if ($_GET['c']=='g') - { + case 'g': //Generate Only $filename = generate_backup($conn, $_GET['comp'], $_GET['comm']); header("Location: backups.php?c=gs&fn=" . urlencode($filename)); - return ""; - } - //Generate and download - if ($_GET['c']=='gd') - { + break; + + case 'gd': //Generate and download $filename = generate_backup($conn); header("Location: backups.php?c=ds&fn=" . urlencode($filename)); - return ""; - } - //Download the file - if ($_GET['c']=='d') - { + break; + + case 'd': //Download the file download_file(BACKUP_PATH . $_GET['fn']); exit; - } - //Delete the file - if ($_GET['c']=='df') - { + + case 'df': //Delete the file $filename = $_GET['fn']; @unlink(BACKUP_PATH . $filename); header("Location: backups.php?c=dff&fn=" . urlencode($filename)); - return ""; - } - if ($_GET['c']=='dff') - { - $msg = _("File successfully deleted.")."   "; + break; + + case 'dff': + $msg = _("File successfully deleted.")." "; $msg .= _("Filename") . " = " . $_GET['fn']; - return $msg; - } - //Write JS script to open download window - if ($_GET['c']=='ds') - { + display_notification($msg); + break; + + case 'ds': //Write JS script to open download window $filename = urlencode($_GET['fn']); - $msg = _("Backup is being downloaded..."); - $msg .= ""; - return $msg; - } - //Print backup success message - if ($_GET['c']=='gs') - { - $msg = _("Backup successfully generated.")."   "; + display_notification(_("Backup is being downloaded...")); + + add_js_source(""); + break; + + case 'gs': //Print backup success message + $msg = _("Backup successfully generated."). ' '; $msg .= _("Filename") . " = " . $_GET['fn']; - return $msg; - } - //Restore backup - if ($_GET['c']=='r') - { + display_notification($msg); + break; + + case 'r': //Restore backup $filename=$_GET['fn']; - restore_backup(BACKUP_PATH . $filename, $conn); - header("Location: backups.php?c=rs&fn=" . urlencode($filename)); - return ""; - } - //Print restore success message - if ($_GET['c']=='rs') - { - $msg = _("Restore backup completed.")."   "; - return $msg; - } + if( restore_backup(BACKUP_PATH . $filename, $conn) ) + header("Location: backups.php?c=rs&fn=" . urlencode($filename)); + break; - if ($_GET['c']=='u') - { + case 'rs': //Print restore success message + display_notification(_("Restore backup completed.")); + break; + + case 'u': $filename = $_FILES['uploadfile']['tmp_name']; if (is_uploaded_file ($filename)) { - restore_backup($filename, $conn); - $msg = _("Uploaded file has been restored."); + if( restore_backup($filename, $conn) ) + display_notification(_("Uploaded file has been restored.")); + else + display_error(_("Database restore failed.")); } else { - $msg = _("Backup was not uploaded into the system."); + display_error(_("Backup was not uploaded into the system.")); } - return $msg; } - } - return ""; } function generate_backup($conn, $ext='no', $comm='') @@ -253,7 +247,7 @@ function download_file($filename) { if (empty($filename) || !file_exists($filename)) { - return FALSE; + return false; } $saveasname = basename($filename); header('Content-type: application/octet-stream'); diff --git a/admin/change_current_user_password.php b/admin/change_current_user_password.php index 1f739243..d38f96cd 100644 --- a/admin/change_current_user_password.php +++ b/admin/change_current_user_password.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security=1; $path_to_root=".."; include_once($path_to_root . "/includes/session.inc"); @@ -46,8 +55,12 @@ if (isset($_POST['UPDATE_ITEM'])) if (can_process()) { - update_user_password($_POST['user_id'], md5($_POST['password'])); - display_notification(_("Your password has been updated.")); + if ($allow_demo_mode) { + display_warning(_("Password cannot be changed in demo mode.")); + } else { + update_user_password($_POST['user_id'], md5($_POST['password'])); + display_notification(_("Your password has been updated.")); + } $Ajax->activate('_page_body'); } } diff --git a/admin/company_preferences.php b/admin/company_preferences.php index 6804b549..d020398a 100644 --- a/admin/company_preferences.php +++ b/admin/company_preferences.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security =10; $path_to_root=".."; include($path_to_root . "/includes/session.inc"); @@ -37,17 +46,17 @@ if (isset($_POST['update']) && $_POST['update'] != "") //But check for the worst if (strtoupper(substr(trim($_FILES['pic']['name']), strlen($_FILES['pic']['name']) - 3)) != 'JPG') { - display_notification(_('Only jpg files are supported - a file extension of .jpg is expected')); + display_error(_('Only jpg files are supported - a file extension of .jpg is expected')); $input_error = 1; } elseif ( $_FILES['pic']['size'] > ($max_image_size * 1024)) { //File Size Check - display_notification(_('The file size is over the maximum allowed. The maximum size allowed in KB is') . ' ' . $max_image_size); + display_error(_('The file size is over the maximum allowed. The maximum size allowed in KB is') . ' ' . $max_image_size); $input_error = 1; } elseif ( $_FILES['pic']['type'] == "text/plain" ) { //File type Check - display_notification( _('Only graphics files can be uploaded')); + display_error( _('Only graphics files can be uploaded')); $input_error = 1; } elseif (file_exists($filename)) @@ -68,6 +77,22 @@ if (isset($_POST['update']) && $_POST['update'] != "") display_error(_('Error uploading logo file')); } } + if (check_value('del_coy_logo')) + { + $user_comp = user_company(); + $filename = $comp_path . "/$user_comp/images/".$_POST['coy_logo']; + if (file_exists($filename)) + { + $result = unlink($filename); + if (!$result) + { + display_error(_('The existing image could not be removed')); + $input_error = 1; + } + else + $_POST['coy_logo'] = ""; + } + } if ($input_error != 1) { update_company_setup($_POST['coy_name'], $_POST['coy_no'], $_POST['gst_no'], $_POST['tax_prd'], $_POST['tax_last'], @@ -114,27 +139,33 @@ $_POST['custom2_value'] = $myrow["custom2_value"]; $_POST['custom3_value'] = $myrow["custom3_value"]; $_POST['curr_default'] = $myrow["curr_default"]; $_POST['f_year'] = $myrow["f_year"]; +$_POST['del_coy_logo'] = 0; + +start_outer_table($table_style2); -start_table($table_style2); +table_section(1); text_row_ex(_("Name (to appear on reports):"), 'coy_name', 42, 50); +textarea_row(_("Address:"), 'postal_address', $_POST['postal_address'], 35, 5); + +text_row_ex(_("Phone Number:"), 'phone', 25, 55); +text_row_ex(_("Fax Number:"), 'fax', 25); +email_row_ex(_("Email Address:"), 'email', 25, 55); + text_row_ex(_("Official Company Number:"), 'coy_no', 25); -text_row_ex(_("Tax Authority Reference:"), 'gst_no', 25); +text_row_ex(_("GSTNo:"), 'gst_no', 25); text_row_ex(_("Tax Periods:"), 'tax_prd', 10, 10, '', null, null, _('Months.')); text_row_ex(_("Tax Last Period:"), 'tax_last', 10, 10, '', null, null, _('Months back.')); currencies_list_row(_("Home Currency:"), 'curr_default', $_POST['curr_default']); -fiscalyears_list_row(_("Fiscal Year:"), 'f_year', $_POST['f_year']); -textarea_row(_("Address:"), 'postal_address', $_POST['postal_address'], 35, 5); +table_section(2); -text_row_ex(_("Telephone Number:"), 'phone', 25, 55); -text_row_ex(_("Facsimile Number:"), 'fax', 25); -text_row_ex(_("Email Address:"), 'email', 25, 55); +fiscalyears_list_row(_("Fiscal Year:"), 'f_year', $_POST['f_year']); label_row(_("Company Logo:"), $_POST['coy_logo']); label_row(_("New Company Logo (.jpg)") . ":", ""); - +check_row(_("Delete Company Logo:"), 'del_coy_logo', $_POST['del_coy_logo']); text_row_ex(_("Domicile:"), 'domicile', 25, 55); number_list_row(_("Use Dimensions:"), 'use_dimension', null, 0, 2); @@ -164,7 +195,8 @@ text_cells(null, 'custom3_name', $_POST['custom3_name'], 25, 25); text_cells(null, 'custom3_value', $_POST['custom3_value'], 30, 30); end_row(); -end_table(1); +end_outer_table(1); + hidden('coy_logo', $_POST['coy_logo']); submit_center('update', _("Update"), true, '', true); diff --git a/admin/create_coy.php b/admin/create_coy.php index 50dcca0f..8ec0fc4a 100644 --- a/admin/create_coy.php +++ b/admin/create_coy.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 20; $path_to_root=".."; include_once($path_to_root . "/includes/session.inc"); @@ -11,7 +20,7 @@ include_once($path_to_root . "/includes/ui.inc"); page(_("Create/Update Company")); -$comp_subdirs = array('images', 'pdf_files', 'backup','js_cache', 'reporting'); +$comp_subdirs = array('images', 'pdf_files', 'backup','js_cache', 'reporting', 'attachments'); //--------------------------------------------------------------------------------------------- if (isset($_GET['selected_id'])) @@ -227,9 +236,16 @@ function display_companies() label_cell($conn[$i]['dbname']); label_cell($conn[$i]['tbpref']); label_cell($what); - label_cell("" . _("Edit") . ""); + $edit = _("Edit"); + $delete = _("Delete"); + if (user_graphic_links()) + { + $edit = set_icon(ICON_EDIT, $edit); + $delete = set_icon(ICON_DELETE, $delete); + } + label_cell("$edit"); label_cell( $i == $coyno ? '' : - "" . _("Delete") . ""); + "$delete"); end_row(); } diff --git a/admin/db/company_db.inc b/admin/db/company_db.inc index 8a832211..672d9545 100644 --- a/admin/db/company_db.inc +++ b/admin/db/company_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ function update_company_gl_setup($debtors_act, $pyt_discount_act, $creditors_act, $freight_act, @@ -15,6 +24,8 @@ function update_company_gl_setup($debtors_act, $pyt_discount_act, $creditors_act $allow_negative_stock, $po_over_receive, $po_over_charge, + $accumulate_shipping, + $legal_text, $past_due_days, $default_credit_limit, $default_workorder_required, @@ -36,6 +47,8 @@ function update_company_gl_setup($debtors_act, $pyt_discount_act, $creditors_act allow_negative_stock=$allow_negative_stock, po_over_receive=$po_over_receive, po_over_charge=$po_over_charge, + accumulate_shipping=$accumulate_shipping, + legal_text=".db_escape($legal_text).", past_due_days=$past_due_days, default_credit_limit=$default_credit_limit, default_workorder_required=$default_workorder_required, @@ -80,9 +93,10 @@ function update_company_setup($coy_name, $coy_no, $gst_no, $tax_prd, $tax_last, db_query($sql, "The company setup could not be updated "); } -function get_company_prefs() +function get_company_prefs($tbpref = TB_PREF) { - $sql = "SELECT * FROM ".TB_PREF."company WHERE coy_code=1"; + $sql = "SELECT * FROM ".$tbpref."company WHERE coy_code=1"; + $result = db_query($sql, "The company preferences could not be retrieved"); if (db_num_rows($result) == 0) @@ -91,9 +105,9 @@ function get_company_prefs() return db_fetch($result); } -function get_company_pref($pref_name) +function get_company_pref($pref_name, $tbpref = TB_PREF) { - $prefs = get_company_prefs(); + $prefs = get_company_prefs($tbpref); return $prefs[$pref_name]; } diff --git a/admin/db/maintenance_db.inc b/admin/db/maintenance_db.inc index 21236b62..44ba4bb9 100644 --- a/admin/db/maintenance_db.inc +++ b/admin/db/maintenance_db.inc @@ -1,4 +1,14 @@ . +***********************************************************************/ function write_config_db($new = false) { @@ -82,6 +92,7 @@ function db_create_db($connection) function db_drop_db($connection) { + if ($connection["tbpref"] == "") { $sql = "DROP DATABASE " . $connection["dbname"] . ""; @@ -104,13 +115,31 @@ function db_drop_db($connection) } } -function db_import($filename, $connection) +function db_import($filename, $connection, $force=true) { + global $db; + $allowed_commands = array( + "create" => 'table_queries', + "alter table" => 'table_queries', + "insert" => 'data_queries', + "update" => 'data_queries', + "drop table if exists" => 'drop_queries'); + $ignored_mysql_errors = array( //errors ignored in normal (non forced) mode + '1022', // duplicate key + '1050', // Table %s already exists + '1060', // duplicate column name + '1061', // duplicate key name + '1062', // duplicate key entry + '1091' // can't drop key/column check if exists + ); $data_queries = array(); $drop_queries = array(); $table_queries = array(); + $sql_errors = array(); ini_set("max_execution_time", "180"); + db_query("SET foreign_key_checks=0"); + // uncrompress gziped backup files if (strpos($filename, ".gzip") || strpos($filename, ".GZIP")) $lines = db_ungzip("lines", $filename); @@ -119,74 +148,57 @@ function db_import($filename, $connection) else $lines = file("". $filename); - // divide insert and create sql queries - // $table is set to TRUE if the next line belongs to a create sql query - $table = false; - foreach($lines as $line) + // parse input file + $query_table = ''; + foreach($lines as $line_no => $line) { $line = trim($line); - + $line = str_replace("0_", $connection["tbpref"], $line); - // $line = str_replace("Y_", "0_", $line); - // the last line did not belong to a 'create' sql query - if (!$table) - { - - // this line does not, too - if (strtolower(substr($line,0,6)) == "insert") - { - $data_queries[] = substr($line, 0, strlen($line) - 1); - - // this line does not, too - } - elseif (strtolower(substr($line,0,6)) == "update") - { - $data_queries[] = substr($line, 0, strlen($line) - 1); - - // this line does not, too - } - elseif (strtolower(substr($line, 0, 20)) == "drop table if exists") - { - $drop_queries[] = substr($line, 0, strlen($line) - 1); - // this line does! - } - elseif (strtolower(substr($line, 0, 6)) == "create") + if ($query_table == '') + { // check if line begins with one of allowed queries + foreach($allowed_commands as $cmd => $table) { - $table = true; - $table_queries[] = $line . "\n"; - } - elseif (strtolower(substr($line, 0, 11)) == "alter table") + if (strtolower(substr($line, 0, strlen($cmd))) == $cmd) + { + $query_table = $table; + ${$query_table}[] = array('', $line_no+1); + break; + } + } + } + if($query_table != '') // inside allowed query + { + $table = $query_table; + if (substr($line, -1) == ';') // end of query found { - $data_queries[] = substr($line, 0, strlen($line) - 1); + $line = substr($line, 0, strlen($line) - 1); // strip ';' + $query_table = ''; } - - // the current line belongs to a create sql query - } - else - { - - // create sql query ending in this line - if (strtolower(substr($line, 0, 1)) == ")") { - $table = false; - $line = substr($line,0,strlen($line)-1); - } - $table_queries[count($table_queries) - 1] .= $line . "\n"; + ${$table}[count(${$table}) - 1][0] .= $line . "\n"; } + } - - $sql_error = false; - +/* + { // for debugging purposes + global $path_to_root; + $f = fopen($path_to_root.'/tmp/dbimport.txt', 'w+'); + fwrite($f, print_r($drop_queries,true) ."\n"); + fwrite($f, print_r($table_queries,true) ."\n"); + fwrite($f, print_r($data_queries,true)); + fclose($f); + } +*/ // execute drop tables if exists queries - if (is_array($drop_queries)) + if ($force && is_array($drop_queries)) { foreach($drop_queries as $drop_query) { - $sql_error = false; - if (!db_query($drop_query)) + if (!db_query($drop_query[0])) { - $sql_error = true; - //if ($CONF['import_error']) echo nl2br($drop_query)."\n
".mysql_error()."

\n"; + if (!in_array(db_error_no(), $ignored_mysql_errors)) + $sql_errors[] = array(db_error_msg($db), $drop_query[1]); } } } @@ -196,11 +208,11 @@ function db_import($filename, $connection) { foreach($table_queries as $table_query) { - $sql_error = false; - if (!db_query($table_query)) - { - $sql_error = true; - //if ($CONF['import_error']) echo nl2br($table_query)."\n
".mysql_error()."

\n"; + if (!db_query($table_query[0])) + { + if (!in_array(db_error_no(), $ignored_mysql_errors) || !$force) { + $sql_errors[] = array(db_error_msg($db), $table_query[1]); + } } } } @@ -210,23 +222,24 @@ function db_import($filename, $connection) { foreach($data_queries as $data_query) { - $sql_error = false; - if (!db_query($data_query)) + if (!db_query($data_query[0])) { - //if ($CONF['import_error']) echo $data_query."\n
".mysql_error()."

\n"; - $sql_error = true; - return false; + if (!in_array(db_error_no(),$ignored_mysql_errors) || !$force) + $sql_errors[] = array(db_error_msg($db), $data_query[1]); } } } - - // show number successful executed querys or if an error did occur - if ($sql_error == 1) + + db_query("SET foreign_key_checks=1"); + + if (count($sql_errors)) { + // display first failure message; the rest are probably derivative + $err = $sql_errors[0]; + display_error(sprintf(_("SQL script execution failed in line %d: %s"), + $err[1], $err[0])); return false; - //echo "
".IM_ERROR.".
\n"; - else + } else return true; - //echo "
".IM_SUCCESS." ".count($table_queries)." ".IM_TABLES." ".count($data_queries)." ".IM_ROWS." (".$import_file.")
\n"; //$shell_command = C_MYSQL_PATH . " -h $host -u $user -p{$password} $dbname < $filename"; //shell_exec($shell_command); } @@ -288,13 +301,12 @@ function db_unzip($mode, $path) // generates a dump of $db database // $drop and $zip tell if to include the drop table statement or dry to pack -function db_export($conn, $filename, $zip='no', $comment='') +function db_export($conn, $filename, $zip='no', $comment='', $tbpref = TB_PREF) { global $app_title, $version, $power_url, $path_to_root; $error = false; - // set max string size before writing to file $max_size = 1048576 * 2; // 2 MB // changes max size if value can be retrieved @@ -308,7 +320,8 @@ function db_export($conn, $filename, $zip='no', $comment='') $backupfile = $filename . ".zip"; else $backupfile = $filename; - $company = get_company_pref('coy_name'); + $company = get_company_pref('coy_name', $tbpref); + //create comment $out="# MySQL dump of database '".$conn["dbname"]."' on host '".$conn["host"]."'\n"; $out.="# Backup Date and Time: ".date("Y-m-d H:i")."\n"; diff --git a/admin/db/users_db.inc b/admin/db/users_db.inc index 6e1be6fe..5200f2c9 100644 --- a/admin/db/users_db.inc +++ b/admin/db/users_db.inc @@ -1,11 +1,24 @@ . +***********************************************************************/ + +function add_user($user_id, $real_name, $password, $phone, $email, $full_access, + $language, $profile, $rep_popup, $pos) { - $sql = "INSERT INTO ".TB_PREF."users (user_id, real_name, password, phone, email, full_access, language) + $sql = "INSERT INTO ".TB_PREF."users (user_id, real_name, password" + .", phone, email, full_access, language, pos, print_profile, rep_popup) VALUES (".db_escape($user_id).", ".db_escape($real_name).", ".db_escape($password) .",".db_escape($phone).", - ".db_escape($email).", $full_access, ".db_escape($language).")"; + ".db_escape($email).", $full_access, ".db_escape($language).", + $pos,".db_escape($profile).",$rep_popup)"; db_query($sql, "could not add user for $user_id"); } @@ -22,22 +35,27 @@ function update_user_password($user_id, $password) //----------------------------------------------------------------------------------------------- -function update_user($user_id, $real_name, $phone, $email, $full_access, $language) +function update_user($user_id, $real_name, $phone, $email, $full_access, + $language, $profile, $rep_popup, $pos) { $sql = "UPDATE ".TB_PREF."users SET real_name=".db_escape($real_name). ", phone=".db_escape($phone).", email=".db_escape($email).", full_access=$full_access, - language=".db_escape($language)." + language=".db_escape($language).", + print_profile=".db_escape($profile).", + rep_popup=$rep_popup, + pos=$pos WHERE user_id = ".db_escape($user_id); - db_query($sql, "could not update user for $user_id"); } //----------------------------------------------------------------------------------------------- -function update_user_display_prefs($user_id, $price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, - $showcodes, $date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize, $show_hints) +function update_user_display_prefs($user_id, $price_dec, $qty_dec, $exrate_dec, + $percent_dec, $showgl, $showcodes, $date_format, $date_sep, $tho_sep, + $dec_sep, $theme, $pagesize, $show_hints, $profile, $rep_popup, $query_size, + $graphic_links, $lang) { $sql = "UPDATE ".TB_PREF."users SET prices_dec=".db_escape($price_dec).", @@ -52,7 +70,12 @@ function update_user_display_prefs($user_id, $price_dec, $qty_dec, $exrate_dec, dec_sep=".db_escape($dec_sep).", theme=".db_escape($theme).", page_size=".db_escape($pagesize).", - show_hints=$show_hints + show_hints=$show_hints, + print_profile=".db_escape($profile).", + rep_popup=$rep_popup, + query_size=$query_size, + graphic_links=$graphic_links, + language=".db_escape($lang)." WHERE user_id = ".db_escape($user_id); db_query($sql, "could not update user display prefs for $user_id"); diff --git a/admin/db/v_banktrans.inc b/admin/db/v_banktrans.inc index 9b254e83..0cdd5a20 100644 --- a/admin/db/v_banktrans.inc +++ b/admin/db/v_banktrans.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ include_once($path_to_root . "/gl/includes/gl_db.inc"); function validate_bank_trans() diff --git a/admin/db/voiding_db.inc b/admin/db/voiding_db.inc index 692080e0..fafac430 100644 --- a/admin/db/voiding_db.inc +++ b/admin/db/voiding_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ include_once($path_to_root . "/sales/includes/sales_db.inc"); include_once($path_to_root . "/purchasing/includes/purchasing_db.inc"); include_once($path_to_root . "/inventory/includes/inventory_db.inc"); @@ -16,9 +25,7 @@ function void_transaction($type, $type_no, $date_, $memo_) case 0 : // it's a journal entry if (!exists_gl_trans($type, $type_no)) return false; - void_gl_trans($type, $type_no); - if (exists_bank_trans($type, $type_no)) - void_bank_trans($type, $type_no); + void_journal_trans($type, $type_no); break; case 1 : // it's a payment diff --git a/admin/display_prefs.php b/admin/display_prefs.php index 2b4faf52..316733a7 100644 --- a/admin/display_prefs.php +++ b/admin/display_prefs.php @@ -1,6 +1,15 @@ . +***********************************************************************/ +$page_security = 1; $path_to_root=".."; include($path_to_root . "/includes/session.inc"); @@ -15,28 +24,44 @@ include_once($path_to_root . "/admin/db/company_db.inc"); if (isset($_POST['setprefs'])) { - $theme = user_theme(); - set_user_prefs($_POST['prices'], $_POST['Quantities'], - $_POST['Rates'], $_POST['Percent'], - check_value('show_gl'), - check_value('show_codes'), - $_POST['date_format'], $_POST['date_sep'], - $_POST['tho_sep'], $_POST['dec_sep'], - $_POST['theme'], $_POST['page_size'], check_value('show_hints')); - - language::set_language($_POST['language']); - - flush_dir($comp_path.'/'.user_company().'/js_cache'); - - if (user_theme() != $theme) - reload_page(""); - - display_notification_centered(_("Display settings have been updated.")); + if (!is_numeric($_POST['query_size']) || ($_POST['query_size']<1)) + { + display_error($_POST['query_size']); + display_error( _("Query size must be integer and greater than zero.")); + set_focus('query_size'); + } else { + $chg_theme = user_theme() != $_POST['theme']; + $chg_lang = $_SESSION['language']->code != $_POST['language']; + + set_user_prefs($_POST['prices'], $_POST['Quantities'], + $_POST['Rates'], $_POST['Percent'], + check_value('show_gl'), + check_value('show_codes'), + $_POST['date_format'], $_POST['date_sep'], + $_POST['tho_sep'], $_POST['dec_sep'], + $_POST['theme'], $_POST['page_size'], check_value('show_hints'), + $_POST['profile'], check_value('rep_popup'), + (int)($_POST['query_size']), check_value('graphic_links'), + $_POST['language']); + + if ($chg_lang) + language::set_language($_POST['language']); + // refresh main menu + + flush_dir($comp_path.'/'.user_company().'/js_cache'); + + if ($chg_theme || $chg_lang) + meta_forward($_SERVER['PHP_SELF']); + + display_notification_centered(_("Display settings have been updated.")); + } } start_form(); -start_table($table_style2); +start_outer_table($table_style2); + +table_section(1); table_section_title(_("Decimal Places")); text_row_ex(_("Prices/Amounts:"), 'prices', 5, 5, '', user_price_dec()); @@ -62,7 +87,14 @@ decseps_list_row(_("Decimal Separator:"), "dec_sep", user_dec_sep()); /* The array $decseps is set up in config.php for modifications possible separators can be added by modifying the array definition by editing that file */ +if (!isset($_POST['language'])) + $_POST['language'] = $_SESSION['language']->code; + +table_section_title(_("Language")); + +languages_list_row(_("Language:"), 'language', $_POST['language']); +table_section(2); table_section_title(_("Miscellaneous")); check_row(_("Show hints for new users:"), 'show_hints', user_hints()); @@ -81,16 +113,23 @@ pagesizes_list_row(_("Page Size:"), "page_size", user_pagesize()); /* The array $pagesizes is set up in config.php for modifications possible separators can be added by modifying the array definition by editing that file */ -table_section_title(_("Language")); +if (!isset($_POST['profile'])) + $_POST['profile'] = user_print_profile(); -if (!isset($_POST['language'])) - $_POST['language'] = $_SESSION['language']->code; +print_profiles_list_row(_("Printing profile"). ':', 'profile', + null, _('Browser printing support')); -languages_list_row(_("Language:"), 'language', $_POST['language']); +check_row(_("Use popup window to display reports:"), 'rep_popup', user_rep_popup(), + false, _('Set this option to on if your browser directly supports pdf files')); + +check_row(_("Use icons instead of text links:"), 'graphic_links', user_graphic_links(), + false, _('Set this option to on for using icons instead of text links')); + +text_row_ex(_("Query page size:"), 'query_size', 5, 5, '', user_query_size()); -end_table(1); +end_outer_table(1); -submit_center('setprefs', _("Update")); +submit_center('setprefs', _("Update"), true, '', true); end_form(2); diff --git a/admin/fiscalyears.php b/admin/fiscalyears.php index 8dfe4a8f..4e62ad72 100644 --- a/admin/fiscalyears.php +++ b/admin/fiscalyears.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 9; $path_to_root=".."; include_once($path_to_root . "/includes/session.inc"); @@ -141,7 +150,7 @@ function display_fiscalyears() label_cell($closed_text); edit_button_cell("Edit".$myrow['id'], _("Edit")); if ($myrow["id"] != $company_year) - edit_button_cell("Delete".$myrow['id'], _("Delete")); + delete_button_cell("Delete".$myrow['id'], _("Delete")); else label_cell(''); end_row(); diff --git a/admin/forms_setup.php b/admin/forms_setup.php index b4a8aa28..46676617 100644 --- a/admin/forms_setup.php +++ b/admin/forms_setup.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security =10; $path_to_root=".."; include($path_to_root . "/includes/session.inc"); @@ -28,19 +37,26 @@ if (isset($_POST['setprefs'])) } start_form(); -start_table("class='tablestyle'"); + +start_outer_table($table_style2); $systypes = get_systypes(); +table_section(1); $th = array(_("Form"), _("Next Reference")); table_header($th); - +$i = 0; while ($type = db_fetch($systypes)) { + if ($i++ == 11) + { + table_section(2); + table_header($th); + } ref_row(systypes::name($type["type_id"]), 'id' . $type["type_id"], '', $type["next_reference"]); } -end_table(1); +end_outer_table(1); submit_center('setprefs', _("Update"), true, '', true); diff --git a/admin/gl_setup.php b/admin/gl_setup.php index b6939747..1a7efae9 100644 --- a/admin/gl_setup.php +++ b/admin/gl_setup.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security =10; $path_to_root=".."; include($path_to_root . "/includes/session.inc"); @@ -57,6 +66,8 @@ if (isset($_POST['submit']) && can_process()) check_value('allow_negative_stock'), input_num('po_over_receive'), input_num('po_over_charge'), + check_value('accumulate_shipping'), + $_POST['legal_text'], $_POST['past_due_days'], $_POST['default_credit_limit'], $_POST['default_workorder_required'], @@ -69,7 +80,11 @@ if (isset($_POST['submit']) && can_process()) //------------------------------------------------------------------------------------------------- start_form(); -start_table("class='tablestyle'"); + +//start_outer_table("class='tablestyle'"); +start_outer_table($table_style2, 5); + +table_section(1); $myrow = get_company_prefs(); @@ -96,6 +111,8 @@ $_POST['po_over_charge'] = percent_format($myrow['po_over_charge']); $_POST['past_due_days'] = $myrow['past_due_days']; $_POST['default_credit_limit'] = $myrow['default_credit_limit']; +$_POST['legal_text'] = $myrow['legal_text']; +$_POST['accumulate_shipping'] = $myrow['accumulate_shipping']; $_POST['default_workorder_required'] = $myrow['default_workorder_required']; $_POST['default_dim_required'] = $myrow['default_dim_required']; @@ -120,6 +137,10 @@ table_section_title(_("Customers and Sales")); text_row(_("Default Credit Limit:"), 'default_credit_limit', $_POST['default_credit_limit'], 12, 12); +check_row(_("Accumulate batch shipping:"), 'accumulate_shipping', null); + +textarea_row(_("Legal Text on Invoice:"), 'legal_text', $_POST['legal_text'], 32, 3); + gl_all_accounts_list_row(_("Shipping Charged Account:"), 'freight_act', $_POST['freight_act']); //--------------- @@ -129,19 +150,27 @@ table_section_title(_("Customers and Sales Defaults")); gl_all_accounts_list_row(_("Receivable Account:"), 'debtors_act'); gl_all_accounts_list_row(_("Sales Account:"), 'default_sales_act', null, - false, false, false, true); + false, false, true); gl_all_accounts_list_row(_("Sales Discount Account:"), 'default_sales_discount_act'); gl_all_accounts_list_row(_("Prompt Payment Discount Account:"), 'default_prompt_payment_act'); +//---------------- + +table_section_title(_("Dimension Defaults")); + +text_row(_("Dimension Required By After:"), 'default_dim_required', $_POST['default_dim_required'], 6, 6, '', "", _("days")); //--------------- +table_section(2); + table_section_title(_("Suppliers and Purchasing")); percent_row(_("Delivery Over-Receive Allowance:"), 'po_over_receive'); percent_row(_("Invoice Over-Charge Allowance:"), 'po_over_charge'); + // Not used in FA2.0. //gl_all_accounts_list_row(_("Purchases Exchange Variances Account:"), 'purch_exchange_diff_act', $_POST['purch_exchange_diff_act']); // Not used in FA2.0. @@ -153,8 +182,6 @@ gl_all_accounts_list_row(_("Payable Account:"), 'creditors_act', $_POST['credito gl_all_accounts_list_row(_("Purchase Discount Account:"), 'pyt_discount_act', $_POST['pyt_discount_act']); -//--------------- - table_section_title(_("Inventory")); check_row(_("Allow Negative Inventory:"), 'allow_negative_stock', null); @@ -176,15 +203,10 @@ table_section_title(_("Manufacturing Defaults")); text_row(_("Work Order Required By After:"), 'default_workorder_required', $_POST['default_workorder_required'], 6, 6, '', "", _("days")); -//---------------- - -table_section_title(_("Dimension Defaults")); - -text_row(_("Dimension Required By After:"), 'default_dim_required', $_POST['default_dim_required'], 6, 6, '', "", _("days")); //---------------- -end_table(1); +end_outer_table(1); submit_center('submit', _("Update"), true, '', true); diff --git a/admin/inst_lang.php b/admin/inst_lang.php index bd23d383..ccdd3d8e 100644 --- a/admin/inst_lang.php +++ b/admin/inst_lang.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 20; $path_to_root=".."; include_once($path_to_root . "/includes/session.inc"); @@ -28,8 +37,10 @@ else function check_data() { - if ($_POST['code'] == "" || $_POST['name'] == "" || $_POST['encoding'] == "") + if ($_POST['code'] == "" || $_POST['name'] == "" || $_POST['encoding'] == "") { + display_error(_("Language name, code nor encoding cannot be empty")); return false; + } return true; } @@ -78,7 +89,7 @@ function array_natsort($aryData, $strIndex, $strSortBy, $strSortType=false) function write_lang() { - global $path_to_root, $installed_languages; + global $path_to_root, $installed_languages, $dflt_lang; include_once($path_to_root . "/lang/installed_languages.inc"); $conn = array_natsort($installed_languages, 'code', 'code'); @@ -111,7 +122,9 @@ function write_lang() else $msg .= "),\n"; } - $msg .= "\t);\n?>"; + + $msg .= "\t);\n"; + $msg .= "\n\$dflt_lang = '$dflt_lang';\n?>\n"; $filename = $path_to_root . "/lang/installed_languages.inc"; // Check if the file exists and is writable first. @@ -146,13 +159,17 @@ function write_lang() function handle_submit() { - global $path_to_root, $installed_languages; + global $path_to_root, $installed_languages, $dflt_lang; if (!check_data()) return false; $id = $_GET['id']; + if ($_POST['dflt']) { + $dflt_lang = $_POST['code']; + } + $installed_languages[$id]['code'] = $_POST['code']; $installed_languages[$id]['name'] = $_POST['name']; $installed_languages[$id]['encoding'] = $_POST['encoding']; @@ -188,42 +205,28 @@ function handle_submit() function handle_delete() { - global $path_to_root, $installed_languages; + global $path_to_root, $installed_languages, $dflt_lang; $id = $_GET['id']; $lang = $installed_languages[$id]['code']; $filename = "$path_to_root/lang/$lang/LC_MESSAGES"; - if ($h = opendir($filename)) - { - while (($file = readdir($h)) !== false) - { - if (is_file("$filename/$file")) - unlink("$filename/$file"); - } - closedir($h); - } - rmdir($filename); - $filename = "$path_to_root/lang/$lang"; - if ($h = opendir($filename)) - { - while (($file = readdir($h)) !== false) - { - if (is_file("$filename/$file")) - unlink("$filename/$file"); - } - closedir($h); - } - rmdir($filename); + if ($lang == $dflt_lang ) { + // on delete set default to current. + $dflt_lang = $_SESSION['language']->code; + } + unset($installed_languages[$id]); - $conn = array_values($installed_languages); - $installed_languages = $conn; - - //$$db_connections = array_values($db_connections); + $installed_languages = array_values($installed_languages); if (!write_lang()) return; + + $filename = "$path_to_root/lang/$lang"; + flush_dir($filename); + rmdir($filename); + meta_forward($_SERVER['PHP_SELF']); } @@ -231,7 +234,7 @@ function handle_delete() function display_languages() { - global $table_style, $installed_languages; + global $table_style, $installed_languages, $dflt_lang; $lang = $_SESSION["language"]->code; @@ -244,7 +247,7 @@ function display_languages() } "; start_table($table_style); - $th = array(_("Language"), _("Name"), _("Encoding"), _("Right To Left"), "", ""); + $th = array(_("Language"), _("Name"), _("Encoding"), _("Right To Left"), _("Default"), "", ""); table_header($th); $k = 0; @@ -265,10 +268,17 @@ function display_languages() else $rtl = _("No"); label_cell($rtl); - edit_link_cell("selected_id=" . $i); - + label_cell($dflt_lang == $conn[$i]['code'] ? _("Yes") :_("No")); + $edit = _("Edit"); + $delete = _("Delete"); + if (user_graphic_links()) + { + $edit = set_icon(ICON_EDIT, $edit); + $delete = set_icon(ICON_DELETE, $delete); + } + label_cell("$edit"); label_cell($conn[$i]['code'] == $lang ? '' : - "" . _("Delete") . ""); + "$delete"); end_row(); } @@ -280,7 +290,7 @@ function display_languages() function display_language_edit($selected_id) { - global $installed_languages, $table_style2; + global $installed_languages, $table_style2, $dflt_lang; if ($selected_id != -1) $n = $selected_id; @@ -309,13 +319,15 @@ function display_language_edit($selected_id) $_POST['rtl'] = $conn['rtl']; else $_POST['rtl'] = false; + $_POST['dflt'] = $dflt_lang == $conn['code']; hidden('selected_id', $selected_id); } - text_row_ex(_("Language"), 'code', 20); - text_row_ex(_("Name"), 'name', 20); + text_row_ex(_("Language Code"), 'code', 20); + text_row_ex(_("Language Name"), 'name', 20); text_row_ex(_("Encoding"), 'encoding', 20); yesno_list_row(_("Right To Left"), 'rtl', null, "", "", false); + yesno_list_row(_("Default Language"), 'dflt', null, "", "", false); label_row(_("Language File") . " (PO)", ""); label_row(_("Language File") . " (MO)", ""); diff --git a/admin/inst_module.php b/admin/inst_module.php index 1e001768..809252df 100644 --- a/admin/inst_module.php +++ b/admin/inst_module.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 20; $path_to_root=".."; include_once($path_to_root . "/includes/session.inc"); @@ -279,8 +288,15 @@ function display_modules() label_cell($mods[$i]['name']); label_cell($mods[$i]['path']); label_cell($mods[$i]['filename']); - edit_link_cell("selected_id=" . $i); - label_cell("" . _("Delete") . ""); + $edit = _("Edit"); + $delete = _("Delete"); + if (user_graphic_links()) + { + $edit = set_icon(ICON_EDIT, $edit); + $delete = set_icon(ICON_DELETE, $delete); + } + label_cell("$edit"); + label_cell("$delete"); end_row(); } diff --git a/admin/payment_terms.php b/admin/payment_terms.php index 24969c94..6939c9bd 100644 --- a/admin/payment_terms.php +++ b/admin/payment_terms.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 10; $path_to_root=".."; include($path_to_root . "/includes/session.inc"); @@ -164,7 +173,7 @@ while ($myrow = db_fetch($result)) label_cell($full_text); label_cell($after_text); edit_button_cell("Edit".$myrow["terms_indicator"], _("Edit")); - edit_button_cell("Delete".$myrow["terms_indicator"], _("Delete")); + delete_button_cell("Delete".$myrow["terms_indicator"], _("Delete")); end_row(); diff --git a/admin/shipping_companies.php b/admin/shipping_companies.php index 1c16fa3f..17726cc3 100644 --- a/admin/shipping_companies.php +++ b/admin/shipping_companies.php @@ -1,6 +1,14 @@ . +***********************************************************************/ $page_security = 14; $path_to_root=".."; include($path_to_root . "/includes/session.inc"); @@ -113,7 +121,7 @@ while ($myrow = db_fetch($result)) label_cell($myrow["phone"]); label_cell($myrow["address"]); edit_button_cell("Edit".$myrow[0], _("Edit")); - edit_button_cell("Delete".$myrow[0], _("Delete")); + delete_button_cell("Delete".$myrow[0], _("Delete")); end_row(); } diff --git a/admin/users.php b/admin/users.php index bd3b0eb3..71db09ce 100644 --- a/admin/users.php +++ b/admin/users.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security=15; $path_to_root=".."; include_once($path_to_root . "/includes/session.inc"); @@ -54,7 +63,8 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') if ($selected_id != '') { update_user($_POST['user_id'], $_POST['real_name'], $_POST['phone'], - $_POST['email'], $_POST['Access'], $_POST['language']); + $_POST['email'], $_POST['Access'], $_POST['language'], + $_POST['profile'], check_value('rep_popup'), $_POST['pos']); if ($_POST['password'] != "") update_user_password($_POST['user_id'], md5($_POST['password'])); @@ -64,7 +74,17 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') else { add_user($_POST['user_id'], $_POST['real_name'], md5($_POST['password']), - $_POST['phone'], $_POST['email'], $_POST['Access'], $_POST['language']); + $_POST['phone'], $_POST['email'], $_POST['Access'], $_POST['language'], + $_POST['profile'], check_value('rep_popup'), $_POST['pos']); + + // use current user display preferences as start point for new user + update_user_display_prefs($_POST['user_id'], + user_price_dec(), user_qty_dec(), user_exrate_dec(), + user_percent_dec(), user_show_gl_info(), user_show_codes(), + user_date_format(), user_date_sep(), user_tho_sep(), + user_dec_sep(), user_theme(), user_pagesize(), user_hints(), + $_POST['profile'], check_value('rep_popup'), user_query_size(), + user_graphic_links(), $_POST['language']); display_notification_centered(_("A new user has been added.")); } @@ -114,13 +134,13 @@ while ($myrow = db_fetch($result)) label_cell($myrow["user_id"]); label_cell($myrow["real_name"]); label_cell($myrow["phone"]); - label_cell($myrow["email"]); + email_cell($myrow["email"]); label_cell($last_visit_date, "nowrap"); label_cell($security_headings[$myrow["full_access"]]); edit_button_cell("Edit".$myrow["user_id"], _("Edit")); if (strcasecmp($myrow["user_id"], $_SESSION["wa_current_user"]->username) && $_SESSION["wa_current_user"]->access == 2) - edit_button_cell("Delete".$myrow["user_id"], _("Delete")); + delete_button_cell("Delete".$myrow["user_id"], _("Delete")); else label_cell(''); end_row(); @@ -135,6 +155,8 @@ echo '
'; start_form(); start_table($table_style2); + +$_POST['email'] = ""; if ($selected_id != '') { if ($Mode == 'Edit') { @@ -147,6 +169,9 @@ if ($selected_id != '') $_POST['email'] = $myrow["email"]; $_POST['Access'] = $myrow["full_access"]; $_POST['language'] = $myrow["language"]; + $_POST['profile'] = $myrow["print_profile"]; + $_POST['rep_popup'] = $myrow["rep_popup"]; + $_POST['pos'] = $myrow["pos"]; } hidden('selected_id', $selected_id); hidden('user_id'); @@ -157,6 +182,10 @@ if ($selected_id != '') else { //end of if $selected_id only do the else when a new record is being entered text_row(_("User Login:"), "user_id", null, 22, 20); + $_POST['language'] = user_language(); + $_POST['profile'] = user_print_profile(); + $_POST['rep_popup'] = user_rep_popup(); + $_POST['pos'] = user_pos(); } $_POST['password'] = ""; start_row(); @@ -173,12 +202,20 @@ text_row_ex(_("Full Name").":", 'real_name', 50); text_row_ex(_("Telephone No.:"), 'phone', 30); -text_row_ex(_("Email Address:"), 'email', 50); +email_row_ex(_("Email Address:"), 'email', 50); security_headings_list_row(_("Access Level:"), 'Access', null); languages_list_row(_("Language:"), 'language', null); +pos_list_row(_("User's POS"). ':', 'pos', null); + +print_profiles_list_row(_("Printing profile"). ':', 'profile', null, + _('Browser printing support')); + +check_row(_("Use popup window for reports:"), 'rep_popup', $_POST['rep_popup'], + false, _('Set this option to on if your browser directly supports pdf files')); + end_table(1); submit_add_or_update_center($selected_id == '', '', true); diff --git a/admin/view_print_transaction.php b/admin/view_print_transaction.php index da479c6b..98bf8d9e 100644 --- a/admin/view_print_transaction.php +++ b/admin/view_print_transaction.php @@ -1,8 +1,18 @@ . +***********************************************************************/ $path_to_root=".."; $page_security = 5; +include($path_to_root . "/includes/db_pager.inc"); include_once($path_to_root . "/includes/session.inc"); include_once($path_to_root . "/includes/date_functions.inc"); @@ -16,11 +26,25 @@ if ($use_popup_windows) page(_("View or Print Transactions"), false, false, "", $js); //---------------------------------------------------------------------------------------- +function view_link($trans) +{ + return get_trans_view_str($trans["type"], $trans["trans_no"]); +} + +function prt_link($row) +{ + if ($row['type'] != 12 && $row['type'] != 2) // customer payment or bank deposit printout not defined yet. + return print_document_link($row['trans_no'], _("Print"), true, $row['type'], ICON_PRINT); +} + +function gl_view($row) +{ + return get_gl_view_str($row["type"], $row["trans_no"]); +} function viewing_controls() { display_note(_("Only documents can be printed.")); - start_form(false, true); start_table("class='tablestyle_noborder'"); start_row(); @@ -41,7 +65,6 @@ function viewing_controls() end_row(); end_table(1); - end_form(); } //---------------------------------------------------------------------------------------- @@ -50,13 +73,13 @@ function check_valid_entries() { if (!is_numeric($_POST['FromTransNo']) OR $_POST['FromTransNo'] <= 0) { - display_note(_("The starting transaction number is expected to be numeric and greater than zero.")); + display_error(_("The starting transaction number is expected to be numeric and greater than zero.")); return false; } if (!is_numeric($_POST['ToTransNo']) OR $_POST['ToTransNo'] <= 0) { - echo _("The ending transaction number is expected to be numeric and greater than zero."); + display_error(_("The ending transaction number is expected to be numeric and greater than zero.")); return false; } if (!isset($_POST['filterType']) || $_POST['filterType'] == "") @@ -82,69 +105,48 @@ function handle_search() $trans_no_name = $db_info[2]; $trans_ref = $db_info[3]; - $sql = "SELECT DISTINCT $trans_no_name "; + $sql = "SELECT DISTINCT $trans_no_name as trans_no"; if ($trans_ref) $sql .= " ,$trans_ref "; - $sql .= " FROM $table_name + $sql .= ", ".$_POST['filterType']." as type FROM $table_name WHERE $trans_no_name >= " . $_POST['FromTransNo']. " AND $trans_no_name <= " . $_POST['ToTransNo']; if ($type_name != null) - $sql .= " AND $type_name = " . $_POST['filterType']; + $sql .= " AND `$type_name` = " . $_POST['filterType']; $sql .= " ORDER BY $trans_no_name"; - $result = db_query($sql, "could not query transactions on $table_name"); - if (db_num_rows($result) == 0) - { - echo _("There are no transactions for the given parameters."); - return; - } $print_type = $_POST['filterType']; $print_out = ($print_type == 10 || $print_type == 11 || $print_type == systypes::cust_dispatch() || $print_type == systypes::po() || $print_type == systypes::sales_order()); - if ($print_out) - { - print_hidden_script($print_type); - if ($trans_ref) - $th = array(_("#"), _("Reference"), _("View"), _("Print"), _("GL")); - else - $th = array(_("#"), _("View"), _("Print"), _("GL")); + + $cols = array( + _("#"), + _("Reference"), + _("View") => array('insert'=>true, 'fun'=>'view_link'), + _("Print") => array('insert'=>true, 'fun'=>'prt_link'), + _("GL") => array('insert'=>true, 'fun'=>'gl_view') + ); + if(!$print_out) { + array_remove($cols, 3); } - else - { - if ($trans_ref) - $th = array(_("#"), _("Reference"), _("View"), _("GL")); - else - $th = array(_("#"), _("View"), _("GL")); + if(!$trans_ref) { + array_remove($cols, 1); } - div_start('transactions'); - start_table($table_style); - table_header($th); - $k = 0; - while ($line = db_fetch($result)) - { - - alt_table_row_color($k); - - label_cell($line[$trans_no_name]); - if ($trans_ref) - label_cell($line[$trans_ref]); - label_cell(get_trans_view_str($_POST['filterType'],$line[$trans_no_name], _("View"))); - if ($print_out) - label_cell(print_document_link($line[$trans_no_name], _("Print"), true, $print_type)); - label_cell(get_gl_view_str($_POST['filterType'], $line[$trans_no_name], _("View GL"))); - - end_row(); + $table =& new_db_pager('transactions', $sql, $cols); + if (list_updated('filterType')) { + $table->set_sql($sql); + $table->set_columns($cols); } - - end_table(); - div_end(); + $table->width = "40%"; + display_db_pager($table); } + } //---------------------------------------------------------------------------------------- @@ -158,11 +160,10 @@ if (isset($_POST['ProcessSearch'])) //---------------------------------------------------------------------------------------- -viewing_controls(); - -handle_search(); - -br(2); +start_form(false, true); + viewing_controls(); + handle_search(); +end_form(2); end_page(); diff --git a/admin/void_transaction.php b/admin/void_transaction.php index 551f15e3..3d967ec2 100644 --- a/admin/void_transaction.php +++ b/admin/void_transaction.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $path_to_root=".."; $page_security = 14; include_once($path_to_root . "/includes/session.inc"); @@ -121,7 +130,7 @@ function voiding_controls() } else { - display_notification_centered(_("Are you sure you want to void this transaction ? This action cannot be undone."), 0, 1); + display_warning(_("Are you sure you want to void this transaction ? This action cannot be undone."), 0, 1); if ($_POST['filterType'] == 0) // GL transaction are not included in get_trans_view_str $view_str = get_gl_view_str($_POST['filterType'],$_POST['trans_no'], _("View Transaction")); else diff --git a/applications/application.php b/applications/application.php index 69029bf2..a7c47964 100644 --- a/applications/application.php +++ b/applications/application.php @@ -1,5 +1,14 @@ . +***********************************************************************/ class menu_item { var $label; diff --git a/applications/customers.php b/applications/customers.php index c6d5519c..78e49e54 100644 --- a/applications/customers.php +++ b/applications/customers.php @@ -1,43 +1,54 @@ . +***********************************************************************/ class customers_app extends application { function customers_app() { global $installed_modules; - $this->application("orders",_("Sales")); + $this->application("orders",_("&Sales")); $this->add_module(_("Transactions")); - $this->add_lapp_function(0, _("Sales Order Entry"),"sales/sales_order_entry.php?NewOrder=Yes"); - $this->add_lapp_function(0, _("Direct Delivery"),"sales/sales_order_entry.php?NewDelivery=0"); - $this->add_lapp_function(0, _("Direct Invoice"),"sales/sales_order_entry.php?NewInvoice=0"); + $this->add_lapp_function(0, _("Sales &Order Entry"),"sales/sales_order_entry.php?NewOrder=Yes"); + $this->add_lapp_function(0, _("Direct &Delivery"),"sales/sales_order_entry.php?NewDelivery=0"); + $this->add_lapp_function(0, _("Direct &Invoice"),"sales/sales_order_entry.php?NewInvoice=0"); $this->add_lapp_function(0, "",""); - $this->add_lapp_function(0, _("Delivery Against Sales Orders"),"sales/inquiry/sales_orders_view.php?OutstandingOnly=1"); - $this->add_lapp_function(0, _("Invoice Against Sales Delivery"),"sales/inquiry/sales_deliveries_view.php?OutstandingOnly=1"); + $this->add_lapp_function(0, _("&Delivery Against Sales Orders"),"sales/inquiry/sales_orders_view.php?OutstandingOnly=1"); + $this->add_lapp_function(0, _("&Invoice Against Sales Delivery"),"sales/inquiry/sales_deliveries_view.php?OutstandingOnly=1"); - $this->add_rapp_function(0, _("Template Delivery"),"sales/inquiry/sales_orders_view.php?DeliveryTemplates=Yes"); - $this->add_rapp_function(0, _("Template Invoice"),"sales/inquiry/sales_orders_view.php?InvoiceTemplates=Yes"); + $this->add_rapp_function(0, _("&Template Delivery"),"sales/inquiry/sales_orders_view.php?DeliveryTemplates=Yes"); + $this->add_rapp_function(0, _("&Template Invoice"),"sales/inquiry/sales_orders_view.php?InvoiceTemplates=Yes"); + $this->add_rapp_function(0, _("&Create and Print Recurrent Invoices"),"sales/create_recurrent_invoices.php?"); $this->add_rapp_function(0, "",""); - $this->add_rapp_function(0, _("Customer Payments"),"sales/customer_payments.php?"); - $this->add_rapp_function(0, _("Customer Credit Notes"),"sales/credit_note_entry.php?NewCredit=Yes"); - $this->add_rapp_function(0, _("Allocate Customer Payments or Credit Notes"),"sales/allocations/customer_allocation_main.php?"); + $this->add_rapp_function(0, _("Customer &Payments"),"sales/customer_payments.php?"); + $this->add_rapp_function(0, _("Customer &Credit Notes"),"sales/credit_note_entry.php?NewCredit=Yes"); + $this->add_rapp_function(0, _("&Allocate Customer Payments or Credit Notes"),"sales/allocations/customer_allocation_main.php?"); $this->add_module(_("Inquiries and Reports")); - $this->add_lapp_function(1, _("Sales Order Inquiry"),"sales/inquiry/sales_orders_view.php?"); - $this->add_lapp_function(1, _("Customer Transaction Inquiry"),"sales/inquiry/customer_inquiry.php?"); + $this->add_lapp_function(1, _("Sales Order &Inquiry"),"sales/inquiry/sales_orders_view.php?"); + $this->add_lapp_function(1, _("Customer Transaction &Inquiry"),"sales/inquiry/customer_inquiry.php?"); $this->add_lapp_function(1, "",""); - $this->add_lapp_function(1, _("Customer Allocation Inquiry"),"sales/inquiry/customer_allocation_inquiry.php?"); + $this->add_lapp_function(1, _("Customer Allocation &Inquiry"),"sales/inquiry/customer_allocation_inquiry.php?"); - $this->add_rapp_function(1, _("Customer and Sales Reports"),"reporting/reports_main.php?Class=0"); + $this->add_rapp_function(1, _("Customer and Sales &Reports"),"reporting/reports_main.php?Class=0"); $this->add_module(_("Maintenance")); - $this->add_lapp_function(2, _("Add and Manage Customers"),"sales/manage/customers.php?"); - $this->add_lapp_function(2, _("Customer Branches"),"sales/manage/customer_branches.php?"); - $this->add_rapp_function(2, _("Sales Types"),"sales/manage/sales_types.php?"); - $this->add_rapp_function(2, _("Sales Persons"),"sales/manage/sales_people.php?"); - $this->add_rapp_function(2, _("Sales Areas"),"sales/manage/sales_areas.php?"); - $this->add_rapp_function(2, _("Credit Status Setup"),"sales/manage/credit_status.php?"); + $this->add_lapp_function(2, _("Add and Manage &Customers"),"sales/manage/customers.php?"); + $this->add_lapp_function(2, _("Customer &Branches"),"sales/manage/customer_branches.php?"); + $this->add_lapp_function(2, _("Sales &Groups"),"sales/manage/sales_groups.php?"); + $this->add_lapp_function(2, _("Recurrent &Invoices"),"sales/manage/recurrent_invoices.php?"); + $this->add_rapp_function(2, _("Sales T&ypes"),"sales/manage/sales_types.php?"); + $this->add_rapp_function(2, _("Sales &Persons"),"sales/manage/sales_people.php?"); + $this->add_rapp_function(2, _("Sales &Areas"),"sales/manage/sales_areas.php?"); + $this->add_rapp_function(2, _("Credit &Status Setup"),"sales/manage/credit_status.php?"); if (count($installed_modules) > 0) { foreach ($installed_modules as $mod) diff --git a/applications/dimensions.php b/applications/dimensions.php index 3c02861e..4bd23fae 100644 --- a/applications/dimensions.php +++ b/applications/dimensions.php @@ -1,24 +1,32 @@ . +***********************************************************************/ class dimensions_app extends application { function dimensions_app() { global $installed_modules; $dim = get_company_pref('use_dimension'); - $this->application("proj",_("Dimensions")); + $this->application("proj",_("&Dimensions")); if ($dim > 0) { $this->add_module(_("Transactions")); - $this->add_lapp_function(0, _("Dimension Entry"),"dimensions/dimension_entry.php?"); - $this->add_lapp_function(0, _("Outstanding Dimensions"),"dimensions/inquiry/search_dimensions.php?outstanding_only=1"); + $this->add_lapp_function(0, _("Dimension &Entry"),"dimensions/dimension_entry.php?"); + $this->add_lapp_function(0, _("&Outstanding Dimensions"),"dimensions/inquiry/search_dimensions.php?outstanding_only=1"); $this->add_module(_("Inquiries and Reports")); - $this->add_lapp_function(1, _("Dimension Inquiry"),"dimensions/inquiry/search_dimensions.php?"); + $this->add_lapp_function(1, _("Dimension &Inquiry"),"dimensions/inquiry/search_dimensions.php?"); - $this->add_rapp_function(1, _("Dimension Reports"),"reporting/reports_main.php?Class=4"); + $this->add_rapp_function(1, _("Dimension &Reports"),"reporting/reports_main.php?Class=4"); if (count($installed_modules) > 0) { $i = 0; diff --git a/applications/generalledger.php b/applications/generalledger.php index b610f841..8c0e11fb 100644 --- a/applications/generalledger.php +++ b/applications/generalledger.php @@ -1,39 +1,47 @@ . +***********************************************************************/ class general_ledger_app extends application { function general_ledger_app() { global $installed_modules; - $this->application("GL",_("Banking and General Ledger")); + $this->application("GL",_("&Banking and General Ledger")); $this->add_module(_("Transactions")); - $this->add_lapp_function(0, _("Payments"),"gl/gl_bank.php?NewPayment=Yes"); - $this->add_lapp_function(0, _("Deposits"),"gl/gl_bank.php?NewDeposit=Yes"); - $this->add_lapp_function(0, _("Bank Account Transfers"),"gl/bank_transfer.php?"); - $this->add_rapp_function(0, _("Journal Entry"),"gl/gl_journal.php?NewJournal=Yes"); - $this->add_rapp_function(0, _("Budget Entry"),"gl/gl_budget.php?"); - + $this->add_lapp_function(0, _("&Payments"),"gl/gl_bank.php?NewPayment=Yes"); + $this->add_lapp_function(0, _("&Deposits"),"gl/gl_bank.php?NewDeposit=Yes"); + $this->add_lapp_function(0, _("Bank Account &Transfers"),"gl/bank_transfer.php?"); + $this->add_rapp_function(0, _("&Journal Entry"),"gl/gl_journal.php?NewJournal=Yes"); + $this->add_rapp_function(0, _("&Budget Entry"),"gl/gl_budget.php?"); + $this->add_rapp_function(0, _("&Reconcile Bank Account"),"gl/bank_account_reconcile.php?"); $this->add_module(_("Inquiries and Reports")); - $this->add_lapp_function(1, _("Bank Account Inquiry"),"gl/inquiry/bank_inquiry.php?"); - $this->add_lapp_function(1, _("GL Account Inquiry"),"gl/inquiry/gl_account_inquiry.php?"); - $this->add_lapp_function(1, "",""); - $this->add_lapp_function(1, _("Trial Balance"),"gl/inquiry/gl_trial_balance.php?"); + $this->add_lapp_function(1, _("Bank Account &Inquiry"),"gl/inquiry/bank_inquiry.php?"); + $this->add_lapp_function(1, _("GL Account &Inquiry"),"gl/inquiry/gl_account_inquiry.php?"); + $this->add_lapp_function(1, _("Trial &Balance"),"gl/inquiry/gl_trial_balance.php?"); + $this->add_lapp_function(1, _("Ta&x Inquiry"),"gl/inquiry/tax_inquiry.php?"); - $this->add_rapp_function(1, _("Banking Reports"),"reporting/reports_main.php?Class=5"); - $this->add_rapp_function(1, _("General Ledger Reports"),"reporting/reports_main.php?Class=6"); + $this->add_rapp_function(1, _("Banking &Reports"),"reporting/reports_main.php?Class=5"); + $this->add_rapp_function(1, _("General Ledger &Reports"),"reporting/reports_main.php?Class=6"); $this->add_module(_("Maintenance")); - $this->add_lapp_function(2, _("Bank Accounts"),"gl/manage/bank_accounts.php?"); - $this->add_lapp_function(2, _("Payment, Deposit and Transfer Types"),"gl/manage/bank_trans_types.php?"); + $this->add_lapp_function(2, _("Bank &Accounts"),"gl/manage/bank_accounts.php?"); + $this->add_lapp_function(2, _("&Quick Entries"),"gl/manage/gl_quick_entries.php?"); $this->add_lapp_function(2, "",""); - $this->add_lapp_function(2, _("Currencies"),"gl/manage/currencies.php?"); - $this->add_lapp_function(2, _("Exchange Rates"),"gl/manage/exchange_rates.php?"); + $this->add_lapp_function(2, _("&Currencies"),"gl/manage/currencies.php?"); + $this->add_lapp_function(2, _("&Exchange Rates"),"gl/manage/exchange_rates.php?"); - $this->add_rapp_function(2, _("GL Accounts"),"gl/manage/gl_accounts.php?"); - $this->add_rapp_function(2, _("GL Account Groups"),"gl/manage/gl_account_types.php?"); - $this->add_rapp_function(2, _("GL Account Classes"),"gl/manage/gl_account_classes.php?"); + $this->add_rapp_function(2, _("&GL Accounts"),"gl/manage/gl_accounts.php?"); + $this->add_rapp_function(2, _("GL Account &Groups"),"gl/manage/gl_account_types.php?"); + $this->add_rapp_function(2, _("GL Account &Classes"),"gl/manage/gl_account_classes.php?"); if (count($installed_modules) > 0) { foreach ($installed_modules as $mod) diff --git a/applications/inventory.php b/applications/inventory.php index 5fa7d5e1..022ad67b 100644 --- a/applications/inventory.php +++ b/applications/inventory.php @@ -1,35 +1,45 @@ . +***********************************************************************/ class inventory_app extends application { function inventory_app() { global $installed_modules; - $this->application("stock",_("Items and Inventory")); + $this->application("stock",_("&Items and Inventory")); $this->add_module(_("Transactions")); - $this->add_lapp_function(0, _("Inventory Location Transfers"),"inventory/transfers.php?NewTransfer=1"); - $this->add_lapp_function(0, _("Inventory Adjustments"),"inventory/adjustments.php?NewAdjustment=1"); + $this->add_lapp_function(0, _("Inventory Location &Transfers"),"inventory/transfers.php?NewTransfer=1"); + $this->add_lapp_function(0, _("Inventory &Adjustments"),"inventory/adjustments.php?NewAdjustment=1"); $this->add_module(_("Inquiries and Reports")); - $this->add_lapp_function(1, _("Inventory Item Movements"),"inventory/inquiry/stock_movements.php?"); - $this->add_lapp_function(1, _("Inventory Item Status"),"inventory/inquiry/stock_status.php?"); - $this->add_rapp_function(1, _("Inventory Reports"),"reporting/reports_main.php?Class=2"); + $this->add_lapp_function(1, _("Inventory Item &Movements"),"inventory/inquiry/stock_movements.php?"); + $this->add_lapp_function(1, _("Inventory Item &Status"),"inventory/inquiry/stock_status.php?"); + $this->add_rapp_function(1, _("Inventory &Reports"),"reporting/reports_main.php?Class=2"); $this->add_module(_("Maintenance")); - $this->add_lapp_function(2, _("Items"),"inventory/manage/items.php?"); - $this->add_lapp_function(2, _("Item Categories"),"inventory/manage/item_categories.php?"); - $this->add_lapp_function(2, _("Inventory Locations"),"inventory/manage/locations.php?"); - $this->add_rapp_function(2, _("Inventory Movement Types"),"inventory/manage/movement_types.php?"); - $this->add_rapp_function(2, _("Item Tax Types"),"taxes/item_tax_types.php?"); - $this->add_rapp_function(2, _("Units of Measure"),"inventory/manage/item_units.php?"); - $this->add_rapp_function(2, _("Reorder Levels"),"inventory/reorder_level.php?"); + $this->add_lapp_function(2, _("&Items"),"inventory/manage/items.php?"); + $this->add_lapp_function(2, _("&Foreign Item Codes"),"inventory/manage/item_codes.php?"); + $this->add_lapp_function(2, _("Sales &Kits"),"inventory/manage/sales_kits.php?"); + $this->add_lapp_function(2, _("Item &Categories"),"inventory/manage/item_categories.php?"); + $this->add_lapp_function(2, _("Inventory &Locations"),"inventory/manage/locations.php?"); + $this->add_rapp_function(2, _("Inventory &Movement Types"),"inventory/manage/movement_types.php?"); + $this->add_rapp_function(2, _("Item Ta&x Types"),"taxes/item_tax_types.php?"); + $this->add_rapp_function(2, _("&Units of Measure"),"inventory/manage/item_units.php?"); + $this->add_rapp_function(2, _("&Reorder Levels"),"inventory/reorder_level.php?"); $this->add_module(_("Pricing and Costs")); - $this->add_lapp_function(3, _("Sales Pricing"),"inventory/prices.php?"); - $this->add_lapp_function(3, _("Purchasing Pricing"),"inventory/purchasing_data.php?"); - $this->add_rapp_function(3, _("Standard Costs"),"inventory/cost_update.php?"); + $this->add_lapp_function(3, _("Sales &Pricing"),"inventory/prices.php?"); + $this->add_lapp_function(3, _("Purchasing &Pricing"),"inventory/purchasing_data.php?"); + $this->add_rapp_function(3, _("Standard &Costs"),"inventory/cost_update.php?"); if (count($installed_modules) > 0) { foreach ($installed_modules as $mod) diff --git a/applications/manufacturing.php b/applications/manufacturing.php index ab8cb507..db225f4c 100644 --- a/applications/manufacturing.php +++ b/applications/manufacturing.php @@ -1,26 +1,34 @@ . +***********************************************************************/ class manufacturing_app extends application { function manufacturing_app() { global $installed_modules; - $this->application("manuf",_("Manufacturing")); + $this->application("manuf",_("&Manufacturing")); $this->add_module(_("Transactions")); - $this->add_lapp_function(0, _("Work Order Entry"),"manufacturing/work_order_entry.php?"); - $this->add_lapp_function(0, _("Outstanding Work Orders"),"manufacturing/search_work_orders.php?outstanding_only=1"); + $this->add_lapp_function(0, _("Work &Order Entry"),"manufacturing/work_order_entry.php?"); + $this->add_lapp_function(0, _("&Outstanding Work Orders"),"manufacturing/search_work_orders.php?outstanding_only=1"); $this->add_module(_("Inquiries and Reports")); //$this->add_lapp_function(1, _("Costed Bill Of Material Inquiry"),"manufacturing/inquiry/bom_cost_inquiry.php?"); - $this->add_lapp_function(1, _("Inventory Item Where Used Inquiry"),"manufacturing/inquiry/where_used_inquiry.php?"); - $this->add_lapp_function(1, _("Work Order Inquiry"),"manufacturing/search_work_orders.php?"); - $this->add_rapp_function(1, _("Manufacturing Reports"),"reporting/reports_main.php?Class=3"); + $this->add_lapp_function(1, _("Inventory Item Where Used &Inquiry"),"manufacturing/inquiry/where_used_inquiry.php?"); + $this->add_lapp_function(1, _("Work Order &Inquiry"),"manufacturing/search_work_orders.php?"); + $this->add_rapp_function(1, _("Manufacturing &Reports"),"reporting/reports_main.php?Class=3"); $this->add_module(_("Maintenance")); - $this->add_lapp_function(2, _("Bills Of Material"),"manufacturing/manage/bom_edit.php?"); - $this->add_lapp_function(2, _("Work Centres"),"manufacturing/manage/work_centres.php?"); + $this->add_lapp_function(2, _("&Bills Of Material"),"manufacturing/manage/bom_edit.php?"); + $this->add_lapp_function(2, _("&Work Centres"),"manufacturing/manage/work_centres.php?"); if (count($installed_modules) > 0) { foreach ($installed_modules as $mod) diff --git a/applications/setup.php b/applications/setup.php index 1bc46c46..3bb5578d 100644 --- a/applications/setup.php +++ b/applications/setup.php @@ -1,36 +1,49 @@ . +***********************************************************************/ class setup_app extends application { function setup_app() { global $installed_modules; - $this->application("system",_("Setup")); + $this->application("system",_("S&etup")); $this->add_module(_("Company Setup")); - $this->add_lapp_function(0, _("Company Setup"),"admin/company_preferences.php?"); - $this->add_lapp_function(0, _("User Accounts Setup"),"admin/users.php?", 15); + $this->add_lapp_function(0, _("&Company Setup"),"admin/company_preferences.php?"); + $this->add_lapp_function(0, _("&User Accounts Setup"),"admin/users.php?", 15); $this->add_lapp_function(0, "",""); - $this->add_lapp_function(0, _("Display Setup"),"admin/display_prefs.php?"); - $this->add_lapp_function(0, _("Forms Setup"),"admin/forms_setup.php?"); - $this->add_rapp_function(0, _("Taxes"),"taxes/tax_types.php?"); - $this->add_rapp_function(0, _("Tax Groups"),"taxes/tax_groups.php?"); + $this->add_lapp_function(0, _("&Display Setup"),"admin/display_prefs.php?"); + $this->add_lapp_function(0, _("&Forms Setup"),"admin/forms_setup.php?"); + $this->add_rapp_function(0, _("&Taxes"),"taxes/tax_types.php?"); + $this->add_rapp_function(0, _("Tax &Groups"),"taxes/tax_groups.php?"); $this->add_rapp_function(0, "",""); - $this->add_rapp_function(0, _("System and General GL Setup"),"admin/gl_setup.php?"); - $this->add_rapp_function(0, _("Fiscal Years"),"admin/fiscalyears.php?"); + $this->add_rapp_function(0, _("System and &General GL Setup"),"admin/gl_setup.php?"); + $this->add_rapp_function(0, _("&Fiscal Years"),"admin/fiscalyears.php?"); + $this->add_rapp_function(0, _("&Print Profiles"),"admin/print_profiles.php?"); $this->add_module(_("Miscellaneous")); - $this->add_lapp_function(1, _("Payment Terms"),"admin/payment_terms.php?"); - $this->add_lapp_function(1, _("Shipping Company"),"admin/shipping_companies.php?"); + $this->add_lapp_function(1, _("Pa&yment Terms"),"admin/payment_terms.php?"); + $this->add_lapp_function(1, _("Shi&pping Company"),"admin/shipping_companies.php?"); + $this->add_rapp_function(1, _("&Points of Sale"),"sales/manage/sales_points.php?"); + $this->add_rapp_function(1, _("&Printers"),"admin/printers.php?"); $this->add_module(_("Maintanance")); - $this->add_lapp_function(2, _("Void a Transaction"),"admin/void_transaction.php?"); - $this->add_lapp_function(2, _("View or Print Transactions"),"admin/view_print_transaction.php?"); - $this->add_rapp_function(2, _("Backup and Restore"),"admin/backups.php?", 15); - $this->add_rapp_function(2, _("Create/Update Companies"),"admin/create_coy.php?", 14); - $this->add_rapp_function(2, _("Install/Update Languages"),"admin/inst_lang.php?", 14); - $this->add_rapp_function(2, _("Install/Update Modules"),"admin/inst_module.php?", 15); + $this->add_lapp_function(2, _("&Void a Transaction"),"admin/void_transaction.php?"); + $this->add_lapp_function(2, _("View or &Print Transactions"),"admin/view_print_transaction.php?"); + $this->add_lapp_function(2, _("&Attach Documents"),"admin/attachments.php?filterType=20"); + $this->add_rapp_function(2, _("&Backup and Restore"),"admin/backups.php?", 15); + $this->add_rapp_function(2, _("Create/Update &Companies"),"admin/create_coy.php?", 14); + $this->add_rapp_function(2, _("Install/Update &Languages"),"admin/inst_lang.php?", 14); + $this->add_rapp_function(2, _("Install/Update &Modules"),"admin/inst_module.php?", 15); + $this->add_rapp_function(2, _("Software &Upgrade"),"admin/inst_upgrade.php?", 15); if (count($installed_modules) > 0) { foreach ($installed_modules as $mod) diff --git a/applications/suppliers.php b/applications/suppliers.php index 83c6d527..345b3d10 100644 --- a/applications/suppliers.php +++ b/applications/suppliers.php @@ -1,32 +1,40 @@ . +***********************************************************************/ class suppliers_app extends application { function suppliers_app() { global $installed_modules; - $this->application("AP",_("Purchases")); + $this->application("AP",_("&Purchases")); $this->add_module(_("Transactions")); - $this->add_lapp_function(0, _("Purchase Order Entry"),"purchasing/po_entry_items.php?NewOrder=Yes"); - $this->add_lapp_function(0, _("Outstanding Purchase Orders Maintenance"),"purchasing/inquiry/po_search.php?"); - $this->add_rapp_function(0, _("Payments to Suppliers"),"purchasing/supplier_payment.php?"); + $this->add_lapp_function(0, _("Purchase &Order Entry"),"purchasing/po_entry_items.php?NewOrder=Yes"); + $this->add_lapp_function(0, _("&Outstanding Purchase Orders Maintenance"),"purchasing/inquiry/po_search.php?"); + $this->add_rapp_function(0, _("&Payments to Suppliers"),"purchasing/supplier_payment.php?"); $this->add_rapp_function(0, "",""); - $this->add_rapp_function(0, _("Supplier Invoices"),"purchasing/supplier_invoice.php?New=1"); - $this->add_rapp_function(0, _("Supplier Credit Notes"),"purchasing/supplier_credit.php?New=1"); - $this->add_rapp_function(0, _("Allocate Supplier Payments or Credit Notes"),"purchasing/allocations/supplier_allocation_main.php?"); + $this->add_rapp_function(0, _("Supplier &Invoices"),"purchasing/supplier_invoice.php?New=1"); + $this->add_rapp_function(0, _("Supplier &Credit Notes"),"purchasing/supplier_credit.php?New=1"); + $this->add_rapp_function(0, _("&Allocate Supplier Payments or Credit Notes"),"purchasing/allocations/supplier_allocation_main.php?"); $this->add_module(_("Inquiries and Reports")); - $this->add_lapp_function(1, _("Purchase Orders Inquiry"),"purchasing/inquiry/po_search_completed.php?"); - $this->add_lapp_function(1, _("Supplier Transaction Inquiry"),"purchasing/inquiry/supplier_inquiry.php?"); + $this->add_lapp_function(1, _("Purchase Orders &Inquiry"),"purchasing/inquiry/po_search_completed.php?"); + $this->add_lapp_function(1, _("Supplier Transaction &Inquiry"),"purchasing/inquiry/supplier_inquiry.php?"); $this->add_lapp_function(1, "",""); - $this->add_lapp_function(1, _("Supplier Allocation Inquiry"),"purchasing/inquiry/supplier_allocation_inquiry.php?"); + $this->add_lapp_function(1, _("Supplier Allocation &Inquiry"),"purchasing/inquiry/supplier_allocation_inquiry.php?"); - $this->add_rapp_function(1, _("Supplier and Purchasing Reports"),"reporting/reports_main.php?Class=1"); + $this->add_rapp_function(1, _("Supplier and Purchasing &Reports"),"reporting/reports_main.php?Class=1"); $this->add_module(_("Maintenance")); - $this->add_lapp_function(2, _("Suppliers"),"purchasing/manage/suppliers.php?"); + $this->add_lapp_function(2, _("&Suppliers"),"purchasing/manage/suppliers.php?"); if (count($installed_modules) > 0) { foreach ($installed_modules as $mod) diff --git a/company/0/images/logo_frontaccounting.png b/company/0/images/logo_frontaccounting.png deleted file mode 100644 index 85150e2bbec2bdf03536d2d3f095e8bd15df1274..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10792 zcmYkCV|1m#vWBCHZQIGjwr!ge+xCua+nI?bwryv^iS10VgMD-E{c-ME-K)Q^{&ugb zx1M^VRg|QW;PK(Xz`&4XWhB(TPT<#OgM|hI1BXy~a{c;&ahFw;gjs_`L&T+BH2Svj z6@qh?(RBj@BhUHI2JhW|qyGv*S&1r&f`K(ABD|Y^0|TRLla&zF@ZPvGg!9&1Y1uhZ z%BGQlB{NN;BSVEVK~I{njW$oO)U>-$30UP@<}0pkQTzAjnNVd}udr6UR?EfPR=+^` zVjcoqVNd}AN}PoaDkaIMz2m^=LfGrdPf6)|CRiqR=Of^)!0)Mh&B*Sm<;lp8giMLU zYs03JZj7yPBsVeR6Q*v{Qz8++uPA3fFgiW6GjeZhg3xWq)}(bQOt z^2!(WGu{-?7~Vd>%zB&fKK`&$@S4`|*waf@=!2QuiE8&9Q0l%iowzL-*w@F%&HY?S zAr-f-yayr$eGe??wOy(4QZdrg)6+0FFO8j4++#ydog>|qA~waA>q7rG1zol$8xsE* z#Psom-vo*Z=6IT9SF%M+MDt)O;I?UPGTvevsP~m zYS_FgaCuLro!>jV1*J_Y+j})r;;x1?3+be(HFxk-B!Bv$w)(1?aeeHH^a4vIC!%F2 z5PwiWl$B)_Xx%R;B*b&&I&_dF+R72s{xh36TbjLx8*xjo1s>>cH?h;vM#@}a3}0zt zU<)2)>&XX=p<4Kx1^2V~Ivra<3QCh^`NzYm$f1Y#nTG0NhKEp^pK|K&Wf&-gI4uSx zp`7|~y(*!Rrc>Wfkc;T4g28J;s6p7sqEAsIN?FE&iQCZ_O9kTkaKC!r^GgI@Dv^Ok z8j1QudCrRzp>S7f4h+49W!LQ1MO6W}>Ss=y<_W(&yxL=Di$H}KLO>XO(sb73$*Rge zrO6Yj7(a`hZlAu=XExtwf5{IOpHA0gn1Snx&gBp`-Dz-%BmNA2xo4FzWl(s)=JVxX zpEp7y3H|%8^w@|(`MGL=3uVJD+C3)U0%f84W*$dw413O3w~10#dJq3^oMnJdoD^eG z8_Oi)I39@UT(X@9G7sm-`&Zud@&xvmkGI3VArM0QnU#tl>AeCXb~wmn^_Onu{6kls zBihC!Xn+tf!(!HDJv>|7mn#uGMN5Hs5=Lyw3*vgd)ENXw!;vOY3q2!zGoWBFx)V^C zLx45eq+^D^u6d%_5ucN@6(Q1w9v~~+X~V|Cnqj1))0N$ym#ktJ76uXff+GEyX=&U2 z{++Mr%ZAb&TILVW;ZE*K9U08t2p$UWgN9x^atl2JwJ0emgAtg1>o9U2R^06Nfv^vX z2qYOB2CdzL>Ccay8?=7zZHGiefn7*I-Z~zEqTiccA%jC>$m+u{`n#wxV!-&dcE+e@8An#`HNpVik)mhiE3-$wV>>3tI-OFAu82X9WZ1(qj$&gK7Vryqs>s&DA4 za$?+21~r}G36~`ZTkmpMMt9vpqy1f2xGQ;)!nIc65vtWsG}%KPayUiv5; z>rYXQN*dun6xVy(B z!!zSc8}j)^>(3@BEJ5_M4CF@3_;0P?-QE{sa(CmJgbQf6yMFfFRs&;ZCP=s4c~22@ zM?+5!xP1Aisd&B~aJ#s?40x0z+mY94ze`U~?-^0dWqy3^N@{$#Pe?#^Kei9-i*B^# z=`+8+CMA7OFJP9ImKIj{=T!dOhP&?cjbCY2D!(JEKwrY-$h1daXX@LohMY)slz9@Jxz~HcA&eNN4peG@MDkjdKnwnZqHZFcRLsNYzg_iU)eCfx+#i>_xH`ME1D zh725XNE2?!MU@%J67-KFS6`>%XZKM6Bze*8HD#X&)M^=NQ>F8|*nKd|IK<;NDMa@V zAxM@?0>p7A>Y$oEqEepB-2sf%q)2<>q5M0xq7MVE#~pfVa1&Gdz7uvI5p)4O+|W<( zm1+|0B@h<+il!9S0T6~BqyeRc0OeH_8=~nH6FH7Maz_#y>>aJ-@w*I4B*Tr^ow$T1 zD=C-2+8>l8kcBN_O>;Cjv#N*5n-ByTLQw)^rNwG@ z9JQq)<0AkMz&;t5XpM7Wu-*5yl%NEhPtuZC9lhjEN0imyiJBHo`fk)VcWj7P*zSpTd8(L`a4vcWN8Ck$w{FYhcCx9Vi11KDQW`YXA@VX5 zzJLwB+;e6{W#u5($uv3!36Y8`7UXWza`HonEtP{i=?d1mP(TfaDVdhsVb?GD3=ilb ze7{xH`lC?j$8e_N*tOzGmNsqHa+Fr)!y=5LAaOKdG7%iNBP;;a+ZoY4dsrmz97?qK~O)K9$?EEQ|$$ku20^G7o-^p@s zcds#5(<4{bg^9GxJ*OKvG}M0bIU!s=iS#~!y&_k+OlA7qH>kr-)(JWP66 zj8*jYH)VUN4E)W_%`Xy&_>1J-Ev>8yF|e@G4OCU{@XKQhxt)v(W-K9pbF(Hj>cf=; z*IZiA&zOs7|FvngZhV`WA^^9wT8gD|Hf=GZvyh0Nz}L1Ap)CuoP}NdpDK+z z%-5bc@3K&sj37eku=PXbfT*b&|7F!rin3yGkOw!O_g^Y93;fMilY!7KNs+T(8AnCL#ZKr0Ei9T-M@ey_X{^apSv*#=dFpVyjiG>iUFS~NDEgM zZN*;(GDB#p>6e??v3(TE8V&xx7G5h zYbL+ku0&2|cj~k22`aMbkQW0S1?KJ}#^$V~vY(r=@3iU@{>mZMBn*0R%6U{MiNq&P z_n#HEKFKPbu|cD!$h0SoI(16g0(rViHT&Dlv@{b@=5*+9Q_T$;bQY8IU?O`%jZor* zCTNYPk*6JM_$ji|zwj;`E78ri+5+C5`kpXADw>)r`o}M-rBVS-_lFbPao(x4y*clj zY{a=(k4#xWJw#n__dYnZW@oXI$}PudWmV*(!a0EHG`9&}niIrPB=~?sNqsCv1g}t( zq`)hr9~n~OVaz6Om7hljwansxNPQYj*dUpiW4{O-)_0^YQ!u0WKB zz^zQ`sLutjA^unh5}%?N77%O|{(8RO16& zmOVwVT@0m-GX_NRqo@*Z@}FymIc`~SWBe{g`@3ZwMgTvD3SJTsrsN-S*ICZHySoMb zR{M^HGk2x}4x7c9?Cfk(xpj=o0XZ)c(OJ^hZ;iBR@R&-rNSUK~Od6jmXG5|jVYO?N zg3rmlif4(s{#n2wxfkknlorJ3%OteX=>Esky~;ru$hr-9vIm03mv=>Hffw9E+NT#3 zrW3Ope(*JBa;E+NuGv#1@3W5!+X(^O^cQQxLea0r11aC}M^Lt-$J{766t-;l805Su zSTL8h-K~$058hBD%2;UBgN~ypv9wndFpA1z235gPdk8`c3OmVQ41G4hKGHe3-mt}Z z800o_l0*`Ad(!ET-zvFhF0_r{mA!8r|k^DRS#`-jeq>1MoG z1d!Ju^sm3`jN)HwVSjOPHjLRW`5;FgWS^d%W<5Q5u6qf6hmh*t7HgAP&GRX@EBZJI z+}~UN)LMx%WfPbV>{O_~)%(yv!!_t{7eCGA(aZUqgl!U|LG*Z(!&r44Wlme&+?HI6 z>aPGtest)a5#)b!x7$8-(nS``DDs{aEE>&knNEF1iSbK>&w)lD&Crrq75__gi{6)Q%eZi702$J9>-drv`Uq=L(Z+Fw%w>(gN6*n|Mu zOyrr=7Cgwm2Po5SGK%%YOvx1c%K|W&?@bDoKfB_f8ae*1Z%DwfoY?Rib$Q(ciadNq*03BIkzC+LYL@}ry!Si5+1hNIEtq z#@U}Vwx9t8wYIkh}r~f}BxJ3Ij%`Fe~c?rUqtdni4WnCesq0NlyWAA&%+jL-~^A!96b{Q z>k#5tG!bh@KfAMcCQV%)vd^VHhb1PtEUf2cSooaRcNi2&Lo&A;oFYv>OOQ~tkQfyl z5;jUsGXQfe&4<_I)+B;uXZXxAGT= zCUnQkTEyH~-Ad{DRu}Mt_Fa*0I;UHocke1E3lA+w zy%xG_$sig#Iym~`kCbfPe7(H9419cEN#HJ0Wuq2!s2h8l{`kvac40JdL?nc%5!VGPImDFX4gVPiwj;MKHQ{$fNe-0>W95iJxuddF6;J>*7RN>p@! zO+a2wE@Mf6MA~)Ym2zFMe*xJodq9+i(}8kkn}>p~LQfAA58(F6jYwoj39D~}S6eGM znWa!5W>G<@X|xI)>%193i&?s(*t~xKQoMqccgnvs56bBl(cA)4C^!ZZ&W+_4-&4UA zwDfo{1#^@NPAqLZJ7AsBW;C*34E;8)o_3!eANx1B5&$_(Ho)Ee-#AQaFLOTLxCi?yohh8%SivA7QF;1&aI)#q)*eJ2%7Yigjp5dPaIsbNh2aJnAT`~aJq}qSkaXE(G~P%iv47iO`y`j9<{un&(D z;YqcX$pqxg=sPiT{lTnnJF-od4R>>6#r}O$a z>RoMxH{GxYi<(JM_mSr1L{xN({MY)hqc5->4ccf{nG3Clkj#K@WGwE?Jis$y1ai?c?K zm$+Apfcg5DB!?&X01H)pEOs44>4`vRLDmSa@m|CVL=t1}#i^M>VG!cam7Kxxuym=b zcI|pNp)@MSKwwjZAin&%^XtrJ8KiD@3`-pegF2Z+pH*LiYB>O&);~COBeebZI-{q7PcGSQD69#_bgu`S&i==jR zrTXc_6PM5y)&n&w!iZHtq<&Ca;Qam%spH{|Sy(HKeD(K!J4fzqp(Wb6q1@j=nVFA2 z+@6E<#t|HhcTL)Jjn~R~_BK=J`tHRrj zK=>WxUs|i|UBRhRkV~+Pdu25KVJpz95;Mffau7B_j_BQRVJ9exf^Fw0?}9knX)SS$ zouM5y&N|NGFwBdQr8k%~LH=glqQ@RJ&Pm}&{zCCWNLJwOdk@>q)N;HLYsjo|fO|#F;U)^a?jx6u%_g#k{vwlq9_))3&ABX>3{+ zxXu3wQ~rsz=!$Zj)$k`gzut2h(42>Y5n%h(~SsyTul!soCEpn|T4g~M` zE26DM{8NC;1oJ+ady*{cQUgNDW?yjkv`OgRqC}YMy0rU*eO-DIWz)i6Ncx9`MLxgF z{_yoz^PpT^Q?saq|CQ+s-A-nEv`@W~xLkF6rj6FAFj8O8SQ8LB6j)~Cv15;Fe{+W+Wnu0O+h2@qVXU->2jKECw0(AUu$bCFs=gnGQq+ z!Hx{(0Z9J+>LQJI9oDve%>?X)Mdf6T`u)9qf775snYPPjweUGOV2LU^=0w(%M@F_* zz(3dT3DdEg`h3@FH!q{Cy|6-xxuPF*h21))Wl8ddn zdg{~6=J4=v<`)ckt(Zp%n`A4C=0y(eWggrjMJF_ndY<%_8z`R;?U3%mo+B0Co~0$c+cQIaCt3M z=W(5L`5j4`rz>4~W1Zdnk?3Y-dMN1rW!Qp)n)(uz7412?OZBT^YODv!Xz`z5+XjO+ zX^%1OMOF8Y;?3tutr*Oy&0ZJgpj|C>BWoLfW=WU6PlmS)tDEO(?>O-F5$=pCkm;`b zw-$_PSOcaDPrsu@<4&uPs@@T>`yJDIp2TyggJR?t=F+hnAC?V3AkUZ+&UrpMb$Kru z&mgkLFxlhMD3@cY*9Y+5i7YwIT>uptuMjP(z&zqYa%Sf9=of~r@D?a|*x1~x-)gd& zQ_8uz`$Oo{DxM0f(-)*jjw$$xA5r+anDJ_0l zt&^~Ali^e3o1|a$^;iGKfIGe*CcF&bGpP5Wv1f9JqO8Ik2|w^dD&%7d})~Wl>S^YcL;!)5xXyN*yywuc>zqePb@uL8t+93nJUkFCu0r zHOq`*1U``W1&ut?o;JRut$#Mm80}ra`5dlP53B~1yMd3jV&FPuUNan2B336n zt~(_sBbB$L8$Qhe(WF~4{(U1Q%V(S_d?vOfm zZ*XHrXcQrfB4?c9#qHh@K@_-wzPkEDXR(~mFD)bO1(?7va(A)QzxGB4%HFc4d7Eq1 z8{0R)(JQJT&ge0I&lh!P7C*|dDT0vTUv>JI{3){Cqlj=?+Yb>=?=%9pr%|!s)Y^C8 zRaFF+UBp^1!#her_v&K8KM%~oTHQ{3uN$4x3o9e^oOMp61)BA*ze;;zB_8nY_osFM zh7fjVRlKJsYM3=iwfipl6j_h{&LpYREKD(j%OC+jwng~t8?tn6CmwH3yF=aa@i97_ z9V)BKHBuNDKXMmyKDQI`qeq8&$i3SS2y)j)Kisu#df)ogmyTH-smW6?$JZlXD^ZCZ zrpKwEh`hq6?qoDhjgK9dgHcV4VwlmP6N0&0dF%iyTgkzd;G#WP!-|%yr6hOoEb-sY zZ13e86mRD4O2vgToO7%9xGi^#I$ft137Y(*-$wV^8%^yu0CjS$u=#&@qTw#d#keyT z1_D?zwlBnn!QlebT@;AXIz91Fqh}%u|0yMN6Zo`0xT?;0*!_LT6^Vm_E}=BKf@O-n z6iz?l`nkaDUgg>0JwFr-rm`SfPpCp(we+Jvy9c8NHyB%q#;FYgETCF0u{#~UOgX72F_u7tfKNbh^XS{tq2K1%!}2u- zo-^pfAvq+oEUxuhURlYPXsQ7?@l%NXoS!RV5CavV{xxAe7Ir_KU;nD~#mDs}@AyrB z`hq|bVx8EIe*B513`0xCYHDo!GHBSb?`gQOKi4FahM{C~;R4?1(vvBmZ~VoC)tGOD zY%zemfu(K;0mtfMX$LsK&N$40zDZBiD8?=-itG;@%ys zV35f7R$R*mK2B`yVObYR^hg6;M>M|YK_r}Zg*_Iph7&Qn+VDyE*)*ruQE(q3vA#j* z{4;bQG25q?+RvXq3V22s+I}7)Zp{SWes@b_9(E{|kp_OMPYEswp#m8%s3Z1b(ROlw z=sE#M`zRjY;G2Oox*JKy* zKRKp{mB{u7czybpNK1CqDV~$;Hd7rh`6m3sF1! zh0Vcwb6eY3Hp2Js-)AV(Ps572Dt7S##9c0}C0~MQcZKib2mf&_h|x4N1w!M*zTkCJ zCGejVItltCoQx>ELZ6MDw&yQ-HD=-jK;0DZl#Ldo7P~u*F}|7WuV8_WvOgo{_p*TTEr_4d=H^Nfl?#WwW0c6<_F^1iC(5 zq64X@?(1a3E$;~67N*F~Z#LU*w7-lp?V(XyU$^ng<7*PGoih7IzR%^j^}9e#&x7 z24VOp_%1Fk21c+Y1)~Ce@oz4~EvQG`BR8)Cr%^G-SkjEM-+n6{v2G}SELf`duF0EA zAz(9tHLX$(nyYB{U6DeA=w#h8lQ<%kxhoxax?j^pkHevCwJ3a9(}d#x7u=^w{@pnr z)@(gb*N(PDJsiIkK#^|_JJci4?h z%bk6$<$5mP)TZ+jP5ME;b!_a-!o8km zp7LdlUk=vNUzb)Lo>9d44ERX4ddVgFCM}y}ZJ?$RWp?|OE9d*f>GQ?dE7M`$LK6}a zJZK{&Ui@T@`w+tT95y&EM+y~&3zQW8l2;RR?Jld9=H~Y#%W7T@KPxl-g!{DAf;Vc`$l5q< zDULWaAbqQkCn8&rxIs|n)3+sbNdDZc2an~1*w+jzW;8xZCLc~)jVQLbe*u3yt!p6A z_BDZKI_|Rj$X(gNW$R2Ha8AO|^!G6hKcJ1!rArB`PwZrz*yNIZJvrJaWKWyw-T`IW zr@;0ZR2ogNY63}@PnCc2M3a*NQutf*lzrA)bnZmWxfk+(Iq1Y_%&L_=Sn@6nGP|oA zWA|1EkGz2)*_7yMiM2e_mZOp~K1iKE92-m8tQqj?H8Av$t}<^~60TJ4--Zq|M+u}L zkx`!Y>mZvE0ub18T+DccEeJxNFvND%+u%NY`TN_F#}u9U)xtl&lN@m6FV{OnG%8{N zGmJ2vr|hCgs2}-Jx&TZeKD+{7tmg*_8qjQ8wM`tI*}&HqXkZ4ILEMyJQq~_Y$_`{z zq+Aa`mz9;RpZijx6cK3W$@J_S2gK7torIJfNBh{orxe6YXjD@ia73l!WY`T#cPucl z1?=EynK|R}Bz+jRzV68RsHERLLQKXxjWp%R*{yxR@{sr~BO7xteL!8xco$UsxqQ!Q zKuD_m>Ds9tU=}xC3h5*8AVU+UdUd=qPm}WUNUnbFVZb6{xqziL0W(fYqMxVE&Zbd6P&zms{xi5-o_#w5Pt`^oT_?~ z)3q(qP_tW2#`)-2UteE~8Yc@G z!{6A$4xk#I=S$c_uTj|~UaT(R4ngwP#mcl}Vy4|kWb6AAX{X+PgN>xqN0(2f@TUeA zsZhlxp{CDtbWkUfGQ-)N^DizE%c}T{6XOsM^+)ys{!~NO`cYO#vWw zL3?IC^j3r?hD!XSH@hK~E?1W?(;`c$AN2VMV`LlrZmnG%@ ftpK7e5M&7xZzzSr>iw6c6HHc8Nuo~7B=mm(*gh~g diff --git a/config.php b/config.php index a465b10d..4b642286 100644 --- a/config.php +++ b/config.php @@ -1,15 +1,15 @@ . +***********************************************************************/ + //-------------------------------------------------- // User configurable variables //--------------------------------------------------- @@ -24,6 +24,14 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_ $debug = 1; $show_sql = 0; $go_debug = 0; + $pdf_debug = 0; + // set $sql_trail to 1 only if you want to perform bugtracking sql trail + // Warning: this produces huge amount of data in sql_trail table. + // Don't forget switch the option off and flush the table manually after + // trail, or your future backup files are overloaded with unneeded data. + // + $sql_trail = 0; // save all sql queries in sql_trail + $select_trail = 0; // track also SELECT queries if ($go_debug == 1) { error_reporting(E_ALL); @@ -38,7 +46,7 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_ // Main Title $app_title = "FrontAccounting"; // application version - $version = "2.0.7"; + $version = "2.1.0 RC"; // Build for development purposes $build_version = date("d.m.Y", filemtime("$path_to_root/CHANGELOG.txt")); @@ -151,22 +159,9 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_ array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,20), ); - /* - System tabs. This variable should be in future included from separate file for extended module manager - */ - $applications = array ( - 'orders' => _("Sales"), - 'AP'=>_("Purchases"), - 'stock'=> _("Items and Inventory"), - 'manuf'=> _("Manufacturing"), - 'proj'=>_("Dimensions"), - 'GL'=>_("Banking and General Ledger"), - 'system'=>_("Setup") - ); /* default start-up tab (orders/AP/stock/manuf/proj/GL/system) */ $def_app = "orders"; - //MySQL Backup and Restore Settings if(isset($_SESSION["wa_current_user"])) { @@ -179,4 +174,24 @@ if(isset($_SESSION["wa_current_user"])) { // additional js source included in header $js_lib = $js_userlib = array(); +if (!defined('ICON_EDIT')) +{ + define("ICON_EDIT", "edit.gif"); + define("ICON_DELETE", "delete.gif"); + define("ICON_ADD", "ok.gif"); + define("ICON_UPDATE", "ok.gif"); + define("ICON_OK", "ok.gif"); + define("ICON_CANCEL", "cancel.png"); + define("ICON_GL", "gl.png"); + define("ICON_PRINT", "print.png"); + define("ICON_PDF", "pdf.gif"); + define("ICON_DOC", "invoice.gif"); + define("ICON_CREDIT", "credit.gif"); + define("ICON_RECEIVE", "receive.gif"); + define("ICON_DOWN", "download.gif"); + define("ICON_MONEY", "money.png"); + define("ICON_REMOVE", "remove.png"); + define("ICON_REPORT", "report.png"); + define("ICON_VIEW", "view.gif"); +} ?> \ No newline at end of file diff --git a/dimensions/dimension_entry.php b/dimensions/dimension_entry.php index bf6fe3ee..9014f22a 100644 --- a/dimensions/dimension_entry.php +++ b/dimensions/dimension_entry.php @@ -1,6 +1,14 @@ . +***********************************************************************/ $page_security = 10; $path_to_root=".."; include_once($path_to_root . "/includes/session.inc"); @@ -76,9 +84,9 @@ function safe_exit() { global $path_to_root; - hyperlink_no_params("", _("Enter a new dimension")); + hyperlink_no_params("", _("Enter a &new dimension")); echo "
"; - hyperlink_no_params($path_to_root . "/dimensions/inquiry/search_dimensions.php", _("Select an existing dimension")); + hyperlink_no_params($path_to_root . "/dimensions/inquiry/search_dimensions.php", _("&Select an existing dimension")); display_footer_exit(); } diff --git a/dimensions/includes/dimensions_db.inc b/dimensions/includes/dimensions_db.inc index d0299b66..2dfe6838 100644 --- a/dimensions/includes/dimensions_db.inc +++ b/dimensions/includes/dimensions_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ function add_dimension($reference, $name, $type_, $date_, $due_date, $memo_) { begin_transaction(); diff --git a/dimensions/includes/dimensions_ui.inc b/dimensions/includes/dimensions_ui.inc index ae69b98b..6ac85524 100644 --- a/dimensions/includes/dimensions_ui.inc +++ b/dimensions/includes/dimensions_ui.inc @@ -1,71 +1,65 @@ . +***********************************************************************/ include_once($path_to_root . "/includes/ui.inc"); //-------------------------------------------------------------------------------------- -function display_dimension_payments($id) +function display_dimension_balance($id, $from, $to) { global $path_to_root, $table_style; - $sql = "SELECT ".TB_PREF."gl_trans.*,".TB_PREF."chart_master.account_name FROM + $from = date2sql($from); + $to = date2sql($to); + $sql = "SELECT account, ".TB_PREF."chart_master.account_name, sum(amount) AS amt FROM ".TB_PREF."gl_trans,".TB_PREF."chart_master WHERE ".TB_PREF."gl_trans.account = ".TB_PREF."chart_master.account_code AND - (dimension_id = $id OR dimension2_id = $id) ORDER BY account,tran_date"; + (dimension_id = $id OR dimension2_id = $id) AND + tran_date >= '$from' AND tran_date <= '$to' GROUP BY account"; $result = db_query($sql, "Transactions could not be calculated"); - echo "
"; - if (db_num_rows($result) == 0) { - display_note(_("There are no transactions for this dimension.")); + display_note(_("There are no transactions for this dimension for the selected period.")); } else { - display_heading2(_("Transactions for this Dimension")); + display_heading2(_("Balance for this Dimension")); + br(); start_table($table_style); - $th = array(_("Type"), _("#"), _("Account"), - _("Date"), _("Debit"), _("Credit")); + $th = array(_("Account"), _("Debit"), _("Credit")); table_header($th); - $total = $grand_total = $k = 0; - $account = ""; + $total = $k = 0; while ($myrow = db_fetch($result)) { - if ($account != $myrow["account"]) - { - if ($account != "") - { - start_row(); - label_cell(_("Total"), "colspan=4"); - display_debit_or_credit_cells($total); - end_row(); - $total = 0; - } - $account = $myrow["account"]; - } - alt_table_row_color($k); - label_cell(systypes::name($myrow["type"])); - label_cell(get_gl_view_str($myrow["type"], $myrow["type_no"], $myrow["type_no"], true)); label_cell($myrow["account"]." ".$myrow['account_name']); - label_cell(sql2date($myrow["tran_date"])); - display_debit_or_credit_cells($myrow["amount"]); - - $total += $myrow["amount"]; - $grand_total += $myrow["amount"]; - + display_debit_or_credit_cells($myrow["amt"]); + $total += $myrow["amt"]; end_row(); } start_row(); - label_cell(_("Total"), "colspan=4"); - display_debit_or_credit_cells($total); - end_row(); - - start_row(); - label_cell(_("Grand Total"), "colspan=4"); - display_debit_or_credit_cells($grand_total); + label_cell(""._("Balance").""); + if ($total >= 0) + { + amount_cell($total, true); + label_cell(""); + } + else + { + label_cell(""); + amount_cell(abs($total), true); + } end_row(); end_table(); diff --git a/dimensions/inquiry/search_dimensions.php b/dimensions/inquiry/search_dimensions.php index 6f689ec9..67bffa5e 100644 --- a/dimensions/inquiry/search_dimensions.php +++ b/dimensions/inquiry/search_dimensions.php @@ -1,8 +1,18 @@ . +***********************************************************************/ $page_security = 2; $path_to_root="../.."; +include($path_to_root . "/includes/db_pager.inc"); include_once($path_to_root . "/includes/session.inc"); include_once($path_to_root . "/includes/date_functions.inc"); @@ -43,7 +53,6 @@ if (get_post('SearchOrders')) // $Ajax->addFocus(true, 'OrderNumber'); set_focus('OrderNumber'); } else -// $Ajax->addFocus(true, 'StockLocation'); set_focus('type_'); $Ajax->activate('dim_table'); @@ -85,7 +94,48 @@ end_form(); $dim = get_company_pref('use_dimension'); -$sql = "SELECT * FROM ".TB_PREF."dimensions WHERE id > 0"; +function view_link($row) +{ + return get_dimensions_trans_view_str(systypes::dimension(), $row["id"]); +} + +function is_closed($row) +{ + return $row['closed'] ? _('Yes') : _('No'); +} + +function sum_dimension($row) +{ + $sql = "SELECT SUM(amount) FROM ".TB_PREF."gl_trans WHERE tran_date >= '" . + date2sql($_POST['FromDate']) . "' AND + tran_date <= '" . date2sql($_POST['ToDate']) . "' AND (dimension_id = " . + $row['id']." OR dimension2_id = " .$row['id'].")"; + $res = db_query($sql, "Sum of transactions could not be calculated"); + $row = db_fetch_row($res); + + return $row[0]; +} + +function is_overdue($row) +{ + return date_diff(Today(), sql2date($row["due_date"]), "d") > 0; +} + +function edit_link($row) +{ + return $row["closed"] ? '' : + pager_link(_("Edit"), + "/dimensions/dimension_entry.php?trans_no=" . $row["id"], ICON_EDIT); +} + +$sql = "SELECT dim.id, + dim.reference, + dim.name, + dim.type_, + dim.date_, + dim.due_date, + dim.closed + FROM ".TB_PREF."dimensions as dim WHERE id > 0"; if (isset($_POST['OrderNumber']) && $_POST['OrderNumber'] != "") { @@ -115,80 +165,36 @@ if (isset($_POST['OrderNumber']) && $_POST['OrderNumber'] != "") $sql .= " AND date_ >= '" . date2sql($_POST['FromDate']) . "' AND date_ <= '" . date2sql($_POST['ToDate']) . "'"; } -$sql .= " ORDER BY due_date"; - -$result = db_query($sql,"could not query dimensions"); - -div_start('dim_table'); -start_table("$table_style width=80%"); -if (!$outstanding_only) - $th = array(_("#"), _("Reference"), _("Name"), _("Type"), _("Date"), - _("Due Date"), _("Closed"), _("Balance")); -else - $th = array(_("#"), _("Reference"), _("Name"), _("Type"), _("Date"), - _("Due Date"), _("Balance")); -table_header($th); -$j = 1; -$k = 0; - -while ($myrow = db_fetch($result)) -{ - $sql = "SELECT SUM(amount) FROM ".TB_PREF."gl_trans WHERE tran_date >= '" . - date2sql($_POST['FromDate']) . "' AND - tran_date <= '" . date2sql($_POST['ToDate']) . "' AND (dimension_id = " . - $myrow['id']." OR dimension2_id = " .$myrow['id'].")"; - $res = db_query($sql, "Transactions could not be calculated"); - $row = db_fetch_row($res); - - if ($k == 1) - { - $row_text = "class='oddrow'"; - $k = 0; - } - else - { - $row_text = "class='evenrow'"; - $k++; - } - - // check if it's an overdue work order - if (date_diff(Today(), sql2date($myrow["due_date"]), "d") > 0) - { - $row_text = "class='overduebg'"; - } - - start_row($row_text); - - $mpage = $path_to_root . "/dimensions/dimension_entry.php?" . SID . "trans_no=" . $myrow["id"]; - - label_cell(get_dimensions_trans_view_str(systypes::dimension(), $myrow["id"])); - label_cell(get_dimensions_trans_view_str(systypes::dimension(), $myrow["id"], $myrow["reference"])); - label_cell($myrow["name"]); - label_cell($myrow["type_"]); - label_cell(sql2date($myrow["date_"])); - label_cell(sql2date($myrow["due_date"])); - if (!$outstanding_only) - label_cell(($myrow["closed"] ? _("Yes") : _("No"))); - amount_cell($row[0]); +$cols = array( + _("#") => array('fun'=>'view_link'), + _("Reference"), + _("Name"), + _("Type"), + _("Date") =>'date', + _("Due Date") => array('name'=>'due_date', 'date', 'ord'=>'asc'), + _("Closed") => array('fun'=>'is_closed'), + _("Balance") => array('type'=>'amount', 'insert'=>true, 'fun'=>'sum_dimension'), + array('insert'=>true, 'fun'=>'edit_link') +); + +if ($outstanding_only) { + $cols[_("Closed")] = 'skip'; +} - label_cell($myrow["closed"] == 0 ? ("" . _("Edit") . "") :''); - end_row(); +$table =& new_db_pager('dim_tbl', $sql, $cols); +$table->set_marker('is_overdue', _("Marked dimensions are overdue.")); - $j++; - If ($j == 12) - { - $j = 1; - table_header($th); - } - //end of page full new headings if +if (get_post('SearchOrders')) { + $table->set_sql($sql); + $table->set_columns($cols); } -//end of while loop +$table->width = "80%"; +start_form(); -end_table(1); -div_end(); -//--------------------------------------------------------------------------------- +display_db_pager($table); +end_form(); end_page(); ?> diff --git a/dimensions/view/view_dimension.php b/dimensions/view/view_dimension.php index 843da185..a8ad64d1 100644 --- a/dimensions/view/view_dimension.php +++ b/dimensions/view/view_dimension.php @@ -1,13 +1,22 @@ . +***********************************************************************/ $page_security = 10; $path_to_root="../.."; include_once($path_to_root . "/includes/session.inc"); $js = ""; -if ($use_popup_windows) - $js .= get_js_open_window(800, 500); +if ($use_date_picker) + $js .= get_js_date_picker(); page(_("View Dimension"), true, false, "", $js); include_once($path_to_root . "/includes/date_functions.inc"); @@ -18,11 +27,17 @@ include_once($path_to_root . "/dimensions/includes/dimensions_ui.inc"); //------------------------------------------------------------------------------------------------- -if ($_GET['trans_no'] != "") +if (isset($_GET['trans_no']) && $_GET['trans_no'] != "") { $id = $_GET['trans_no']; } +if (isset($_POST['Show'])) +{ + $id = $_POST['trans_no']; +} + + display_heading(systypes::name(systypes::dimension()) . " # " . $id); br(1); @@ -30,7 +45,7 @@ $myrow = get_dimension($id); if (strlen($myrow[0]) == 0) { - echo _("The work order number sent is not valid."); + echo _("The dimension number sent is not valid."); exit; } @@ -57,7 +72,26 @@ if ($myrow["closed"] == true) display_note(_("This dimension is closed.")); } -display_dimension_payments($id); +start_form(); + +start_table("class='tablestyle_noborder'"); +start_row(); + +if (!isset($_POST['TransFromDate'])) + $_POST['TransFromDate'] = begin_fiscalyear(); +if (!isset($_POST['TransToDate'])) + $_POST['TransToDate'] = Today(); +date_cells(_("from:"), 'TransFromDate'); +date_cells(_("to:"), 'TransToDate'); +submit_cells('Show',_("Show")); + +end_row(); + +end_table(); +hidden('trans_no', $id); +end_form(); + +display_dimension_balance($id, $_POST['TransFromDate'], $_POST['TransToDate']); br(1); diff --git a/frontaccounting.php b/frontaccounting.php index 6f3ad333..7e220188 100644 --- a/frontaccounting.php +++ b/frontaccounting.php @@ -1,14 +1,34 @@ . +***********************************************************************/ +if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_to_root'])) + die("Restricted access"); + include_once($path_to_root . '/applications/application.php'); + include_once($path_to_root . '/applications/customers.php'); + include_once($path_to_root . '/applications/suppliers.php'); + include_once($path_to_root . '/applications/inventory.php'); + include_once($path_to_root . '/applications/manufacturing.php'); + include_once($path_to_root . '/applications/dimensions.php'); + include_once($path_to_root . '/applications/generalledger.php'); + include_once($path_to_root . '/applications/setup.php'); + include_once($path_to_root . '/installed_extensions.php'); + if (count($installed_extensions) > 0) + { + foreach ($installed_extensions as $ext) + { + include_once($path_to_root."/".$ext['folder']."/".$ext['app_file']); + } + } + + include_once($path_to_root . '/modules/installed_modules.php'); class front_accounting { @@ -23,7 +43,7 @@ { //$this->renderer =& new renderer(); } - function add_application($app) + function add_application(&$app) { $this->applications[$app->id] = &$app; } @@ -54,7 +74,8 @@ $rend->wa_footer(); } function init() - { + { + global $installed_extensions, $path_to_root; $this->menu = new menu(_("Main Menu")); $this->menu->add_item(_("Main Menu"), "index.php"); $this->menu->add_item(_("Logout"), "/account/access/logout.php"); @@ -65,6 +86,19 @@ $this->add_application(new manufacturing_app()); $this->add_application(new dimensions_app()); $this->add_application(new general_ledger_app()); + if (count($installed_extensions) > 0) + { + foreach ($installed_extensions as $ext) + { + get_text::add_domain($_SESSION['language']->code, + $ext['folder']."/lang"); + $class = $ext['name']."_app"; + $this->add_application(new $class()); + get_text::add_domain($_SESSION['language']->code, + $path_to_root."/lang"); + } + } + $this->add_application(new setup_app()); } } diff --git a/gl/bank_transfer.php b/gl/bank_transfer.php index 78089f5a..c390f7a0 100644 --- a/gl/bank_transfer.php +++ b/gl/bank_transfer.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $path_to_root=".."; $page_security = 5; @@ -19,7 +28,6 @@ if ($use_date_picker) page(_("Transfer between Bank Accounts"), false, false, "", $js); check_db_has_bank_accounts(_("There are no bank accounts defined in the system.")); -check_db_has_bank_trans_types(_("There are no bank transfer types defined in the system.")); //---------------------------------------------------------------------------------------- @@ -30,9 +38,9 @@ if (isset($_GET['AddedID'])) display_notification_centered( _("Transfer has been entered")); - display_note(get_gl_view_str($trans_type, $trans_no, _("View the GL Journal Entries for this Transfer"))); + display_note(get_gl_view_str($trans_type, $trans_no, _("&View the GL Journal Entries for this Transfer"))); - hyperlink_no_params($_SERVER['PHP_SELF'], _("Enter Another Transfer")); + hyperlink_no_params($_SERVER['PHP_SELF'], _("Enter &Another Transfer")); safeExit(); } @@ -77,8 +85,6 @@ function gl_payment_controls() echo "
\n"; + end_table($breaks); +} + +function vertical_space() +{ + echo "\n"; + echo "\n"; } -function table_header($labels) +function table_header($labels, $params='') { start_row(); foreach ($labels as $label) - labelheader_cell($label); + labelheader_cell($label, $params); end_row(); } - -function edit_link_cell($param, $title=false) -{ - label_cell("" . _("Edit") . "", "nowrap"); -} - -function delete_link_cell($param, $title=false) -{ - label_cell("" . _("Delete") . "", "nowrap"); -} - -function edit_button($name, $value, $title=false) -{ -// php silently changes dots,spaces,'[' and characters 128-159 -// to underscore in POST names, to maintain compatibility with register_globals - echo "'=2E',' '=>'=20','='=>'=3D','['=>'=5B'))) - ."\" value=\"$value\"" - .($title ? " title='$title'":'')." />\n"; -} - -function edit_button_cell($name, $value, $title=false) -{ - echo ""; -} - //----------------------------------------------------------------------------------- function start_row($param="") @@ -304,5 +338,33 @@ function context_reset() if (!isset($_SESSION['Context'])) { context_reset(); } +/* + Redirector for selector F4 calls. + $sel_editors is array of selname=>editor_page +*/ +function editor_redirect($sel_editors, $save_fun='') { + foreach ($sel_editors as $selname=>$editor) + if (isset($_POST['_'.$selname.'_editor'])) { + if (function_exists($save_fun)) + $save_fun(); + unset($_POST['_'.$selname.'_editor']); + context_call($editor, array_keys($_POST)); + } +} +/* + Return procedure for selector F4 calls +*/ +function editor_return($vars, $restore_fun='') { + if (function_exists($restore_fun)) + $restore_fun(); + + if ($ret = context_restore()) { + foreach ($vars as $postname=>$retname) + if (isset($ret[$retname])) { + $_POST[$postname] = $ret[$retname]; + set_focus($postname); + } + } +} ?> \ No newline at end of file diff --git a/includes/ui/ui_globals.inc b/includes/ui/ui_globals.inc index a22c6886..b591f290 100644 --- a/includes/ui/ui_globals.inc +++ b/includes/ui/ui_globals.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ include_once($path_to_root . "/includes/reserved.inc"); function set_global_supplier($supplier_id) diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc index fcc4649c..3da07206 100644 --- a/includes/ui/ui_input.inc +++ b/includes/ui/ui_input.inc @@ -1,4 +1,14 @@ . +***********************************************************************/ function get_post($name, $dflt='') { @@ -71,7 +81,7 @@ function simple_page_mode($numeric_id = true) // function input_num($postname=null, $dflt=null) { - if (!isset($_POST[$postname])) + if (!isset($_POST[$postname]) || $_POST[$postname] == "") return $dflt; return user_numeric($_POST[$postname]); @@ -94,50 +104,45 @@ function hidden($name, $value=null, $echo=true) return $ret; } -//--------------------------------------------------------------------------------- -// Submit button. -// $async parameter can have 3 values: -// null - fallback button not visible in js enabled mode -// false - normal submit via form action -// true - when js is on submition via ajax call -// 'process' - ditto with processing indicator in msgbox -// -function submit($name, $value, $echo=true, $title=false, $async=false) +function submit($name, $value, $echo=true, $title=false, $async=false, $icon=false) { - + global $path_to_root; + default_focus($name); - $submit_str = "\n"; + .">$value" + .($icon ? "" : '') + ."\n"; if ($echo) echo $submit_str; else return $submit_str; } -function submit_center($name, $value, $echo=true, $title=false, $async=false) +function submit_center($name, $value, $echo=true, $title=false, $async=false, $icon=false) { echo "
"; - submit($name, $value, $echo, $title, $async); + submit($name, $value, $echo, $title, $async, $icon); echo "
"; } -function submit_center_first($name, $value, $title=false, $async=false) +function submit_center_first($name, $value, $title=false, $async=false, $icon=false) { echo "
"; - submit($name, $value, true, $title, $async); + submit($name, $value, true, $title, $async, $icon); echo " "; } -function submit_center_last($name, $value, $title=false, $async=false) +function submit_center_last($name, $value, $title=false, $async=false, $icon=false) { echo " "; - submit($name, $value, true, $title, $async); + submit($name, $value, true, $title, $async, $icon); echo "
"; } @@ -198,23 +203,49 @@ function submit_return($name, $value, $title=false, $async=false) submit($name, $value, true, $title, $async); } } -//--------------------------------------------------------------------------------- +//----------------------------------------------------------------------------------- -function button($name, $value, $onclick, $title=false) +function set_icon($icon, $title=false) { - default_focus($name); - echo "\n"; + global $path_to_root; + return "\n"; } -function button_cell($name, $value, $onclick, $title=false) +function button($name, $value, $title=false, $icon=false) +{ + // php silently changes dots,spaces,'[' and characters 128-159 + // to underscore in POST names, to maintain compatibility with register_globals + if (user_graphic_links() && $icon) + { + if ($value == _("Delete")) // Helper during implementation + $icon = ICON_DELETE; + return "
\n"; + echo button($name, $value, $title, $icon); + echo ""; } +function delete_button_cell($name, $value, $title=false) +{ + button_cell($name, $value, $title, ICON_DELETE); +} + +function edit_button_cell($name, $value, $title=false) +{ + button_cell($name, $value, $title, ICON_EDIT); +} //----------------------------------------------------------------------------------- function check_value($name) @@ -224,24 +255,36 @@ function check_value($name) return 1; } -function check($label, $name, $value=null, $submit_on_change=false, $title=false) +function checkbox($label, $name, $value=null, $submit_on_change=false, $title=false) { global $Ajax; + $str = ''; default_focus($name); if ($label) - echo $label . " "; - + $str .= $label . " "; + if ($submit_on_change !== false) { + if ($submit_on_change === true) + $submit_on_change = + "JsHttpRequest.request(\"_{$name}_update\", this.form);"; + } if ($value === null) $value = get_post($name,0); - echo "\n"; + $str .= "\n"; + $Ajax->addUpdate($name, $name, $value); + return $str; +} + +function check($label, $name, $value=null, $submit_on_change=false, $title=false) +{ + echo checkbox($label, $name, $value, $submit_on_change, $title); } function check_cells($label, $name, $value, $submit_on_change=false, $title=false) @@ -249,14 +292,14 @@ function check_cells($label, $name, $value, $submit_on_change=false, $title=fals if ($label != null) echo "\n"; echo ""; } function check_row($label, $name, $value, $submit_on_change=false, $title=false) { echo ""; - check_cells($label, $name, $value, $submit_on_change, $title); + echo check_cells($label, $name, $value, $submit_on_change, $title); echo "\n"; } @@ -281,6 +324,11 @@ function label_cell($label, $params="", $id=null) return $label; } +function email_cell($label, $params="", $id=null) +{ + label_cell("$label", $params, $id); +} + function amount_cell($label, $bold=false, $params="", $id=null) { if ($bold) @@ -299,7 +347,7 @@ function percent_cell($label, $bold=false, $id=null) // 2008-06-15. Changed function qty_cell($label, $bold=false, $dec=null, $id=null) { - if ($dec == null) + if (!isset($dec)) $dec = get_qty_dec(); if ($bold) label_cell("".number_format2($label, $dec)."", "nowrap align=right", $id); @@ -307,17 +355,17 @@ function qty_cell($label, $bold=false, $dec=null, $id=null) label_cell(number_format2($label, $dec), "nowrap align=right", $id); } -function label_cells($label, $value, $params="", $params2="") +function label_cells($label, $value, $params="", $params2="", $id='') { if ($label != null) echo "\n"; - echo "\n"; + label_cell($value, $params2, $id); } -function label_row($label, $value, $params="", $params2="", $leftfill=0) +function label_row($label, $value, $params="", $params2="", $leftfill=0, $id='') { echo ""; - label_cells($label, $value, $params, $params2); + label_cells($label, $value, $params, $params2, $id); if ($leftfill!=0) echo ""; echo "\n"; @@ -397,6 +445,27 @@ function text_row_ex($label, $name, $size, $max=null, $title=null, $value=null, echo "\n"; } +//----------------------------------------------------------------------------------- +function email_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="") +{ + text_row("$label", $name, $value, $size, $max, $title, $params, $post_label); +} + +function email_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null) +{ + text_row_ex("$label", $name, $size, $max, $title, $value, $params, $post_label); +} + +function link_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="") +{ + text_row("$label", $name, $value, $size, $max, $title, $params, $post_label); +} + +function link_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null) +{ + text_row_ex("$label", $name, $size, $max, $title, $value, $params, $post_label); +} + //----------------------------------------------------------------------------------- function date_cells($label, $name, $title = null, $init=null, $inc_days=0, @@ -489,13 +558,17 @@ function amount_cells_ex($label, $name, $size, $max=null, $init=null, $params=nu if (!isset($max)) $max = $size; - echo "\n"; $Ajax->addUpdate($name, $name, $_POST[$name]); $Ajax->addAssign($name, $name, 'dec', $dec); diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index 0ce2546a..87526293 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ include_once($path_to_root . "/includes/banking.inc"); include_once($path_to_root . "/includes/reserved.inc"); include_once($path_to_root . "/includes/types.inc"); @@ -49,7 +58,8 @@ $opts = array( // default options 'search' => array(), // sql field names to search 'format' => null, // format functions for regular options 'disabled' => false, - 'box_hint' => null // box/selectors hints; null = std see below + 'box_hint' => null, // box/selectors hints; null = std see below + 'category' => false // category column name or false ); // ------ merge options with defaults ---------- if($options != null) @@ -121,11 +131,20 @@ $opts = array( // default options } // sql completion if (count($opts['where'])) { - $sql .= strpos($sql, 'WHERE')==false ? ' WHERE ':' AND '; - $sql .= '('. implode($opts['where'], ' AND ') . ')'; + $where = strpos($sql, 'WHERE')==false ? ' WHERE ':' AND '; + $where .= '('. implode($opts['where'], ' AND ') . ')'; + $group_pos = strpos($sql, 'GROUP BY'); + if ($group_pos) { + $group = substr($sql, $group_pos); + $sql = substr($sql, 0, $group_pos) . $where.' '.$group; + } else { + $sql .= $where; + } } if ($opts['order'] != false) { - $sql .= ' ORDER BY '.$opts['order']; + if (!is_array($opts['order'])) + $opts['order'] = array($opts['order']); + $sql .= ' ORDER BY '.implode(',',$opts['order']); } $sql .= $limit; @@ -133,16 +152,14 @@ $opts = array( // default options $selector = $first_opt = ''; $first_id = false; $found = false; -//if($name=='SelectStockFromList') display_error($sql); + $lastcat = null; +//if($name=='stock_id') display_error($sql); if($result = db_query($sql)) { while ($contact_row = db_fetch($result)) { $value = $contact_row[0]; $descr = $opts['format']==null ? $contact_row[1] : call_user_func($opts['format'], $contact_row); $sel = ''; - if (get_post($search_submit) && ($txt === $value)) { - $selected_id = $value; - } if (get_post($search_submit) && ($txt === $value)) { $selected_id = $value; } @@ -154,6 +171,11 @@ $opts = array( // default options $first_id = $value; $first_opt = $descr; } + $cat = $contact_row[$opts['category']]; + if ($opts['category'] !== false && $cat != $lastcat){ + $selector .= "\n"; + $lastcat = $cat; + } $selector .= "\n"; } db_free_result($result); @@ -191,7 +213,7 @@ $opts = array( // default options global $_select_button; // button class selects form reload/ajax selector update $selector .= sprintf($_select_button, $disabled, user_theme(), - (in_ajax() ? 'display:none;':''), + (fallback_mode() ? '' : 'display:none;'), $select_submit)."\n"; } // ------ make combo ---------- @@ -202,12 +224,12 @@ $opts = array( // default options $opts['size']."' maxlength='".$opts['max']. "' value='$txt' class='$class' rel='$name' autocomplete='off' title='" .$opts['box_hint']."'" - .(in_ajax() && !$by_id ? " style=display:none;":'') + .(!fallback_mode() && !$by_id ? " style=display:none;":'') .">\n"; if ($search_submit != false) { global $_search_button; $edit_entry .= sprintf($_search_button, $disabled, user_theme(), - (in_ajax() ? 'display:none;':''), + (fallback_mode() ? '' : 'display:none;'), $search_submit)."\n"; } } @@ -310,7 +332,7 @@ $opts = array( // default options if ($select_submit != false) { // if submit on change is used - add select button global $_select_button; $selector .= sprintf($_select_button, $disabled, user_theme(), - (in_ajax() ? 'display:none;':''), + (fallback_mode() ? '' : 'display:none;'), $select_submit)."\n"; } default_focus($name); @@ -589,22 +611,22 @@ $options = array( } function dimensions_list_cells($label, $name, $selected_id=null, $no_option=false, $showname=null, - $showclosed=false, $showtype=0) + $showclosed=false, $showtype=0, $submit_on_change=false) { if ($label != null) echo "\n"; echo "\n"; return $str; } function dimensions_list_row($label, $name, $selected_id=null, $no_option=false, $showname=null, - $showclosed=false, $showtype=0) + $showclosed=false, $showtype=0, $submit_on_change=false) { echo "\n"; $str = dimensions_list_cells($label, $name, $selected_id, $no_option, $showname, - $showclosed, $showtype); + $showclosed, $showtype, $submit_on_change); echo "\n"; return $str; } @@ -628,14 +650,15 @@ function stock_items_list($name, $selected_id=null, $all_option=false, $submit_o 'search' => array("stock_id", "c.description","s.description"), 'search_submit' => get_company_pref('no_item_list')!=0, 'size'=>10, - 'select_submit'=> $submit_on_change + 'select_submit'=> $submit_on_change, + 'category' => 2, + 'order' => array('c.description','stock_id') ), $opts) ); } function _format_stock_items($row) { - return (user_show_codes() ? ($row[0] . " - ") : "") - . $row[2] . " - " . $row[1]; + return (user_show_codes() ? ($row[0] . " - ") : "") . $row[1]; } function stock_items_list_cells($label, $name, $selected_id=null, $all_option=false, $submit_on_change=false) @@ -655,6 +678,73 @@ function stock_items_list_row($label, $name, $selected_id=null, $all_option=fals return $str; } */ +//--------------------------------------------------------------------------------------------------- +// +// Select item via foreign code. +// +function sales_items_list($name, $selected_id=null, $all_option=false, + $submit_on_change=false, $type='', $opts=array()) +{ + global $all_items; + // all sales codes + $sql = "SELECT i.item_code, i.description, c.description, count(*)>1 as kit + FROM + ".TB_PREF."item_codes i + LEFT JOIN + ".TB_PREF."stock_category c + ON i.category_id=c.category_id"; + + if ($type == 'local') { // exclude foreign codes + $sql .= " WHERE !i.is_foreign"; + } elseif ($type == 'kits') { // sales kits + $sql .= " WHERE !i.is_foreign AND i.item_code!=i.stock_id"; + } + + $sql .= " GROUP BY i.item_code"; + + return combo_input($name, $selected_id, $sql, 'i.item_code', 'c.description', + array_merge( + array( + 'format' => '_format_stock_items', + 'spec_option' => $all_option===true ? _("All Items") : $all_option, + 'spec_id' => $all_items, + 'search_box' => true, + 'search' => array("i.item_code", "c.description"), + 'search_submit' => get_company_pref('no_item_list')!=0, + 'size'=>15, + 'select_submit'=> $submit_on_change, + 'category' => 2, + 'order' => array('c.description','i.item_code') + ), $opts) ); +} + +function sales_items_list_cells($label, $name, $selected_id=null, $all_option=false, $submit_on_change=false) +{ + if ($label != null) + echo "\n"; + $str = sales_items_list($name, $selected_id, $all_option, $submit_on_change, + '', array('cells'=>true)); + return $str; +} + +function sales_kits_list($name, $selected_id=null, $all_option=false, $submit_on_change=false) +{ + $str = sales_items_list($name, $selected_id, $all_option, $submit_on_change, + 'kits', array('cells'=>false)); + return $str; +} + +function sales_local_items_list_row($label, $name, $selected_id=null, $all_option=false, $submit_on_change=false) +{ + echo ""; + if ($label != null) + echo "\n"; + echo ""; + return $str; +} //------------------------------------------------------------------------------------ function base_stock_items_list($where, $name, $selected_id=null, @@ -672,8 +762,8 @@ function base_stock_items_list($where, $name, $selected_id=null, 'spec_option' => $all_option==true ? _("All Items") : $all_option, 'spec_id' => $all_items, 'select_submit'=> $submit_on_change, - 'where' => $where - ) ); + 'where' => $where, + 'category' => 2 ) ); } //------------------------------------------------------------------------------------ @@ -890,26 +980,26 @@ function tax_groups_list($name, $selected_id=null, array( 'order' => 'id', 'spec_option' => $none_option, - 'spec_id' => 0, + 'spec_id' => reserved_words::get_all_numeric(), 'select_submit'=> $submit_on_change, 'async' => false, ) ); } -function tax_groups_list_cells($label, $name, $selected_id=null, $submit_on_change=false) +function tax_groups_list_cells($label, $name, $selected_id=null, $none_option=false, $submit_on_change=false) { if ($label != null) echo "\n"; echo "\n"; return $str; } -function tax_groups_list_row($label, $name, $selected_id=null, $submit_on_change=false) +function tax_groups_list_row($label, $name, $selected_id=null, $none_option=false, $submit_on_change=false) { echo "\n"; - $str = tax_groups_list_cells($label, $name, $selected_id, false, $submit_on_change); + $str = tax_groups_list_cells($label, $name, $selected_id, $none_option, $submit_on_change); echo "\n"; return $str; } @@ -1012,6 +1102,68 @@ function sales_areas_list_row($label, $name, $selected_id=null) //------------------------------------------------------------------------------------ +function sales_groups_list($name, $selected_id=null, $special_option=false) +{ + $sql = "SELECT id, description FROM ".TB_PREF."groups"; + combo_input($name, $selected_id, $sql, 'id', 'description', array( + 'spec_option' => $special_option===true ? ' ' : $special_option, + 'order' => 'description', 'spec_id' => 0, + )); +} + +function sales_groups_list_cells($label, $name, $selected_id=null, $special_option=false) +{ + if ($label != null) + echo "\n"; + echo "\n"; +} + +function sales_groups_list_row($label, $name, $selected_id=null, $special_option=false) +{ + echo "\n"; + sales_groups_list_cells($label, $name, $selected_id, $special_option); + echo "\n"; +} + +//------------------------------------------------------------------------------------ + +function _format_template_items($row) +{ + return ($row[0] . " -  " . _("Amount") . " ".$row[1]); +} + +function templates_list($name, $selected_id=null, $special_option=false) +{ + $sql = "SELECT sorder.order_no, Sum(line.unit_price*line.quantity*(1-line.discount_percent)) AS OrderValue + FROM ".TB_PREF."sales_orders as sorder, ".TB_PREF."sales_order_details as line + WHERE sorder.order_no = line.order_no AND sorder.type = 1 GROUP BY line.order_no"; + combo_input($name, $selected_id, $sql, 'order_no', 'OrderValue', array( + 'format' => '_format_template_items', + 'spec_option' => $special_option===true ? ' ' : $special_option, + 'order' => 'order_no', 'spec_id' => 0, + )); +} + +function templates_list_cells($label, $name, $selected_id=null, $special_option=false) +{ + if ($label != null) + echo "\n"; + echo "\n"; +} + +function templates_list_row($label, $name, $selected_id=null, $special_option=false) +{ + echo "\n"; + templates_list_cells($label, $name, $selected_id, $special_option); + echo "\n"; +} + +//------------------------------------------------------------------------------------ + function workorders_list($name, $selected_id=null) { $sql = "SELECT id, wo_ref FROM ".TB_PREF."workorders WHERE closed=0"; @@ -1140,29 +1292,41 @@ function movement_types_list_row($label, $name, $selected_id=null) } //----------------------------------------------------------------------------------------------- +function _format_date($row) +{ + return sql2date($row['reconciled']); +} -function bank_trans_types_list($name, $selected_id=null) +function bank_reconciliation_list($account, $name, $selected_id=null, $submit_on_change=false, $special_option=false) { - $sql = "SELECT id, name FROM ".TB_PREF."bank_trans_types"; - combo_input($name, $selected_id, $sql, 'id', 'name', array()); + $sql = "SELECT reconciled, reconciled FROM ".TB_PREF."bank_trans + WHERE bank_act=".db_escape($account)." AND reconciled IS NOT NULL + GROUP BY reconciled"; + combo_input($name, $selected_id, $sql, 'id', 'reconciled', + array( + 'spec_option' => $special_option, + 'format' => '_format_date', + 'spec_id' => '', + 'select_submit'=> $submit_on_change + ) ); } -function bank_trans_types_list_cells($label, $name, $selected_id=null) +function bank_reconciliation_list_cells($label,$account, $name, $selected_id=null, $submit_on_change=false, $special_option=false) { if ($label != null) echo "\n"; echo "\n"; } - -function bank_trans_types_list_row($label, $name, $selected_id=null) +/* +function bank_reconciliation_list_row($label, $account, $name, $selected_id=null, $submit_on_change=false, $special_option=false) { echo "\n"; - bank_trans_types_list_cells($label, $name, $selected_id); + bank_reconciliation_list_cells($label, $account, $name, $selected_id, $submit_on_change, $special_option); echo "\n"; } - +*/ //----------------------------------------------------------------------------------------------- function workcenter_list($name, $selected_id=null, $all_option=false) @@ -1199,11 +1363,12 @@ function workcenter_list_row($label, $name, $selected_id=null, $all_option=false function bank_accounts_list($name, $selected_id=null, $submit_on_change=false) { - $sql = "SELECT ".TB_PREF."bank_accounts.account_code, bank_account_name, bank_curr_code - FROM ".TB_PREF."bank_accounts, ".TB_PREF."chart_master - WHERE ".TB_PREF."bank_accounts.account_code=".TB_PREF."chart_master.account_code"; + $sql = "SELECT ".TB_PREF."bank_accounts.id, bank_account_name, bank_curr_code + FROM ".TB_PREF."bank_accounts"; +// , ".TB_PREF."chart_master +// WHERE ".TB_PREF."bank_accounts.account_code=".TB_PREF."chart_master.account_code"; - return combo_input($name, $selected_id, $sql, 'account_code', 'bank_account_name', + return combo_input($name, $selected_id, $sql, 'id', 'bank_account_name', array( 'format' => '_format_add_curr', 'select_submit'=> $submit_on_change, @@ -1228,7 +1393,60 @@ function bank_accounts_list_row($label, $name, $selected_id=null, $submit_on_cha echo "\n"; return $str; } +//----------------------------------------------------------------------------------------------- + +function cash_accounts_list_row($label, $name, $selected_id=null, $submit_on_change=false) +{ + $sql = "SELECT ".TB_PREF."bank_accounts.id, bank_account_name, bank_curr_code + FROM ".TB_PREF."bank_accounts + WHERE ".TB_PREF."bank_accounts.account_type=3"; + if ($label != null) + echo "\n"; + echo "\n"; + return $str; +} +//----------------------------------------------------------------------------------------------- + +function pos_list_row($label, $name, $selected_id=null, $spec_option=false, $submit_on_change=false) +{ + $sql = "SELECT id, pos_name FROM ".TB_PREF."sales_pos"; + + default_focus($name); + echo ''; + if ($label != null) + echo "\n"; + echo "\n"; + + return $str; +} +//----------------------------------------------------------------------------------------------- + +function sale_payment_list_cells($label, $name, $selected_id=null, $submit_on_change=false) +{ + if ($label != null) + echo "\n"; + echo "\n"; + return $str; +} //----------------------------------------------------------------------------------------------- function class_list($name, $selected_id=null, $submit_on_change=false) @@ -1323,14 +1541,14 @@ function gl_account_types_list_row($label, $name, $selected_id=null, $all_option //----------------------------------------------------------------------------------------------- function gl_all_accounts_list($name, $selected_id=null, $skip_bank_accounts=false, - $show_group=false, $cells=false, $all_option=false, $submit_on_change=false) + $cells=false, $all_option=false, $submit_on_change=false) { if ($skip_bank_accounts) $sql = "SELECT chart.account_code, chart.account_name, type.name FROM (".TB_PREF."chart_master chart,".TB_PREF."chart_types type) " ."LEFT JOIN ".TB_PREF."bank_accounts acc " ."ON chart.account_code=acc.account_code - WHERE acc.account_code IS NULL + WHERE acc.account_code IS NULL AND chart.account_type=type.id"; else $sql = "SELECT chart.account_code, chart.account_name, type.name @@ -1339,17 +1557,18 @@ function gl_all_accounts_list($name, $selected_id=null, $skip_bank_accounts=fals combo_input($name, $selected_id, $sql, 'chart.account_code', 'chart.account_name', array( - 'format' => '_format_account' . ($show_group ? '2' : ''), + 'format' => '_format_account', 'spec_option' => $all_option===true ? _("Use Item Sales Accounts") : $all_option, 'spec_id' => '', - 'order' => 'account_code', + 'order' => array('name','account_code'), 'search_box' => $cells, 'search_submit' => false, 'size' => 12, 'max' => 10, 'cells' => true, 'select_submit'=> $submit_on_change, - 'async' => false + 'async' => false, + 'category' => 2 ) ); } @@ -1359,27 +1578,23 @@ function _format_account($row) return $row[0] . "    " . $row[1]; } -function _format_account2($row) -{ - return $row[0] . "    " . $row[2] . "      " . $row[1]; -} - -function gl_all_accounts_list_cells($label, $name, $selected_id=null, $skip_bank_accounts=false, - $show_group=false, $cells=false, $all_option=false) +function gl_all_accounts_list_cells($label, $name, $selected_id=null, + $skip_bank_accounts=false, $cells=false, $all_option=false) { if ($label != null) echo "\n"; echo "\n"; } -function gl_all_accounts_list_row($label, $name, $selected_id=null, $skip_bank_accounts=false, - $show_group=false, $cells=false, $all_option=false) +function gl_all_accounts_list_row($label, $name, $selected_id=null, + $skip_bank_accounts=false, $cells=false, $all_option=false) { echo "\n"; - gl_all_accounts_list_cells($label, $name, $selected_id, $skip_bank_accounts, - $show_group, $cells, $all_option); + gl_all_accounts_list_cells($label, $name, $selected_id, + $skip_bank_accounts, $cells, $all_option); echo "\n"; } @@ -1747,4 +1962,107 @@ function number_list_row($label, $name, $selected, $from, $to, $no_option=false) echo "\n"; } +function print_profiles_list_row($label, $name, $selected_id=null, $spec_opt=false, + $submit_on_change=true) +{ + $sql = "SELECT profile FROM ".TB_PREF."print_profiles" + ." GROUP BY profile"; + $result = db_query($sql, 'cannot get all profile names'); + $profiles = array(); + while($myrow=db_fetch($result)) { + $profiles[$myrow['profile']] = $myrow['profile']; + } + + echo ""; + if ($label != null) + echo "\n"; + echo "\n"; +} + +function printers_list($name, $selected_id=null, $spec_opt=false, $submit_on_change=false) +{ + static $printers; // query only once for page display + + if (!$printers) { + $sql = "SELECT id, name, description FROM ".TB_PREF."printers"; + $result = db_query($sql, 'cannot get all printers'); + $printers = array(); + while($myrow=db_fetch($result)) { + $printers[$myrow['id']] = $myrow['name'].' - '.$myrow['description']; + } + } + array_selector($name, $selected_id, $printers, + array( 'select_submit'=> $submit_on_change, + 'spec_option'=>$spec_opt, + 'spec_id' => '' + )); +} + +//------------------------------------------------------------------------------------------------ + +function quick_entries_list($name, $selected_id=null, $type=null, $submit_on_change=false) +{ + $where = false; + $sql = "SELECT id, description FROM ".TB_PREF."quick_entries"; + if ($type != null) + $sql .= " WHERE type=$type"; + + combo_input($name, $selected_id, $sql, 'id', 'description', + array( + 'spec_id' => '', + 'order' => 'description', + 'select_submit'=> $submit_on_change, + 'async' => false + ) ); + +} + +function quick_entries_list_cells($label, $name, $selected_id=null, $type, $submit_on_change=false) +{ + echo ""; +} + +function quick_entries_list_row($label, $name, $selected_id=null, $type, $submit_on_change=false) +{ + echo "\n"; + quick_entries_list_cells($label, $name, $selected_id, $type, $submit_on_change); + echo "\n"; +} + + +function quick_actions_list_row($label, $name, $selected_id=null, $submit_on_change=false) +{ + global $quick_actions; + + echo "\n"; +} + +function quick_entry_types_list_row($label, $name, $selected_id=null, $submit_on_change=false) +{ + global $quick_entry_types; + + echo "\n"; +} + + ?> \ No newline at end of file diff --git a/includes/ui/ui_msgs.inc b/includes/ui/ui_msgs.inc index a0c1aff4..8925c030 100644 --- a/includes/ui/ui_msgs.inc +++ b/includes/ui/ui_msgs.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ function display_error($msg, $center=true) { trigger_error($msg, E_USER_ERROR); diff --git a/includes/ui/ui_view.inc b/includes/ui/ui_view.inc index 3aa462f7..1d4f1fc1 100644 --- a/includes/ui/ui_view.inc +++ b/includes/ui/ui_view.inc @@ -1,13 +1,22 @@ . +***********************************************************************/ include_once($path_to_root . "/admin/db/voiding_db.inc"); include_once($path_to_root . "/includes/types.inc"); //-------------------------------------------------------------------------------------- -function get_supplier_trans_view_str($type, $trans_no, $label="") +function get_supplier_trans_view_str($type, $trans_no, $label="", $icon=false) { - global $path_to_root, $use_popup_windows; + global $path_to_root; $viewer = ""; if ($type == systypes::po()) @@ -28,10 +37,10 @@ function get_supplier_trans_view_str($type, $trans_no, $label="") if ($viewer != "") { - if ($use_popup_windows) - $preview_str = "$label"; - else - $preview_str = "$label"; + $pars = access_string($label); + if (user_graphic_links() && $icon) + $pars[0] = set_icon($icon, $pars[0]); + $preview_str = "$pars[0]"; } else $preview_str = $label; @@ -43,17 +52,21 @@ function get_supplier_trans_view_str($type, $trans_no, $label="") function get_gl_view_str($type, $trans_no, $label="", $force=false) { - global $path_to_root, $use_popup_windows; + global $path_to_root; if (!$force && !user_show_gl_info()) return ""; + $icon = false; if ($label == "") + { $label = _("GL"); - if ($use_popup_windows) - $gl_view = "$label"; - else - $gl_view = "$label"; + $icon = ICON_GL; + } + $pars = access_string($label); + if (user_graphic_links() && $icon) + $pars[0] = set_icon($icon, $pars[0]); + $gl_view = "$pars[0]"; return $gl_view; } @@ -69,9 +82,9 @@ function get_gl_view_str_cell($type, $trans_no, $label="") //-------------------------------------------------------------------------------------- -function get_customer_trans_view_str($type, $trans_no, $label="") +function get_customer_trans_view_str($type, $trans_no, $label="", $icon=false) { - global $path_to_root, $use_popup_windows; + global $path_to_root; $viewer = ""; if ($type == 10) @@ -91,18 +104,18 @@ function get_customer_trans_view_str($type, $trans_no, $label="") $lbl = $label; $preview_str = ''; + foreach($trans_no as $trans) { if ($label == "") $lbl = $trans; - if($preview_str!='') $preview_str .= ','; if ($viewer != "") { - if ($use_popup_windows) - $preview_str .= "$lbl"; - else - $preview_str .= "$lbl"; + $pars = access_string($lbl); + if (user_graphic_links() && $icon) + $pars[0] = set_icon($icon, $pars[0]); + $preview_str .= "$pars[0]"; } else $preview_str .= $lbl; @@ -113,9 +126,9 @@ function get_customer_trans_view_str($type, $trans_no, $label="") //-------------------------------------------------------------------------------------- -function get_banking_trans_view_str($type, $trans_no, $label="") +function get_banking_trans_view_str($type, $trans_no, $label="", $icon=false) { - global $path_to_root, $use_popup_windows; + global $path_to_root; $viewer = ""; @@ -135,10 +148,10 @@ function get_banking_trans_view_str($type, $trans_no, $label="") if ($viewer != "") { - if ($use_popup_windows) - $preview_str = "$label"; - else - $preview_str = "$label"; + $pars = access_string($label); + if (user_graphic_links() && $icon) + $pars[0] = set_icon($icon, $pars[0]); + $preview_str = "$pars[0]"; } else $preview_str = $label; @@ -148,9 +161,9 @@ function get_banking_trans_view_str($type, $trans_no, $label="") //-------------------------------------------------------------------------------------- -function get_inventory_trans_view_str($type, $trans_no, $label="") +function get_inventory_trans_view_str($type, $trans_no, $label="", $icon=false) { - global $path_to_root, $use_popup_windows; + global $path_to_root; $viewer = ""; @@ -166,10 +179,10 @@ function get_inventory_trans_view_str($type, $trans_no, $label="") if ($viewer != "") { - if ($use_popup_windows) - $preview_str = "$label"; - else - $preview_str = "$label"; + $pars = access_string($label); + if (user_graphic_links() && $icon) + $pars[0] = set_icon($icon, $pars[0]); + $preview_str = "$pars[0]"; } else $preview_str = $label; @@ -179,9 +192,9 @@ function get_inventory_trans_view_str($type, $trans_no, $label="") //-------------------------------------------------------------------------------------- -function get_manufacturing_trans_view_str($type, $trans_no, $label="") +function get_manufacturing_trans_view_str($type, $trans_no, $label="", $icon=false) { - global $path_to_root, $use_popup_windows; + global $path_to_root; $viewer = ""; @@ -199,10 +212,10 @@ function get_manufacturing_trans_view_str($type, $trans_no, $label="") if ($viewer != "") { - if ($use_popup_windows) - $preview_str = "$label"; - else - $preview_str = "$label"; + $pars = access_string($label); + if (user_graphic_links() && $icon) + $pars[0] = set_icon($icon, $pars[0]); + $preview_str = "$pars[0]"; } else $preview_str = $label; @@ -212,9 +225,9 @@ function get_manufacturing_trans_view_str($type, $trans_no, $label="") //-------------------------------------------------------------------------------------- -function get_dimensions_trans_view_str($type, $trans_no, $label="") +function get_dimensions_trans_view_str($type, $trans_no, $label="", $icon=false) { - global $path_to_root, $use_popup_windows; + global $path_to_root; $viewer = ""; @@ -228,10 +241,10 @@ function get_dimensions_trans_view_str($type, $trans_no, $label="") if ($viewer != "") { - if ($use_popup_windows) - $preview_str = "$label"; - else - $preview_str = "$label"; + $pars = access_string($label); + if (user_graphic_links() && $icon) + $pars[0] = set_icon($icon, $pars[0]); + $preview_str = "$pars[0]"; } else $preview_str = $label; @@ -241,29 +254,29 @@ function get_dimensions_trans_view_str($type, $trans_no, $label="") //-------------------------------------------------------------------------------------- -function get_trans_view_str($type, $trans_no, $label="") +function get_trans_view_str($type, $trans_no, $label="", $icon=false) { - $view_str = get_customer_trans_view_str($type, $trans_no, $label); + $view_str = get_customer_trans_view_str($type, $trans_no, $label, $icon); if ($view_str != null) return $view_str; - $view_str = get_supplier_trans_view_str($type, $trans_no, $label); + $view_str = get_supplier_trans_view_str($type, $trans_no, $label, $icon); if ($view_str != null) return $view_str; - $view_str = get_banking_trans_view_str($type, $trans_no, $label); + $view_str = get_banking_trans_view_str($type, $trans_no, $label, $icon); if ($view_str != null) return $view_str; - $view_str = get_inventory_trans_view_str($type, $trans_no, $label); + $view_str = get_inventory_trans_view_str($type, $trans_no, $label, $icon); if ($view_str != null) return $view_str; - $view_str = get_manufacturing_trans_view_str($type, $trans_no, $label); + $view_str = get_manufacturing_trans_view_str($type, $trans_no, $label, $icon); if ($view_str != null) return $view_str; - $view_str = get_dimensions_trans_view_str($type, $trans_no, $label); + $view_str = get_dimensions_trans_view_str($type, $trans_no, $label, $icon); if ($view_str != null) return $view_str; @@ -363,7 +376,7 @@ function get_comments_string($type, $type_no) //-------------------------------------------------------------------------------------- -function view_stock_status($stock_id, $description=null) +function view_stock_status($stock_id, $description=null, $echo=true) { global $path_to_root; if ($description) @@ -372,7 +385,9 @@ function view_stock_status($stock_id, $description=null) else //hyperlink_params_separate($path_to_root . "/inventory/inquiry/stock_status.php", $stock_id, "stock_id=$stock_id"); $preview_str = "$stock_id"; - echo $preview_str; + if($echo) + echo $preview_str; + return $preview_str; } function view_stock_status_cell($stock_id, $description=null) @@ -429,7 +444,7 @@ function display_supp_trans_tax_details($tax_items, $columns) $tax = number_format2(abs($tax_item['amount']),user_price_dec()); if ($tax_item['included_in_price']) label_row(_("Included") . " " . $tax_item['tax_type_name'] . " (" . $tax_item['rate'] . "%) " . - _("Amount:") . ": $tax", "colspan=$columns align=right", "align=right"); + _("Amount") . ": $tax", "colspan=$columns align=right", "align=right"); else label_row($tax_item['tax_type_name'] . " (" . $tax_item['rate'] . "%)", $tax, "colspan=$columns align=right", "align=right"); @@ -535,6 +550,104 @@ function display_allocations_from($person_type, $person_id, $type, $type_no, $to } } +//-------------------------------------------------------------------------------------- +// +// Expands selected quick entry $id into GL posings and adds to cart. +// returns calculated amount posted to bank GL account. +// +function display_quick_entries(&$cart, $id, $base, $type, $descr='') +{ + $bank_amount = 0; + + if (!isset($id) || $id == null || $id == "") + { + display_error( _("No Quick Entries are defined.")); + set_focus('totamount'); + } + else + { + if ($type == QE_DEPOSIT) + $base = -$base; + if ($type != QE_SUPPINV) // only one quick entry on journal/bank transaction + $cart->clear_items(); + $qe = get_quick_entry($id); + if ($descr != '') $qe['description'] .= ': '.$descr; + $qe_lines = get_quick_entry_lines($id); + while ($qe_line = db_fetch($qe_lines)) + { + switch (strtolower($qe_line['action'])) { + case "=": // post current base amount to GL account + $part = $base; + break; + case "a": // post amount to GL account and reduce base + $part = $qe_line['amount']; + break; + case "a+": // post amount to GL account and increase base + $part = $qe_line['amount']; $base += $part; + break; + case "a-": // post amount to GL account and reduce base + $part = $qe_line['amount']; $base -= $part; + break; + case "%": // store acc*amount% to GL account + $part = round2($base * $qe_line['amount'] / 100, user_price_dec()); + break; + case "%+": // ditto & increase base amount + $part = round2($base * $qe_line['amount'] / 100, user_price_dec()); + $base += $part; + break; + case "%-": // ditto & reduce base amount + $part = round2($base * $qe_line['amount'] / 100, user_price_dec()); + $base -= $part; + break; + case "t": // post taxes calculated on base amount + case "t+": // ditto & increase base amount + case "t-": // ditto & reduce base amount + $taxes = get_taxes_for_item_tax($qe_line['dest_id']); + $tax_total = 0; + foreach ($taxes as $index => $item_tax) { + if(substr($qe_line['action'],0,1) != 'T') + $tax = round2($base * $item_tax['rate'] + / ($item_tax['rate'] + 100), user_price_dec()); + else + $tax = round2($base * $item_tax['rate'] / 100, user_price_dec()); + + $gl_code = ($type == QE_DEPOSIT || ($type == QE_JOURNAL && $base < 0)) + ? $item_tax['sales_gl_code'] : $item_tax['purchasing_gl_code']; + $tax_total += $tax; + if ($type != QE_SUPPINV) + $cart->add_gl_item($gl_code, + $qe_line['dimension_id'], $qe_line['dimension2_id'], + $tax, $qe['description']); + else + { + $acc_name = get_gl_account_name($gl_code); + $cart->add_gl_codes_to_trans($gl_code, + $acc_name, $qe_line['dimension_id'], + $qe_line['dimension2_id'], $tax, $qe['description']); + } + } + if (strpos($qe_line['action'], '+')) + $base += $tax_total; + elseif (strpos($qe_line['action'], '-')) + $base -= $tax_total; + continue 2; + } + if ($type != QE_SUPPINV) + $cart->add_gl_item($qe_line['dest_id'], $qe_line['dimension_id'], + $qe_line['dimension2_id'], $part, $qe['description']); + else + { + $acc_name = get_gl_account_name($qe_line['dest_id']); + $cart->add_gl_codes_to_trans($qe_line['dest_id'], + $acc_name, $qe_line['dimension_id'], + $qe_line['dimension2_id'], $part, $qe['description']); + } + } + } + return $bank_amount; +} + + function get_js_open_window($width, $height) { $js = "\n - // - // - // click here if you are not re-directed. - // - // '; - header('Content-type: application/pdf'); - header("Content-Disposition: inline; filename=$this->filename"); - header('Expires: 0'); - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Pragma: public'); - $this->Stream(); - + $printer = get_report_printer(user_print_profile(), $_POST['REP_ID']); + if ($printer == false) { + if(in_ajax()) { + global $Ajax; + + if (user_rep_popup()) + $Ajax->popup($fname); // when embeded pdf viewer used + else + $Ajax->redirect($fname); // otherwise use faster method + } else { + //echo ' + // + // + // + // + // click here if you are not re-directed. + // + // '; + header('Content-type: application/pdf'); + header("Content-Disposition: inline; filename=$this->filename"); + header('Expires: 0'); + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); + header('Pragma: public'); + $this->Stream(); + } + } else { // send report to network printer + $prn = new remote_printer($printer['queue'],$printer['host'], + $printer['port'], $printer['timeout']); + $error = $prn->print_file($fname); + if ($error) + display_error($error); + else + display_notification(_('Report has been sent to network printer ').$printer['name']); + } } - // also have a look through the directory, and remove the files that are older than a week - // rather want to save 'em - /*if ($d = @opendir($dir)) { + // first have a look through the directory, + // and remove old temporary pdfs + if ($d = @opendir($dir)) { while (($file = readdir($d)) !== false) { - // then check to see if this one is too old + if (!is_file($dir.'/'.$file) || $file == 'index.php') continue; + // then check to see if this one is too old $ftime = filemtime($dir.'/'.$file); - if (time()-$ftime > 3600*24*7){ + // seems 3 min is enough for any report download, isn't it? + if (time()-$ftime > 180){ unlink($dir.'/'.$file); } } closedir($d); - }*/ + } } } } diff --git a/reporting/includes/reporting.inc b/reporting/includes/reporting.inc index 75b8d76f..4f7f574a 100644 --- a/reporting/includes/reporting.inc +++ b/reporting/includes/reporting.inc @@ -1,101 +1,103 @@ . +***********************************************************************/ +// Link to printing single document with bulk report template file. +// Ex. label_cell(print_document_link($myrow['order_no'], _("Print")), $type); +// or display_note(print_document_link($order_no, _("Print this order"))); +// You only need full parameter list for invoices/credit notes -// Put this on the page only once an outside a form, e.g. print_hidden_script(systypes::sales_order()); -// If you have both invoices and credit notes on the same page use 10 or 11. Is doesn't matter which. - -function print_hidden_script($type_no) +function print_document_link($doc_no, $link_text, $link=true, $type_no, $icon=false) { global $path_to_root; include_once($path_to_root . "/includes/types.inc"); - $action = ""; + + $url = $path_to_root.'/reporting/prn_redirect.php?'; switch ($type_no) { case systypes::sales_order() : - $action = "$path_to_root/reporting/rep109.php"; + $rep = 109; + // from, to, currency, bank acc, email, quote, comments $ar = array( - 'PARAM_0' => 0, // from - these values are updated in print_document_link() - 'PARAM_1' => 0, // to - 'PARAM_2' => "", // currency - 'PARAM_3' => get_first_bank_account(), // bank account - 'PARAM_4' => 0, // email - 'PARAM_5' => 0, // quote - 'PARAM_6' => ""); // comments + 'PARAM_0' => $doc_no, + 'PARAM_1' => $doc_no, + 'PARAM_2' => "", + 'PARAM_3' => get_first_bank_account(), + 'PARAM_4' => 0, + 'PARAM_5' => 0, + 'PARAM_6' => ""); break; case systypes::cust_dispatch() : - $action = "$path_to_root/reporting/rep110.php"; + $rep = 110; + // from, to, email, comments $ar = array( - 'PARAM_0' => 0, // from - these values are updated in print_document_link() - 'PARAM_1' => 0, // to - 'PARAM_2' => 0, // email - 'PARAM_3' => ""); // comments + 'PARAM_0' => $doc_no, + 'PARAM_1' => $doc_no, + 'PARAM_2' => 0, + 'PARAM_3' => ""); break; case 10 : // Sales Invoice case 11 : // Customer Credit Note - $action = "$path_to_root/reporting/rep107.php"; + $rep = 107; + // from, to, currency, bank acc, email, paylink, comments, type $ar = array( - 'PARAM_0' => 0, // from - these values are updated in print_document_link() - 'PARAM_1' => 0, // to - 'PARAM_2' => "", // currency - 'PARAM_3' => get_first_bank_account(), // bank account - 'PARAM_4' => 0, // email - 'PARAM_5' => "", // paylink - 'PARAM_6' => "", // comments - 'PARAM_7' => 0); // IV or CN + 'PARAM_0' => $doc_no, + 'PARAM_1' => $doc_no, + 'PARAM_2' => "", + 'PARAM_3' => get_first_bank_account(), + 'PARAM_4' => 0, + 'PARAM_5' => "", + 'PARAM_6' => "", + 'PARAM_7' => $type_no); break; case systypes::po() : - $action = "$path_to_root/reporting/rep209.php"; + $rep = 209; + // from, to, currency, bank acc, email, comments $ar = array( - 'PARAM_0' => 0, // from - these values are updated in print_document_link() - 'PARAM_1' => 0, // to - 'PARAM_2' => "", // currency - 'PARAM_3' => get_first_bank_account(), // bank account - 'PARAM_4' => 0, // email - 'PARAM_5' => ""); // comments + 'PARAM_0' => $doc_no, + 'PARAM_1' => $doc_no, + 'PARAM_2' => "", + 'PARAM_3' => get_first_bank_account(), + 'PARAM_4' => 0, + 'PARAM_5' => ""); break; +// default: $ar = array(); } - $st = ""; - foreach ($ar as $key => $value) - { - $st .= ""; - } - $st .= "\n"; - $st .= "\n"; - - echo $st; + + return print_link($link_text, $rep, $ar, "", $icon); } - -// Ex. label_cell(print_document_link($myrow['order_no'], _("Print"))); -// or display_note(print_document_link($order_no, _("Print this order"))); -// or if a button -// button("button", _("Print this order"), print_document_link($order_no, "", false))"; -// or if a button inside a TD -// button_cell("button", _("Print this order"), print_document_link($order_no, "", false))"; // -// You only need full parameter list for invoices/credit notes - -function print_document_link($doc_no, $link_text, $link=true, $type_no=0) +// Universal link to any kind of report. +// +function print_link($link_text, $rep, $pars = array(), $dir = '', $icon=false) { - if ($link) - return "$link_text"; - else - return "javascript:printDocument('$doc_no', '$type_no');"; + global $path_to_root, $pdf_debug; + + $url = $dir == '' ? $path_to_root.'/reporting/prn_redirect.php?' : $dir; + + foreach($pars as $par => $val) { + $pars[$par] = "$par=".urlencode($val); + } + $pars[] = 'REP_ID='.urlencode($rep); + $url .= implode ('&', $pars); + $class = $pdf_debug ? '' : "class='printlink'"; + $pars = access_string($link_text); + if (user_graphic_links() && $icon) + $pars[0] = set_icon($icon, $pars[0]); + return "$pars[0]"; } function get_first_bank_account() { - $sql = "SELECT ".TB_PREF."bank_accounts.account_code FROM ".TB_PREF."bank_accounts, ".TB_PREF."company + $sql = "SELECT ".TB_PREF."bank_accounts.id FROM ".TB_PREF."bank_accounts, ".TB_PREF."company WHERE bank_curr_code=curr_default LIMIT 0, 1"; $result = db_query($sql); $row = db_fetch_row($result); diff --git a/reporting/includes/reports_classes.inc b/reporting/includes/reports_classes.inc index 0dabe11c..363e2284 100644 --- a/reporting/includes/reports_classes.inc +++ b/reporting/includes/reports_classes.inc @@ -1,4 +1,14 @@ . +***********************************************************************/ class BoxReports { var $ar_classes; @@ -20,7 +30,8 @@ class BoxReports function getDisplay($class=null) { - global $table_style2; + global $table_style2, $comp_path, $path_to_root, $pdf_debug, $Ajax; + $temp = array_values($this->ar_classes); $display_class = $class==null ? $temp[0] : $this->ar_classes[$class]; $class_counter = 0; @@ -30,34 +41,56 @@ class BoxReports $st_classes = "" . _("Report Classes:") . "
"; foreach($this->ar_classes as $key=>$value) { - $style = $class_counter==0 ? '' : $style = "style='display:none'"; - $st_classes .= "$key
"; - $st_reports .= "
$msg 
" . _("Backup scripts") . "
"; // outer table echo ""; - bank_trans_types_list_row(_("Transfer Type:"), 'TransferType', null); - ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::bank_transfer())); textarea_row(_("Memo:"), 'memo_', null, 40,4); @@ -145,11 +151,8 @@ function check_valid_entries() function handle_add_deposit() { - global $path_to_root; - $trans_no = add_bank_transfer($_POST['FromBankAccount'], $_POST['ToBankAccount'], - $_POST['DatePaid'], input_num('amount'), - $_POST['TransferType'], $_POST['ref'], $_POST['memo_']); + $_POST['DatePaid'], input_num('amount'), $_POST['ref'], $_POST['memo_']); meta_forward($_SERVER['PHP_SELF'], "AddedID=$trans_no"); } @@ -158,7 +161,6 @@ function handle_add_deposit() function safeExit() { - global $path_to_root; echo "

"; end_page(); exit; diff --git a/gl/gl_bank.php b/gl/gl_bank.php index ce8c40fd..fa78eeb2 100644 --- a/gl/gl_bank.php +++ b/gl/gl_bank.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 3; $path_to_root=".."; include_once($path_to_root . "/includes/ui/items_cart.inc"); @@ -31,8 +40,6 @@ page($_SESSION['page_title'], false, false, '', $js); //----------------------------------------------------------------------------------------------- check_db_has_bank_accounts(_("There are no bank accounts defined in the system.")); -check_db_has_bank_trans_types(_("There are no bank payment types defined in the system.")); - //---------------------------------------------------------------------------------------- if ($ret = context_restore()) { if(isset($ret['supplier_id'])) @@ -55,7 +62,7 @@ if (isset($_POST['_person_id_editor'])) { // context_call($path_to_root.$editor.$_POST['person_id'], array('bank_account', 'date_', 'PayType', 'person_id', - 'PersonDetailID', 'type', 'ref', 'memo_') ); + 'PersonDetailID', 'ref', 'memo_') ); } //-------------------------------------------------------------------------------------------------- function line_start_focus() { @@ -74,11 +81,11 @@ if (isset($_GET['AddedID'])) display_notification_centered(_("Payment has been entered")); - display_note(get_gl_view_str($trans_type, $trans_no, _("View the GL Postings for this Payment"))); + display_note(get_gl_view_str($trans_type, $trans_no, _("&View the GL Postings for this Payment"))); - hyperlink_params($_SERVER['PHP_SELF'], _("Enter Another Payment"), "NewPayment=yes"); + hyperlink_params($_SERVER['PHP_SELF'], _("Enter Another &Payment"), "NewPayment=yes"); - hyperlink_params($_SERVER['PHP_SELF'], _("Enter A Deposit"), "NewDeposit=yes"); + hyperlink_params($_SERVER['PHP_SELF'], _("Enter A &Deposit"), "NewDeposit=yes"); display_footer_exit(); } @@ -107,7 +114,6 @@ function handle_new_order($type) { if (isset($_SESSION['pay_items'])) { - $_SESSION['pay_items']->clear_items(); unset ($_SESSION['pay_items']); } @@ -170,7 +176,7 @@ if (isset($_POST['Process'])) $_SESSION['pay_items']->trans_type, $_POST['bank_account'], $_SESSION['pay_items'], $_POST['date_'], $_POST['PayType'], $_POST['person_id'], get_post('PersonDetailID'), - $_POST['type'], $_POST['ref'], $_POST['memo_']); + $_POST['ref'], $_POST['memo_']); $trans_type = $trans[0]; $trans_no = $trans[1]; @@ -187,12 +193,12 @@ if (isset($_POST['Process'])) function check_item_data() { - if (!check_num('amount', 0)) - { - display_error( _("The amount entered is not a valid number or is less than zero.")); - set_focus('amount'); - return false; - } + //if (!check_num('amount', 0)) + //{ + // display_error( _("The amount entered is not a valid number or is less than zero.")); + // set_focus('amount'); + // return false; + //} if ($_POST['code_id'] == $_POST['bank_account']) { @@ -201,15 +207,15 @@ function check_item_data() return false; } - if (is_bank_account($_POST['code_id'])) - { - if ($_SESSION['pay_items']->trans_type == systypes::bank_payment()) - display_error( _("You cannot make a payment to a bank account. Please use the transfer funds facility for this.")); - else - display_error( _("You cannot make a deposit from a bank account. Please use the transfer funds facility for this.")); - set_focus('code_id'); - return false; - } + //if (is_bank_account($_POST['code_id'])) + //{ + // if ($_SESSION['pay_items']->trans_type == systypes::bank_payment()) + // display_error( _("You cannot make a payment to a bank account. Please use the transfer funds facility for this.")); + // else + // display_error( _("You cannot make a deposit from a bank account. Please use the transfer funds facility for this.")); + // set_focus('code_id'); + // return false; + //} return true; } @@ -247,7 +253,6 @@ function handle_new_item() $_POST['dimension2_id'], $amount, $_POST['LineMemo']); line_start_focus(); } - //----------------------------------------------------------------------------------------------- $id = find_submit('Delete'); if ($id != -1) @@ -262,7 +267,13 @@ if (isset($_POST['UpdateItem'])) if (isset($_POST['CancelItemChanges'])) line_start_focus(); - +if (isset($_POST['go'])) +{ + display_quick_entries($_SESSION['pay_items'], $_POST['person_id'], input_num('totamount'), + $_SESSION['pay_items']->trans_type==systypes::bank_payment() ? QE_PAYMENT : QE_DEPOSIT); + $_POST['totamount'] = price_format(0); $Ajax->activate('totamount'); + line_start_focus(); +} //----------------------------------------------------------------------------------------------- start_form(false, true); diff --git a/gl/gl_budget.php b/gl/gl_budget.php index d9d4dde9..6c4db527 100644 --- a/gl/gl_budget.php +++ b/gl/gl_budget.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 10; $path_to_root=".."; include($path_to_root . "/includes/session.inc"); diff --git a/gl/gl_journal.php b/gl/gl_journal.php index fc07ffd7..8d285334 100644 --- a/gl/gl_journal.php +++ b/gl/gl_journal.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 3; $path_to_root=".."; include_once($path_to_root . "/includes/ui/items_cart.inc"); @@ -37,9 +46,9 @@ if (isset($_GET['AddedID'])) display_notification_centered( _("Journal entry has been entered") . " #$trans_no"); - display_note(get_gl_view_str($trans_type, $trans_no, _("View this Journal Entry"))); + display_note(get_gl_view_str($trans_type, $trans_no, _("&View this Journal Entry"))); - hyperlink_no_params($_SERVER['PHP_SELF'], _("Enter Another Journal Entry")); + hyperlink_no_params($_SERVER['PHP_SELF'], _("Enter &Another Journal Entry")); display_footer_exit(); } @@ -228,6 +237,12 @@ if (isset($_POST['UpdateItem'])) if (isset($_POST['CancelItemChanges'])) line_start_focus(); +if (isset($_POST['go'])) +{ + display_quick_entries($_SESSION['journal_items'], $_POST['person_id'], input_num('totamount'), QE_JOURNAL); + $_POST['totamount'] = price_format(0); $Ajax->activate('totamount'); + line_start_focus(); +} //----------------------------------------------------------------------------------------------- if (isset($_GET['NewJournal']) || !isset($_SESSION['journal_items'])) diff --git a/gl/includes/db/gl_db_account_types.inc b/gl/includes/db/gl_db_account_types.inc index 87ddba3a..21a8c2ce 100644 --- a/gl/includes/db/gl_db_account_types.inc +++ b/gl/includes/db/gl_db_account_types.inc @@ -1,9 +1,18 @@ . +***********************************************************************/ +function add_account_type($id, $name, $class_id, $parent) { - $sql = "INSERT INTO ".TB_PREF."chart_types (name, class_id, parent) - VALUES (".db_escape($name).", $class_id, $parent)"; + $sql = "INSERT INTO ".TB_PREF."chart_types (id, name, class_id, parent) + VALUES ($id, ".db_escape($name).", $class_id, $parent)"; db_query($sql, "could not add account type"); } diff --git a/gl/includes/db/gl_db_accounts.inc b/gl/includes/db/gl_db_accounts.inc index 4d51985f..9622ebc2 100644 --- a/gl/includes/db/gl_db_accounts.inc +++ b/gl/includes/db/gl_db_accounts.inc @@ -1,22 +1,29 @@ . +***********************************************************************/ +function add_gl_account($account_code, $account_name, $account_type, $account_code2) { $account_name = db_escape($account_name); - $sql = "INSERT INTO ".TB_PREF."chart_master (account_code, account_code2, account_name, account_type, - tax_code) - VALUES (".db_escape($account_code).", ".db_escape($account_code2).", $account_name, $account_type, $tax_code)"; + $sql = "INSERT INTO ".TB_PREF."chart_master (account_code, account_code2, account_name, account_type) + VALUES (".db_escape($account_code).", ".db_escape($account_code2).", $account_name, $account_type)"; db_query($sql, "could not add gl account"); } -function update_gl_account($account_code, $account_name, $account_type, $account_code2, $tax_code) +function update_gl_account($account_code, $account_name, $account_type, $account_code2) { $account_name = db_escape($account_name); $sql = "UPDATE ".TB_PREF."chart_master SET account_name=$account_name, - account_type=$account_type, account_code2=".db_escape($account_code2).", - tax_code=$tax_code WHERE account_code = '$account_code'"; + account_type=$account_type, account_code2=".db_escape($account_code2) + ." WHERE account_code = '$account_code'"; db_query($sql, "could not update gl account"); } diff --git a/gl/includes/db/gl_db_bank_accounts.inc b/gl/includes/db/gl_db_bank_accounts.inc index 2c405614..2a285805 100644 --- a/gl/includes/db/gl_db_bank_accounts.inc +++ b/gl/includes/db/gl_db_bank_accounts.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ //--------------------------------------------------------------------------------------------- function add_bank_account($account_code, $account_type, $bank_account_name, $bank_name, $bank_account_number, @@ -14,34 +23,177 @@ function add_bank_account($account_code, $account_type, $bank_account_name, $ban //--------------------------------------------------------------------------------------------- -function update_bank_account($account_code, $account_type, $bank_account_name, $bank_name, $bank_account_number, +function update_bank_account($id, $account_code, $account_type, $bank_account_name, $bank_name, $bank_account_number, $bank_address, $bank_curr_code) { $sql = "UPDATE ".TB_PREF."bank_accounts SET account_type = $account_type, + account_code=".db_escape($account_code).", bank_account_name=".db_escape($bank_account_name).", bank_name=".db_escape($bank_name).", bank_account_number=".db_escape($bank_account_number).", bank_curr_code='$bank_curr_code', - bank_address=".db_escape($bank_address)." WHERE account_code = '$account_code'"; + bank_address=".db_escape($bank_address)." WHERE id = '$id'"; db_query($sql, "could not update bank account for $account_code"); } //--------------------------------------------------------------------------------------------- -function delete_bank_account($account_code) +function delete_bank_account($id) +{ + $sql = "DELETE FROM ".TB_PREF."bank_accounts WHERE id='$id'"; + + db_query($sql,"could not delete bank account for $id"); +} + + +//--------------------------------------------------------------------------------------------- + +function get_bank_account($id) +{ + $sql = "SELECT * FROM ".TB_PREF."bank_accounts WHERE id='$id'"; + + $result = db_query($sql, "could not retreive bank account for $id"); + + return db_fetch($result); +} + +//--------------------------------------------------------------------------------------------- +function get_bank_gl_account($id) +{ + $sql = "SELECT account_code FROM ".TB_PREF."bank_accounts WHERE id='$id'"; + + $result = db_query($sql, "could not retreive bank account for $id"); + + $bank_account = db_fetch($result); + + return $bank_account['account_code']; +} + +//--------------------------------------------------------------------------------------------- + +function add_quick_entry($description, $type, $base_amount, $base_desc) +{ + $sql = "INSERT INTO ".TB_PREF."quick_entries (description, type, base_amount, base_desc) + VALUES (".db_escape($description).", $type, " + .db_escape($base_amount).", ".db_escape($base_desc).")"; + + db_query($sql, "could not insert quick entry for $description"); +} + +//--------------------------------------------------------------------------------------------- + +function update_quick_entry($selected_id, $description, $type, $base_amount, $base_desc) +{ + $sql = "UPDATE ".TB_PREF."quick_entries SET description = ".db_escape($description).", + type=$type, base_amount=".db_escape($base_amount).", base_desc=".db_escape($base_desc)." + WHERE id = $selected_id"; + + db_query($sql, "could not update quick entry for $selected_id"); +} + +//--------------------------------------------------------------------------------------------- + +function delete_quick_entry($selected_id) +{ + $sql = "DELETE FROM ".TB_PREF."quick_entries WHERE id=$selected_id"; + + db_query($sql,"could not delete quick entry $selected_id"); +} + +//--------------------------------------------------------------------------------------------- + +function add_quick_entry_line($qid, $action, $dest_id, $amount, $dim, $dim2) +{ + $sql = "INSERT INTO ".TB_PREF."quick_entry_lines + (qid, action, dest_id, amount, dimension_id, dimension2_id) + VALUES + ($qid, ".db_escape($action).",".db_escape($dest_id).", + $amount, $dim, $dim2)"; + + db_query($sql, "could not insert quick entry line for $qid"); +} + +//--------------------------------------------------------------------------------------------- + +function update_quick_entry_line($selected_id, $qid, $action, $dest_id, $amount, $dim, $dim2) { - $sql = "DELETE FROM ".TB_PREF."bank_accounts WHERE account_code='$account_code'"; + $sql = "UPDATE ".TB_PREF."quick_entry_lines SET qid = $qid, action=".db_escape($action).", + dest_id=".db_escape($dest_id).", amount=$amount, dimension_id=$dim, dimension2_id=$dim2 + WHERE id = $selected_id"; - db_query($sql,"could not delete bank account for $account_code"); + db_query($sql, "could not update quick entry line for $selected_id"); } +//--------------------------------------------------------------------------------------------- + +function delete_quick_entry_line($selected_id) +{ + $sql = "DELETE FROM ".TB_PREF."quick_entry_lines WHERE id=$selected_id"; + + db_query($sql,"could not delete quick entry line $selected_id"); +} +//--------------------------------------------------------------------------------------------- + + +function has_quick_entries($type=null) +{ + $sql = "SELECT id FROM ".TB_PREF."quick_entries"; + if ($type != null) + $sql .= " WHERE type=$type"; + + $result = db_query($sql, "could not retreive quick entries"); + return db_num_rows($result) > 0; +} + +function get_quick_entries($type = null) +{ + $sql = "SELECT * FROM ".TB_PREF."quick_entries"; + if ($type != null) + $sql .= " WHERE type=$type"; + $sql .= " ORDER BY description"; + + return db_query($sql, "could not retreive quick entries"); +} + +function get_quick_entry($selected_id) +{ + $sql = "SELECT * FROM ".TB_PREF."quick_entries WHERE id=$selected_id"; + + $result = db_query($sql, "could not retreive quick entry $selected_id"); + + return db_fetch($result); +} + +function get_quick_entry_lines($qid) +{ + $sql = "SELECT ".TB_PREF."quick_entry_lines.*, ".TB_PREF."chart_master.account_name, + ".TB_PREF."item_tax_types.name as tax_name + FROM ".TB_PREF."quick_entry_lines + LEFT JOIN ".TB_PREF."chart_master ON + ".TB_PREF."quick_entry_lines.dest_id = ".TB_PREF."chart_master.account_code + LEFT JOIN ".TB_PREF."item_tax_types ON + ".TB_PREF."quick_entry_lines.dest_id = ".TB_PREF."item_tax_types.id + WHERE + qid=$qid + ORDER by id"; + + return db_query($sql, "could not retreive quick entries"); +} + +function has_quick_entry_lines($qid) +{ + $sql = "SELECT id FROM ".TB_PREF."quick_entry_lines WHERE qid=$qid"; + + $result = db_query($sql, "could not retreive quick entries"); + return db_num_rows($result) > 0; +} //--------------------------------------------------------------------------------------------- -function get_bank_account($account_code) +function get_quick_entry_line($selected_id) { - $sql = "SELECT * FROM ".TB_PREF."bank_accounts WHERE account_code='$account_code'"; + $sql = "SELECT * FROM ".TB_PREF."quick_entry_lines WHERE id=$selected_id"; - $result = db_query($sql, "could not retreive bank account for $account_code"); + $result = db_query($sql, "could not retreive quick entry for $selected_id"); return db_fetch($result); } diff --git a/gl/includes/db/gl_db_bank_trans.inc b/gl/includes/db/gl_db_bank_trans.inc index 200277fb..de2ce486 100644 --- a/gl/includes/db/gl_db_bank_trans.inc +++ b/gl/includes/db/gl_db_bank_trans.inc @@ -1,12 +1,21 @@ . +***********************************************************************/ //---------------------------------------------------------------------------------- // add a bank transaction // $amount is in $currency // $date_ is display date (non-sql) -function add_bank_trans($type, $trans_no, $bank_act, $ref, $date_, $bank_trans_type_id, +function add_bank_trans($type, $trans_no, $bank_act, $ref, $date_, $amount, $person_type_id, $person_id, $currency="", $err_msg="") { $sqlDate = date2sql($date_); @@ -26,9 +35,9 @@ function add_bank_trans($type, $trans_no, $bank_act, $ref, $date_, $bank_trans_t //$BankToHomeCurrencyRate = get_exchange_rate_to_home_currency($bank_account_currency, $date_); $sql = "INSERT INTO ".TB_PREF."bank_trans (type, trans_no, bank_act, ref, - trans_date, bank_trans_type_id, amount, person_type_id, person_id) "; + trans_date, amount, person_type_id, person_id) "; - $sql .= "VALUES ($type, $trans_no, '$bank_act', ".db_escape($ref).", '$sqlDate', '$bank_trans_type_id', + $sql .= "VALUES ($type, $trans_no, '$bank_act', ".db_escape($ref).", '$sqlDate', $amount_bank, $person_type_id, ". db_escape($person_id).")"; if ($err_msg == "") @@ -52,10 +61,9 @@ function exists_bank_trans($type, $type_no) function get_bank_trans($type, $trans_no=null, $person_type_id=null, $person_id=null) { - $sql = "SELECT *, bank_account_name, account_code, bank_curr_code, name AS BankTransType - FROM ".TB_PREF."bank_trans, ".TB_PREF."bank_accounts, ".TB_PREF."bank_trans_types - WHERE ".TB_PREF."bank_trans_types.id = ".TB_PREF."bank_trans.bank_trans_type_id - AND ".TB_PREF."bank_accounts.account_code=".TB_PREF."bank_trans.bank_act "; + $sql = "SELECT *, bank_account_name, account_code, bank_curr_code + FROM ".TB_PREF."bank_trans, ".TB_PREF."bank_accounts + WHERE ".TB_PREF."bank_accounts.id=".TB_PREF."bank_trans.bank_act "; if ($type != null) $sql .= " AND type=$type "; if ($trans_no != null) @@ -103,6 +111,8 @@ function void_bank_trans($type, $type_no, $nested=false) void_supp_allocations($type, $type_no); void_supp_trans($type, $type_no); + void_trans_tax_details($type, $type_no); + if (!$nested) commit_transaction(); } diff --git a/gl/includes/db/gl_db_bank_trans_types.inc b/gl/includes/db/gl_db_bank_trans_types.inc deleted file mode 100644 index 7a6e5807..00000000 --- a/gl/includes/db/gl_db_bank_trans_types.inc +++ /dev/null @@ -1,40 +0,0 @@ - \ No newline at end of file diff --git a/gl/includes/db/gl_db_banking.inc b/gl/includes/db/gl_db_banking.inc index 25f61a4b..fd0c9174 100644 --- a/gl/includes/db/gl_db_banking.inc +++ b/gl/includes/db/gl_db_banking.inc @@ -1,6 +1,14 @@ . +***********************************************************************/ function add_exchange_variation($trans_type, $trans_no, $date_, $account, $currency, $person_type_id=null, $person_id = "") { @@ -41,9 +49,14 @@ function add_exchange_variation_all() $myrow['currency_code']); } //---------------------------------------------------------------------------------- +// Add bank tranfer to database. +// +// $from_account - source bank account id +// $to_account - target bank account id +// function add_bank_transfer($from_account, $to_account, $date_, - $amount, $payment_type, $ref, $memo_) + $amount, $ref, $memo_) { begin_transaction(); @@ -53,13 +66,16 @@ function add_bank_transfer($from_account, $to_account, $date_, $trans_no = get_next_trans_no($trans_type); + $from_gl_account = get_bank_gl_account($from_account); + $to_gl_account = get_bank_gl_account($to_account); + $total = 0; // do the source account postings - $total += add_gl_trans($trans_type, $trans_no, $date_, $from_account, 0, 0, "", + $total += add_gl_trans($trans_type, $trans_no, $date_, $from_gl_account, 0, 0, "", -$amount, $currency); add_bank_trans($trans_type, $trans_no, $from_account, $ref, - $date_, $payment_type, -$amount, + $date_, -$amount, payment_person_types::misc(), "", $currency, "Cannot insert a source bank transaction"); @@ -67,17 +83,15 @@ function add_bank_transfer($from_account, $to_account, $date_, $currency, payment_person_types::misc(), ""); // do the destination account postings - $total += add_gl_trans($trans_type, $trans_no, $date_, $to_account, 0, 0, "", + $total += add_gl_trans($trans_type, $trans_no, $date_, $to_gl_account, 0, 0, "", $amount, $currency); /*Post a balance post if $total != 0 */ add_gl_balance($trans_type, $trans_no, $date_, -$total); add_bank_trans($trans_type, $trans_no, $to_account, $ref, - $date_, $payment_type, $amount, - payment_person_types::misc(), "", - $currency, - "Cannot insert a destination bank transaction"); + $date_, $amount, payment_person_types::misc(), "", + $currency, "Cannot insert a destination bank transaction"); add_exchange_variation($trans_type, $trans_no, $date_, $from_account, $currency, payment_person_types::misc(), ""); @@ -92,13 +106,18 @@ function add_bank_transfer($from_account, $to_account, $date_, } //---------------------------------------------------------------------------------- - -// $amount is in $from_account's currency - +// Add bank payment or deposit to database. +// +// $from_account - bank account id +// $item - transaction cart (line item's amounts in bank account's currency) +// $person_type_id - defines type of $person_id identifiers +// $person_id - supplier/customer/other id +// $person_detail_id - customer branch id or not used +// // returns an array of (inserted trans type, trans no) function add_bank_transaction($trans_type, $from_account, $items, $date_, - $person_type_id, $person_id, $person_detail_id, $type, $ref, $memo_) + $person_type_id, $person_id, $person_detail_id, $ref, $memo_) { // we can only handle type 1 (payment)and type 2 (deposit) if ($trans_type != systypes::bank_payment() && $trans_type != systypes::bank_deposit()) @@ -109,6 +128,7 @@ function add_bank_transaction($trans_type, $from_account, $items, $date_, begin_transaction(); $currency = get_bank_account_currency($from_account); + $bank_gl_account = get_bank_gl_account($from_account); // the gl items are already inversed/negated for type 2 (deposit) $total_amount = $items->gl_items_total(); @@ -145,8 +165,10 @@ function add_bank_transaction($trans_type, $from_account, $items, $date_, $do_exchange_variance = true; } + // do the source account postings + add_bank_trans($trans_type, $trans_no, $from_account, $ref, - $date_, $type, -$total_amount, + $date_, -$total_amount, $person_type_id, $person_id, $currency, "Cannot insert a source bank transaction"); @@ -169,17 +191,24 @@ function add_bank_transaction($trans_type, $from_account, $items, $date_, if ($is_bank_to) { add_bank_trans($trans_type, $trans_no, $gl_item->code_id, $ref, - $date_, $type, $gl_item->amount, + $date_, $gl_item->amount, $person_type_id, $person_id, $currency, "Cannot insert a destination bank transaction"); if ($do_exchange_variance) add_exchange_variation($trans_type, $trans_no, $date_, $gl_item->code_id, $currency, $person_type_id, $person_id); } + // store tax details if the gl account is a tax account + + $amount = $gl_item->amount; + $ex_rate = get_exchange_rate_from_home_currency($currency, $date_); + + add_gl_tax_details($gl_item->code_id, $trans_type, $trans_no, $amount, + $ex_rate, $date_, $memo_); } // do the source account postings - add_gl_trans($trans_type, $trans_no, $date_, $from_account, 0, 0, "", + add_gl_trans($trans_type, $trans_no, $date_, $bank_gl_account, 0, 0, $memo_, -$total, null, $person_type_id, $person_id); if ($do_exchange_variance) diff --git a/gl/includes/db/gl_db_currencies.inc b/gl/includes/db/gl_db_currencies.inc index a4d7e2d4..0c386f83 100644 --- a/gl/includes/db/gl_db_currencies.inc +++ b/gl/includes/db/gl_db_currencies.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ //--------------------------------------------------------------------------------------------- function update_currency($curr_abrev, $symbol, $currency, $country, $hundreds_name) diff --git a/gl/includes/db/gl_db_rates.inc b/gl/includes/db/gl_db_rates.inc index cba2e5af..0c9ae686 100644 --- a/gl/includes/db/gl_db_rates.inc +++ b/gl/includes/db/gl_db_rates.inc @@ -1,15 +1,15 @@ . +***********************************************************************/ //--------------------------------------------------------------------------------------------- - function get_exchange_rate($rate_id) { $sql = "SELECT * FROM ".TB_PREF."exchange_rates WHERE id=$rate_id"; @@ -74,32 +74,44 @@ function delete_exchange_rate($rate_id) function get_ecb_rate($curr_b) { $curr_a = get_company_pref('curr_default'); - $ecb_filename = 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml'; - $handle = @fopen($ecb_filename, 'rb'); + $ecb_filename = '/stats/eurofxref/eurofxref-daily.xml'; + $ecb_site = 'www.ecb.int'; $contents = ''; - if ($handle) - { - do - { - $data = @fread( $handle, 4096 ); - if ( strlen ( $data ) == 0 ) - break; - $contents .= $data; // with this syntax only text will be translated, whole text with htmlspecialchars($data) - } - while (true); - @fclose( $handle ); - } // end handle - else - { - $ch = curl_init(); - curl_setopt ($ch, CURLOPT_URL, $ecb_filename); - curl_setopt ($ch, CURLOPT_COOKIEJAR, "cookie.txt"); - curl_setopt ($ch, CURLOPT_HEADER, 0); - curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); - curl_setopt ($ch, CURLOPT_TIMEOUT, 120); - $contents = curl_exec ($ch); - curl_close($ch); + + if (function_exists('curl_init')) + { // first check with curl as we can set short timeout; + $retry = 1; + do { + $ch = curl_init(); + curl_setopt ($ch, CURLOPT_URL, 'http://'.$ecb_site.$ecb_filename); + curl_setopt ($ch, CURLOPT_COOKIEJAR, "cookie.txt"); + curl_setopt ($ch, CURLOPT_HEADER, 0); + curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt ($ch, CURLOPT_TIMEOUT, 3); + $contents = curl_exec ($ch); + curl_close($ch); + // due to resolver bug in some curl versions (e.g. 7.15.5) + // try again for constant IP. + $ecb_site="195.128.2.97"; + } while( ($contents == '') && $retry--); + + } else { + $handle = @fopen("http://".$ecb_site.$ecb_filename, 'rb'); + if ($handle) { + do + { + $data = @fread( $handle, 4096 ); + if ( strlen ( $data ) == 0 ) + break; + $contents .= $data; // with this syntax only text will be translated, whole text with htmlspecialchars($data) + } + while (true); + @fclose( $handle ); + } // end handle + } + if (!$contents) { + display_warning(_('Cannot retrieve currency rate from ECB page. Please set the rate manually.')); } $contents = str_replace (" |i"; @@ -119,6 +131,6 @@ function get_ecb_rate($curr_b) $val = 0; } return $val; -} // end function get_ecb_rate +} // end function get_ecb_rate ?> \ No newline at end of file diff --git a/gl/includes/db/gl_db_trans.inc b/gl/includes/db/gl_db_trans.inc index 60b173d6..89eaa252 100644 --- a/gl/includes/db/gl_db_trans.inc +++ b/gl/includes/db/gl_db_trans.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ //-------------------------------------------------------------------------------- // Base function for adding a GL transaction @@ -200,7 +209,105 @@ function get_budget_trans_from_to($from_date, $to_date, $account, $dimension=0, } //-------------------------------------------------------------------------------- +// Stores journal/bank transaction tax details if applicable +// +function add_gl_tax_details($gl_code, $trans_type, $trans_no, $amount, $ex_rate, $date, $memo) +{ + $tax_type = is_tax_account($gl_code); + if(!$tax_type) return; // $gl_code is not tax account + + $tax = get_tax_type($tax_type); + if ($gl_code == $tax['sales_gl_code']) + $amount = -$amount; + // we have to restore net amount as we cannot know the base amount + if ($tax['rate'] == 0) { +// display_warning(_("You should not post gl transactions +// to tax account with zero tax rate.")); + $net_amount = 0; + } else { + // calculate net amount + $net_amount = $amount/$tax['rate']*100; + } + + add_trans_tax_details($trans_type, $trans_no, $tax['id'], $tax['rate'], 0, + $amount, $net_amount, $ex_rate, $date, $memo); + +} + +//-------------------------------------------------------------------------------- +// +// Store transaction tax details for fiscal purposes with 'freezed' +// actual tax type rate. +// +function add_trans_tax_details($trans_type, $trans_no, $tax_id, $rate, $included, + $amount, $net_amount, $ex_rate, $tran_date, $memo) +{ + + $sql = "INSERT INTO ".TB_PREF."trans_tax_details + (trans_type, trans_no, tran_date, tax_type_id, rate, ex_rate, + included_in_price, net_amount, amount, memo) + VALUES (".db_escape($trans_type)."," . db_escape($trans_no).",'" + .date2sql($tran_date)."',".db_escape($tax_id)."," + .$rate.",".$ex_rate.",".($included ? 1:0)."," + .db_escape($net_amount)."," + .db_escape($amount).",".db_escape($memo).")"; + db_query($sql, "Cannot save trans tax details"); + +} +//---------------------------------------------------------------------------------------- + +function get_trans_tax_details($trans_type, $trans_no) +{ + $sql = "SELECT ".TB_PREF."trans_tax_details.*, ".TB_PREF."tax_types.name AS tax_type_name + FROM ".TB_PREF."trans_tax_details,".TB_PREF."tax_types + WHERE trans_type = $trans_type + AND trans_no = $trans_no + AND (net_amount != 0 OR amount != 0) + AND ".TB_PREF."tax_types.id = ".TB_PREF."trans_tax_details.tax_type_id"; + + return db_query($sql, "The transaction tax details could not be retrieved"); +} + +//---------------------------------------------------------------------------------------- + +function void_trans_tax_details($type, $type_no) +{ + $sql = "UPDATE ".TB_PREF."trans_tax_details SET amount=0, net_amount=0 + WHERE trans_no=$type_no + AND trans_type=$type"; + + db_query($sql, "The transaction tax details could not be voided"); +} + +function get_tax_summary($from, $to) +{ + $fromdate = date2sql($from); + $todate = date2sql($to); + + $sql = "SELECT + SUM(IF( trans_type=1 || trans_type=11 || trans_type=20,-1,1)* + IF(trans_type=0 || trans_type=2 || trans_type=10 || trans_type=11, net_amount*ex_rate,0)) net_output, + SUM(IF( trans_type=1 || trans_type=11 || trans_type=20,-1,1)* + IF(trans_type=0 || trans_type=2 || trans_type=10 || trans_type=11, amount*ex_rate,0)) payable, + SUM(IF( trans_type=1 || trans_type=11 || trans_type=20,-1,1)* + IF(trans_type=0 || trans_type=2 || trans_type=10 || trans_type=11, 0, net_amount*ex_rate)) net_input, + SUM(IF( trans_type=1 || trans_type=11 || trans_type=20,-1,1)* + IF(trans_type=0 || trans_type=2 || trans_type=10 || trans_type=11, 0, amount*ex_rate)) collectible, + taxrec.rate, + ttype.id, + ttype.name + FROM ".TB_PREF."tax_types ttype, + ".TB_PREF."trans_tax_details taxrec + WHERE taxrec.tax_type_id=ttype.id + AND taxrec.trans_type != 13 + AND taxrec.tran_date >= '$fromdate' + AND taxrec.tran_date <= '$todate' + GROUP BY ttype.id"; +//display_error($sql); + return db_query($sql,"Cannot retrieve tax summary"); +} +//-------------------------------------------------------------------------------- function add_journal_entries($items, $date_, $ref, $reverse, $memo_=null) { begin_transaction(); @@ -210,6 +317,7 @@ function add_journal_entries($items, $date_, $ref, $reverse, $memo_=null) foreach ($items as $journal_item) { + // post to first found bank account using given gl acount code. $is_bank_to = is_bank_account($journal_item->code_id); add_gl_trans($trans_type, $trans_id, $date_, $journal_item->code_id, @@ -217,13 +325,16 @@ function add_journal_entries($items, $date_, $ref, $reverse, $memo_=null) $journal_item->reference, $journal_item->amount); if ($is_bank_to) { - add_bank_trans($trans_type, $trans_id, $journal_item->code_id, $ref, - $date_, 3, $journal_item->amount, + add_bank_trans($trans_type, $trans_id, $is_bank_to, $ref, + $date_, $journal_item->amount, 0, "", get_company_currency(), "Cannot insert a destination bank transaction"); } + // store tax details if the gl account is a tax account + add_gl_tax_details($journal_item->code_id, + $trans_type, $trans_id, -$journal_item->amount, 1, $date_, $memo_); } - + add_comments($trans_type, $trans_id, $date_, $memo_); references::save($trans_type, $trans_id, $ref); @@ -246,11 +357,14 @@ function add_journal_entries($items, $date_, $ref, $reverse, $memo_=null) $journal_item->reference, -$journal_item->amount); if ($is_bank_to) { - add_bank_trans($trans_type, $trans_id_reverse, $journal_item->code_id, $ref, - $reversingDate, 3, $journal_item->amount, + add_bank_trans($trans_type, $trans_id_reverse, $is_bank_to, $ref, + $reversingDate, $journal_item->amount, 0, "", get_company_currency(), "Cannot insert a destination bank transaction"); } + // store tax details if the gl account is a tax account + add_gl_tax_details($journal_item->code_id, + $trans_type, $trans_id, $journal_item->amount, 1, $date, $memo_); } add_comments($trans_type, $trans_id_reverse, $reversingDate, $memo_); @@ -288,6 +402,17 @@ function void_gl_trans($type, $trans_id, $nested=false) commit_transaction(); } -//-------------------------------------------------------------------------------------------------- +//---------------------------------------------------------------------------------------- + +function void_journal_trans($type, $type_no) +{ + begin_transaction(); + + void_gl_trans($type, $type_no, true); + void_bank_trans($type, $type_no,true); + void_trans_tax_details($type, $type_no); + + commit_transaction(); +} ?> \ No newline at end of file diff --git a/gl/includes/gl_db.inc b/gl/includes/gl_db.inc index 16d8d101..8f6efddd 100644 --- a/gl/includes/gl_db.inc +++ b/gl/includes/gl_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ include_once($path_to_root . "/includes/banking.inc"); include_once($path_to_root . "/gl/includes/db/gl_db_trans.inc"); @@ -10,11 +19,5 @@ include_once($path_to_root . "/gl/includes/db/gl_db_currencies.inc"); include_once($path_to_root . "/gl/includes/db/gl_db_rates.inc"); include_once($path_to_root . "/gl/includes/db/gl_db_accounts.inc"); include_once($path_to_root . "/gl/includes/db/gl_db_account_types.inc"); -include_once($path_to_root . "/gl/includes/db/gl_db_bank_trans_types.inc"); - //-------------------------------------------------------------------------------- - - - - ?> \ No newline at end of file diff --git a/gl/includes/gl_ui.inc b/gl/includes/gl_ui.inc index 998b3adb..fc2b7b52 100644 --- a/gl/includes/gl_ui.inc +++ b/gl/includes/gl_ui.inc @@ -1,5 +1,13 @@ . +***********************************************************************/ include_once($path_to_root . "/includes/ui.inc"); - ?> \ No newline at end of file diff --git a/gl/includes/ui/gl_bank_ui.inc b/gl/includes/ui/gl_bank_ui.inc index 61c5250a..561c677a 100644 --- a/gl/includes/ui/gl_bank_ui.inc +++ b/gl/includes/ui/gl_bank_ui.inc @@ -1,25 +1,30 @@ . +***********************************************************************/ function display_bank_header(&$order) { global $table_style2, $Ajax; $payment = $order->trans_type == systypes::bank_payment(); div_start('pmt_header'); - start_table("width=90% $table_style2"); // outer table - echo ""; + end_outer_table(1); // outer table - end_table(1); // outer table div_end(); } //--------------------------------------------------------------------------------- @@ -112,13 +119,13 @@ function display_gl_items($title, &$order) if ($dim == 2) $th = array(_("Account Code"), _("Account Description"), _("Dimension")." 1", - _("Dimension")." 2", _("Amount"), _("Memo")); + _("Dimension")." 2", _("Amount"), _("Memo"), ""); else if ($dim == 1) $th = array(_("Account Code"), _("Account Description"), _("Dimension"), - _("Amount"), _("Memo")); + _("Amount"), _("Memo"), ""); else $th = array(_("Account Code"), _("Account Description"), - _("Amount"), _("Memo")); + _("Amount"), _("Memo"), ""); if (count($order->gl_items)) $th[] = ''; @@ -138,12 +145,16 @@ function display_gl_items($title, &$order) label_cell(get_dimension_string($item->dimension_id, true)); if ($dim > 1) label_cell(get_dimension_string($item->dimension2_id, true)); - amount_cell(abs($item->amount)); + //amount_cell(abs($item->amount)); + if ($order->trans_type == systypes::bank_deposit()) + amount_cell(-$item->amount); + else + amount_cell($item->amount); label_cell($item->reference); edit_button_cell("Edit$item->index", _("Edit"), _('Edit document line')); - edit_button_cell("Delete$item->index", _("Delete"), + delete_button_cell("Delete$item->index", _("Delete"), _('Remove line from document')); end_row(); } @@ -218,7 +229,7 @@ function gl_edit_item_controls(&$order, $dim, $Index=null) $_POST['code_id'] = get_company_pref($payment ? 'default_cogs_act':'default_inv_sales_act'); } - gl_all_accounts_list('code_id', null, true, false, true); + gl_all_accounts_list('code_id', null, false, true); if ($dim >= 1) dimensions_list_cells(null, 'dimension_id', null, true, " ", false, 1); if ($dim > 1) @@ -234,10 +245,10 @@ function gl_edit_item_controls(&$order, $dim, $Index=null) if ($id != -1) { - edit_button_cell('UpdateItem', _("Update"), - _('Confirm changes')); - edit_button_cell('CancelItemChanges', _("Cancel"), - _('Cancel changes')); + button_cell('UpdateItem', _("Update"), + _('Confirm changes'), ICON_UPDATE); + button_cell('CancelItemChanges', _("Cancel"), + _('Cancel changes'), ICON_CANCEL); set_focus('amount'); } else diff --git a/gl/includes/ui/gl_journal_ui.inc b/gl/includes/ui/gl_journal_ui.inc index a8878fcf..bc68af7c 100644 --- a/gl/includes/ui/gl_journal_ui.inc +++ b/gl/includes/ui/gl_journal_ui.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ include_once($path_to_root . "/includes/ui.inc"); include_once($path_to_root . "/includes/ui/items_cart.inc"); @@ -9,27 +18,41 @@ function display_order_header(&$Order) { global $table_style2; - start_table("$table_style2 width=90%"); - echo ""; // outer table - end_table(1); + } + + end_outer_table(1); } //--------------------------------------------------------------------------------- @@ -46,13 +69,13 @@ function display_gl_items($title, &$order) start_table("$table_style colspan=7 width=95%"); if ($dim == 2) $th = array(_("Account Code"), _("Account Description"), _("Dimension")." 1", - _("Dimension")." 2", _("Debit"), _("Credit"), _("Memo")); + _("Dimension")." 2", _("Debit"), _("Credit"), _("Memo"), ""); else if ($dim == 1) $th = array(_("Account Code"), _("Account Description"), _("Dimension"), - _("Debit"), _("Credit"), _("Memo")); + _("Debit"), _("Credit"), _("Memo"), ""); else $th = array(_("Account Code"), _("Account Description"), - _("Debit"), _("Credit"), _("Memo")); + _("Debit"), _("Credit"), _("Memo"), ""); if (count($order->gl_items)) $th[] = ''; @@ -86,7 +109,7 @@ function display_gl_items($title, &$order) edit_button_cell("Edit$item->index", _("Edit"), _('Edit journal line')); - edit_button_cell("Delete$item->index", _("Delete"), + delete_button_cell("Delete$item->index", _("Delete"), _('Remove line from journal')); end_row(); } @@ -127,8 +150,16 @@ function gl_edit_item_controls(&$order, $dim, $Index=null) $_POST['code_id'] = $item->code_id; $_POST['dimension_id'] = $item->dimension_id; $_POST['dimension2_id'] = $item->dimension2_id; - $_POST['AmountDebit'] = price_format($item->amount); - $_POST['AmountCredit'] = price_format(abs($item->amount)); + if ($item->amount > 0) + { + $_POST['AmountDebit'] = price_format($item->amount); + $_POST['AmountCredit'] = ""; + } + else + { + $_POST['AmountDebit'] = ""; + $_POST['AmountCredit'] = price_format(abs($item->amount)); + } $_POST['description'] = $item->description; $_POST['LineMemo'] = $item->reference; @@ -156,7 +187,7 @@ function gl_edit_item_controls(&$order, $dim, $Index=null) } $skip_bank = ($_SESSION["wa_current_user"]->access != 2); - gl_all_accounts_list('code_id', null, $skip_bank, false, true); + gl_all_accounts_list('code_id', null, $skip_bank, true); if ($dim >= 1) dimensions_list_cells(null, 'dimension_id', null, true, " ", false, 1); if ($dim > 1) @@ -173,10 +204,10 @@ function gl_edit_item_controls(&$order, $dim, $Index=null) if ($id != -1) { - edit_button_cell('UpdateItem', _("Update"), - _('Confirm changes')); - edit_button_cell('CancelItemChanges', _("Cancel"), - _('Cancel changes')); + button_cell('UpdateItem', _("Update"), + _('Confirm changes'), ICON_UPDATE); + button_cell('CancelItemChanges', _("Cancel"), + _('Cancel changes'), ICON_CANCEL); set_focus('amount'); } else diff --git a/gl/inquiry/bank_inquiry.php b/gl/inquiry/bank_inquiry.php index f6ffdba7..94ccef8d 100644 --- a/gl/inquiry/bank_inquiry.php +++ b/gl/inquiry/bank_inquiry.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 8; $path_to_root="../.."; include_once($path_to_root . "/includes/session.inc"); @@ -49,11 +58,10 @@ $date_after = date2sql($_POST['TransAfterDate']); $date_to = date2sql($_POST['TransToDate']); if (!isset($_POST['bank_account'])) $_POST['bank_account'] = ""; -$sql = "SELECT ".TB_PREF."bank_trans.*,name AS BankTransType FROM ".TB_PREF."bank_trans, ".TB_PREF."bank_trans_types +$sql = "SELECT ".TB_PREF."bank_trans.* FROM ".TB_PREF."bank_trans WHERE ".TB_PREF."bank_trans.bank_act = '" . $_POST['bank_account'] . "' AND trans_date >= '$date_after' AND trans_date <= '$date_to' - AND ".TB_PREF."bank_trans_types.id = ".TB_PREF."bank_trans.bank_trans_type_id ORDER BY trans_date,".TB_PREF."bank_trans.id"; $result = db_query($sql,"The transactions for '" . $_POST['bank_account'] . "' could not be retrieved"); @@ -64,7 +72,7 @@ display_heading($act['bank_account_name']." - ".$act['bank_curr_code']); start_table($table_style); -$th = array(_("Type"), _("#"), _("Reference"), _("Type"), _("Date"), +$th = array(_("Type"), _("#"), _("Reference"), _("Date"), _("Debit"), _("Credit"), _("Balance"), _("Person/Item"), ""); table_header($th); @@ -73,11 +81,12 @@ $sql = "SELECT SUM(amount) FROM ".TB_PREF."bank_trans WHERE bank_act='" . $_POST $before_qty = db_query($sql, "The starting balance on hand could not be calculated"); start_row("class='inquirybg'"); -label_cell(""._("Opening Balance")." - ".$_POST['TransAfterDate']."", "colspan=5"); +label_cell(""._("Opening Balance")." - ".$_POST['TransAfterDate']."", "colspan=4"); $bfw_row = db_fetch_row($before_qty); $bfw = $bfw_row[0]; display_debit_or_credit_cells($bfw); label_cell(""); +label_cell("", "colspan=2"); end_row(); $running_total = $bfw; @@ -94,7 +103,6 @@ while ($myrow = db_fetch($result)) label_cell(systypes::name($myrow["type"])); label_cell(get_trans_view_str($myrow["type"],$myrow["trans_no"])); label_cell(get_trans_view_str($myrow["type"],$myrow["trans_no"],$myrow['ref'])); - label_cell($myrow["BankTransType"]); label_cell($trandate); display_debit_or_credit_cells($myrow["amount"]); amount_cell($running_total); @@ -112,9 +120,10 @@ while ($myrow = db_fetch($result)) //end of while loop start_row("class='inquirybg'"); -label_cell("" . _("Ending Balance")." - ". $_POST['TransToDate']. "", "colspan=5"); +label_cell("" . _("Ending Balance")." - ". $_POST['TransToDate']. "", "colspan=4"); display_debit_or_credit_cells($running_total); label_cell(""); +label_cell("", "colspan=2"); end_row(); end_table(2); div_end(); diff --git a/gl/inquiry/gl_account_inquiry.php b/gl/inquiry/gl_account_inquiry.php index 6f1378a8..22b31a78 100644 --- a/gl/inquiry/gl_account_inquiry.php +++ b/gl/inquiry/gl_account_inquiry.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 8; $path_to_root="../.."; include_once($path_to_root . "/includes/session.inc"); @@ -120,6 +129,7 @@ function show_results() label_cell(""._("Opening Balance")." - ".$_POST['TransFromDate']."", "colspan=$colspan"); display_debit_or_credit_cells($bfw); label_cell(""); + label_cell(""); end_row(); //$running_total =0; $running_total = $bfw; @@ -161,6 +171,7 @@ function show_results() label_cell("" . _("Ending Balance") ." - ".$_POST['TransToDate']. "", "colspan=$colspan"); display_debit_or_credit_cells($running_total); label_cell(""); + label_cell(""); end_row(); end_table(2); diff --git a/gl/inquiry/gl_trial_balance.php b/gl/inquiry/gl_trial_balance.php index 8d1ad8bc..27fc37df 100644 --- a/gl/inquiry/gl_trial_balance.php +++ b/gl/inquiry/gl_trial_balance.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 8; $path_to_root="../.."; @@ -46,7 +55,7 @@ function gl_inquiry_controls() function get_balance($account, $from, $to, $from_incl=true, $to_incl=true) { - $sql = "SELECT SUM(IF(amount >= 0, amount, 0)) as debit, SUM(IF(amount < 0, -amount, 0)) as credit, SUM(amount) as balance + $sql = "SELECT SUM(IF(amount >= 0, amount, 0)) AS debit, SUM(IF(amount < 0, -amount, 0)) AS credit, SUM(amount) AS balance FROM ".TB_PREF."gl_trans,".TB_PREF."chart_master,".TB_PREF."chart_types, ".TB_PREF."chart_class WHERE ".TB_PREF."gl_trans.account=".TB_PREF."chart_master.account_code AND ".TB_PREF."chart_master.account_type=".TB_PREF."chart_types.id AND ".TB_PREF."chart_types.class_id=".TB_PREF."chart_class.cid AND"; diff --git a/gl/manage/bank_accounts.php b/gl/manage/bank_accounts.php index 5081e3b5..e794f697 100644 --- a/gl/manage/bank_accounts.php +++ b/gl/manage/bank_accounts.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 10; $path_to_root="../.."; include($path_to_root . "/includes/session.inc"); @@ -30,17 +39,19 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') if ($selected_id != -1) { - update_bank_account($selected_id, $_POST['account_type'], $_POST['bank_account_name'], $_POST['bank_name'], - $_POST['bank_account_number'], + update_bank_account($selected_id, $_POST['account_code'], + $_POST['account_type'], $_POST['bank_account_name'], + $_POST['bank_name'], $_POST['bank_account_number'], $_POST['bank_address'], $_POST['BankAccountCurrency']); display_notification(_('Bank account has been updated')); } else { - add_bank_account($_POST['account_code'], $_POST['account_type'], $_POST['bank_account_name'], $_POST['bank_name'], - $_POST['bank_account_number'], - $_POST['bank_address'], $_POST['BankAccountCurrency']); + add_bank_account($_POST['account_code'], $_POST['account_type'], + $_POST['bank_account_name'], $_POST['bank_name'], + $_POST['bank_account_number'], $_POST['bank_address'], + $_POST['BankAccountCurrency']); display_notification(_('New bank account has been added')); } $Mode = 'RESET'; @@ -62,6 +73,14 @@ elseif( $Mode == 'Delete') $cancel_delete = 1; display_error(_("Cannot delete this bank account because transactions have been created using this account.")); } + $sql= "SELECT COUNT(*) FROM ".TB_PREF."sales_pos WHERE pos_account='$selected_id'"; + $result = db_query($sql,"check failed"); + $myrow = db_fetch_row($result); + if ($myrow[0] > 0) + { + $cancel_delete = 1; + display_error(_("Cannot delete this bank account because POS definitions have been created using this account.")); + } if (!$cancel_delete) { delete_bank_account($selected_id); @@ -79,8 +98,11 @@ if ($Mode == 'RESET') /* Always show the list of accounts */ -$sql = "SELECT ".TB_PREF."bank_accounts.*, ".TB_PREF."chart_master.account_name FROM ".TB_PREF."bank_accounts, ".TB_PREF."chart_master - WHERE ".TB_PREF."bank_accounts.account_code = ".TB_PREF."chart_master.account_code"; +$sql = "SELECT account.*, gl_account.account_name + FROM ".TB_PREF."bank_accounts account, ".TB_PREF."chart_master gl_account + WHERE account.account_code = gl_account.account_code" + ." ORDER BY account_code, bank_curr_code"; + $result = db_query($sql,"could not get bank accounts"); check_db_error("The bank accounts set up could not be retreived", $sql); @@ -88,8 +110,8 @@ check_db_error("The bank accounts set up could not be retreived", $sql); start_form(); start_table("$table_style width='80%'"); -$th = array(_("GL Account"), _("Bank"), _("Account Name"), - _("Type"), _("Number"), _("Currency"), _("Bank Address"),'',''); +$th = array(_("Account Name"), _("Type"), _("Currency"), _("GL Account"), + _("Bank"), _("Number"), _("Bank Address"),'',''); table_header($th); $k = 0; @@ -98,15 +120,15 @@ while ($myrow = db_fetch($result)) alt_table_row_color($k); - label_cell($myrow["account_code"] . " " . $myrow["account_name"], "nowrap"); - label_cell($myrow["bank_name"], "nowrap"); label_cell($myrow["bank_account_name"], "nowrap"); label_cell(bank_account_types::name($myrow["account_type"]), "nowrap"); - label_cell($myrow["bank_account_number"], "nowrap"); label_cell($myrow["bank_curr_code"], "nowrap"); + label_cell($myrow["account_code"] . " " . $myrow["account_name"], "nowrap"); + label_cell($myrow["bank_name"], "nowrap"); + label_cell($myrow["bank_account_number"], "nowrap"); label_cell($myrow["bank_address"]); - edit_button_cell("Edit".$myrow["account_code"], _("Edit")); - edit_button_cell("Delete".$myrow["account_code"], _("Delete")); + edit_button_cell("Edit".$myrow["id"], _("Edit")); + delete_button_cell("Delete".$myrow["id"], _("Delete")); end_row(); } @@ -135,20 +157,12 @@ if ($is_editing) hidden('selected_id', $selected_id); hidden('account_code'); hidden('BankAccountCurrency', $_POST['BankAccountCurrency']); - label_row(_("Bank Account GL Code:"), $_POST['account_code']); - set_focus('account_type'); + set_focus('bank_account_name'); } -else -{ - gl_all_accounts_list_row(_("Bank Account GL Code:"), 'account_code', null, true); - set_focus('account_code'); -} -bank_account_types_list_row(_("Account Type:"), 'account_type', null); - -text_row(_("Bank Name:"), 'bank_name', null, 50, 60); text_row(_("Bank Account Name:"), 'bank_account_name', null, 50, 100); -text_row(_("Bank Account Number:"), 'bank_account_number', null, 30, 60); + +bank_account_types_list_row(_("Account Type:"), 'account_type', null); if ($is_editing) { @@ -159,6 +173,13 @@ else currencies_list_row(_("Bank Account Currency:"), 'BankAccountCurrency', null); } +if($is_editing) + label_row(_("Bank Account GL Code:"), $_POST['account_code']); +else + gl_all_accounts_list_row(_("Bank Account GL Code:"), 'account_code', null); + +text_row(_("Bank Name:"), 'bank_name', null, 50, 60); +text_row(_("Bank Account Number:"), 'bank_account_number', null, 30, 60); textarea_row(_("Bank Address:"), 'bank_address', null, 40, 5); end_table(1); diff --git a/gl/manage/bank_trans_types.php b/gl/manage/bank_trans_types.php deleted file mode 100644 index 6c5b1dd7..00000000 --- a/gl/manage/bank_trans_types.php +++ /dev/null @@ -1,136 +0,0 @@ - 0) - { - display_error(_("Cannot delete this bank transaction type because bank transactions have been created referring to it.")); - return false; - } - - return true; -} - - -//----------------------------------------------------------------------------------- - -if( $Mode == 'Delete') -{ - if (can_delete($selected_id)) - { - delete_bank_trans_type($selected_id); - display_notification(_('Selected bank account has been deleted')); - } - $Mode = 'RESET'; -} - -if ($Mode == 'RESET') -{ - $selected_id = -1; - $_POST['name'] = ''; -} -//----------------------------------------------------------------------------------- - -$result = get_all_bank_trans_type(); - -start_form(); -start_table($table_style); - -$th = array(_("Description"), "", ""); -table_header($th); -$k = 0; -while ($myrow = db_fetch($result)) -{ - - alt_table_row_color($k); - - label_cell($myrow["name"]); - - edit_button_cell("Edit".$myrow["id"], _("Edit")); - edit_button_cell("Delete".$myrow["id"], _("Delete")); - end_row(); -} -end_table(); -end_form(); -echo '
'; -//----------------------------------------------------------------------------------- - -start_form(); - -start_table($table_style2); - -if ($selected_id != -1) -{ - //editing an existing status code - if ($Mode == 'Edit') { - $myrow = get_bank_trans_type($selected_id); - $_POST['name'] = $myrow["name"]; - } - hidden('selected_id', $selected_id); -} - -set_focus('name'); -text_row_ex(_("Description:"), 'name', 40); - -end_table(1); - -submit_add_or_update_center($selected_id == -1, '', true); - -end_form(); - -//------------------------------------------------------------------------------------ - -end_page(); - -?> diff --git a/gl/manage/currencies.php b/gl/manage/currencies.php index eadbaf92..f1b91de0 100644 --- a/gl/manage/currencies.php +++ b/gl/manage/currencies.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 9; $path_to_root="../.."; include_once($path_to_root . "/includes/session.inc"); @@ -165,7 +174,7 @@ function display_currencies() label_cell($myrow["country"]); edit_button_cell("Edit".$myrow["curr_abrev"], _("Edit")); if ($myrow["curr_abrev"] != $company_currency) - edit_button_cell("Delete".$myrow["curr_abrev"], _("Delete")); + delete_button_cell("Delete".$myrow["curr_abrev"], _("Delete")); else label_cell(''); end_row(); diff --git a/gl/manage/exchange_rates.php b/gl/manage/exchange_rates.php index 5cd3ed21..493509f9 100644 --- a/gl/manage/exchange_rates.php +++ b/gl/manage/exchange_rates.php @@ -1,7 +1,17 @@ . +***********************************************************************/ $page_security = 9; $path_to_root="../.."; +include($path_to_root . "/includes/db_pager.inc"); include_once($path_to_root . "/includes/session.inc"); include_once($path_to_root . "/includes/date_functions.inc"); @@ -78,35 +88,20 @@ function handle_delete() } //--------------------------------------------------------------------------------------------- +function edit_link($row) +{ + return button('Edit'.$row["id"], _("Edit"), true, ICON_EDIT); +} + +function del_link($row) +{ + return button('Delete'.$row["id"], _("Delete"), true, ICON_DELETE); +} function display_rates($curr_code) { global $table_style; - $result = get_exchange_rates($curr_code); - - br(2); - start_table($table_style); - $th = array(_("Date to Use From"), _("Exchange Rate"), "", ""); - table_header($th); - - $k = 0; //row colour counter - - while ($myrow = db_fetch($result)) - { - - alt_table_row_color($k); - - label_cell(sql2date($myrow["date_"])); - label_cell(number_format2($myrow["rate_buy"], user_exrate_dec()), "nowrap align=right"); - edit_button_cell("Edit".$myrow["id"], _("Edit")); - edit_button_cell("Delete".$myrow["id"], _("Delete")); - - end_row(); - - } - - end_table(); } //--------------------------------------------------------------------------------------------- @@ -140,9 +135,6 @@ function display_rate_edit() if (isset($_POST['get_rate'])) { $_POST['BuyRate'] = exrate_format(get_ecb_rate($_POST['curr_abrev'])); - if ($_POST['BuyRate'] == 0) { - display_error(_('This currency is not listed by ECB. Enter exchange rate manually.')); - } $Ajax->activate('BuyRate'); } small_amount_row(_("Exchange Rate:"), 'BuyRate', null, '', @@ -197,6 +189,19 @@ if ($_POST['curr_abrev'] != get_global_curr_code()) set_global_curr_code($_POST['curr_abrev']); +$sql = "SELECT date_, rate_buy, id FROM " + .TB_PREF."exchange_rates " + ."WHERE curr_code='".$_POST['curr_abrev']."' + ORDER BY date_ DESC"; + +$cols = array( + _("Date to Use From") => 'date', + _("Exchange Rate") => 'rate', + array('insert'=>true, 'fun'=>'edit_link'), + array('insert'=>true, 'fun'=>'del_link'), +); +$table =& new_db_pager('orders_tbl', $sql, $cols); + if (is_company_currency($_POST['curr_abrev'])) { @@ -206,7 +211,13 @@ if (is_company_currency($_POST['curr_abrev'])) else { - display_rates($_POST['curr_abrev']); + br(1); + if (list_updated('curr_abrev')) { + $table->set_sql($sql); + $table->set_columns($cols); + } + $table->width = "40%"; + display_db_pager($table); br(1); display_rate_edit(); } diff --git a/gl/manage/gl_account_classes.php b/gl/manage/gl_account_classes.php index 41c2af81..65a6429d 100644 --- a/gl/manage/gl_account_classes.php +++ b/gl/manage/gl_account_classes.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 3; $path_to_root="../.."; include($path_to_root . "/includes/session.inc"); @@ -118,7 +127,7 @@ while ($myrow = db_fetch($result)) label_cell($myrow['class_name']); label_cell($bs_text); edit_button_cell("Edit".$myrow["cid"], _("Edit")); - edit_button_cell("Delete".$myrow["cid"], _("Delete")); + delete_button_cell("Delete".$myrow["cid"], _("Delete")); end_row(); } diff --git a/gl/manage/gl_account_types.php b/gl/manage/gl_account_types.php index 4e2ce39f..19093b21 100644 --- a/gl/manage/gl_account_types.php +++ b/gl/manage/gl_account_types.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 3; $path_to_root="../.."; include($path_to_root . "/includes/session.inc"); @@ -10,13 +19,19 @@ include($path_to_root . "/gl/includes/gl_db.inc"); include($path_to_root . "/includes/ui.inc"); -simple_page_mode(false); +simple_page_mode(true); //----------------------------------------------------------------------------------- function can_process() { global $selected_id; + if (!input_num('id')) + { + display_error( _("The account id must be an integer and cannot be empty.")); + set_focus('id'); + return false; + } if (strlen($_POST['name']) == 0) { display_error( _("The account group name cannot be empty.")); @@ -41,14 +56,14 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') if (can_process()) { - if ($selected_id != "") + if ($selected_id != -1) { update_account_type($selected_id, $_POST['name'], $_POST['class_id'], $_POST['parent']); display_notification(_('Selected account type has been updated')); } else { - add_account_type($_POST['name'], $_POST['class_id'], $_POST['parent']); + add_account_type($_POST['id'], $_POST['name'], $_POST['class_id'], $_POST['parent']); display_notification(_('New account type has been added')); } $Mode = 'RESET'; @@ -59,7 +74,7 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') function can_delete($selected_id) { - if ($selected_id == "") + if ($selected_id == -1) return false; $sql= "SELECT COUNT(*) FROM ".TB_PREF."chart_master WHERE account_type=$selected_id"; @@ -99,8 +114,8 @@ if ($Mode == 'Delete') } if ($Mode == 'RESET') { - $selected_id = ''; - $_POST['name'] = ''; + $selected_id = -1; + $_POST['id'] = $_POST['name'] = ''; unset($_POST['parent']); unset($_POST['class_id']); } @@ -109,7 +124,7 @@ if ($Mode == 'RESET') $result = get_account_types(); start_form(); start_table($table_style); -$th = array(_("Name"), _("Subgroup Of"), _("Class Type"), "", ""); +$th = array(_("ID"), _("Name"), _("Subgroup Of"), _("Class Type"), "", ""); table_header($th); $k = 0; @@ -129,11 +144,12 @@ while ($myrow = db_fetch($result)) $parent_text = get_account_type_name($myrow["parent"]); } + label_cell($myrow["id"]); label_cell($myrow["name"]); label_cell($parent_text); label_cell($bs_text); edit_button_cell("Edit".$myrow["id"], _("Edit")); - edit_button_cell("Delete".$myrow["id"], _("Delete")); + delete_button_cell("Delete".$myrow["id"], _("Delete")); end_row(); } @@ -146,17 +162,24 @@ start_form(); start_table($table_style2); -if ($Mode == 'Edit') +if ($selected_id != -1) { - //editing an existing status code - $myrow = get_account_type($selected_id); - - $_POST['name'] = $myrow["name"]; - $_POST['parent'] = $myrow["parent"]; - $_POST['class_id'] = $myrow["class_id"]; - } - hidden('selected_id', $selected_id); - + if ($Mode == 'Edit') + { + //editing an existing status code + $myrow = get_account_type($selected_id); + + $_POST['id'] = $myrow["id"]; + $_POST['name'] = $myrow["name"]; + $_POST['parent'] = $myrow["parent"]; + $_POST['class_id'] = $myrow["class_id"]; + hidden('selected_id', $selected_id); + } + hidden('id'); + label_row(_("ID:"), $_POST['id']); +} +else + text_row_ex(_("ID:"), 'id', 4); text_row_ex(_("Name:"), 'name', 50); gl_account_types_list_row(_("Subgroup Of:"), 'parent', null, _("None"), true); @@ -165,7 +188,7 @@ class_list_row(_("Class Type:"), 'class_id', null); end_table(1); -submit_add_or_update_center($selected_id == '', '', true); +submit_add_or_update_center($selected_id == -1, '', true); end_form(); diff --git a/gl/manage/gl_accounts.php b/gl/manage/gl_accounts.php index 55fd9389..f5ddabdb 100644 --- a/gl/manage/gl_accounts.php +++ b/gl/manage/gl_accounts.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 10; $path_to_root="../.."; include($path_to_root . "/includes/session.inc"); @@ -62,12 +71,12 @@ if (isset($_POST['add']) || isset($_POST['update'])) $_POST['account_code'] = strtoupper($_POST['account_code']); if ($selected_account) { - update_gl_account($_POST['account_code'], $_POST['account_name'], $_POST['account_type'], $_POST['account_code2'], $_POST['tax_code']); + update_gl_account($_POST['account_code'], $_POST['account_name'], $_POST['account_type'], $_POST['account_code2']); display_notification(_("Account data has been updated.")); } else { - add_gl_account($_POST['account_code'], $_POST['account_name'], $_POST['account_type'], $_POST['account_code2'], $_POST['tax_code']); + add_gl_account($_POST['account_code'], $_POST['account_name'], $_POST['account_type'], $_POST['account_code2']); $selected_account = $_POST['AccountList'] = $_POST['account_code']; display_notification(_("New account has been added.")); } @@ -198,7 +207,7 @@ if (db_has_gl_accounts()) { echo "
"; echo _("Select an Account:") . " "; - gl_all_accounts_list('AccountList', null, false, false, false, + gl_all_accounts_list('AccountList', null, false, false, _('New account'), true); echo "
"; } @@ -215,7 +224,6 @@ if ($selected_account != "") $_POST['account_code2'] = $myrow["account_code2"]; $_POST['account_name'] = $myrow["account_name"]; $_POST['account_type'] = $myrow["account_type"]; - $_POST['tax_code'] = $myrow["tax_code"]; hidden('account_code', $_POST['account_code']); hidden('selected_account', $selected_account); @@ -225,7 +233,7 @@ if ($selected_account != "") else { $_POST['account_code'] = $_POST['account_code2'] = ''; - $_POST['account_name'] = $_POST['account_type'] = $_POST['tax_code'] = ''; + $_POST['account_name'] = $_POST['account_type'] = ''; text_row_ex(_("Account Code:"), 'account_code', 11); } @@ -235,8 +243,6 @@ text_row_ex(_("Account Name:"), 'account_name', 60); gl_account_types_list_row(_("Account Group:"), 'account_type', null); -tax_types_list_row(_("Tax Type:"), 'tax_code', null, _('No Tax')); - end_table(1); if ($selected_account == "") diff --git a/gl/view/bank_transfer_view.php b/gl/view/bank_transfer_view.php index c0a25e27..318c93d0 100644 --- a/gl/view/bank_transfer_view.php +++ b/gl/view/bank_transfer_view.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 1; $path_to_root="../.."; @@ -72,7 +81,7 @@ if ($show_both_amounts) end_row(); start_row(); label_cells(_("Date"), sql2date($from_trans['trans_date']), "class='tableheader2'"); -label_cells(_("Transfer Type"), $from_trans['BankTransType'], "class='tableheader2'"); +label_cells(_("Transfer Type"), bank_account_types::transfer_type($from_trans['account_type']), "class='tableheader2'"); label_cells(_("Reference"), $from_trans['ref'], "class='tableheader2'"); end_row(); comments_display_row(systypes::bank_transfer(), $trans_no); diff --git a/gl/view/gl_deposit_view.php b/gl/view/gl_deposit_view.php index 02a3f7e0..95449bd7 100644 --- a/gl/view/gl_deposit_view.php +++ b/gl/view/gl_deposit_view.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 1; $path_to_root="../.."; @@ -60,7 +69,7 @@ label_cells(_("Date"), sql2date($to_trans['trans_date']), "class='tableheader2'" end_row(); start_row(); label_cells(_("From"), payment_person_types::person_name($to_trans['person_type_id'], $to_trans['person_id']), "class='tableheader2'", "colspan=$colspan1"); -label_cells(_("Deposit Type"), $to_trans['BankTransType'], "class='tableheader2'"); +label_cells(_("Deposit Type"), bank_account_types::transfer_type($to_trans['account_type']), "class='tableheader2'"); end_row(); start_row(); label_cells(_("Reference"), $to_trans['ref'], "class='tableheader2'", "colspan=$colspan2"); diff --git a/gl/view/gl_payment_view.php b/gl/view/gl_payment_view.php index f52dc672..32f89335 100644 --- a/gl/view/gl_payment_view.php +++ b/gl/view/gl_payment_view.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 1; $path_to_root="../.."; @@ -58,7 +67,7 @@ label_cells(_("Date"), sql2date($from_trans['trans_date']), "class='tableheader2 end_row(); start_row(); label_cells(_("Pay To"), payment_person_types::person_name($from_trans['person_type_id'], $from_trans['person_id']), "class='tableheader2'", "colspan=$colspan1"); -label_cells(_("Payment Type"), $from_trans['BankTransType'], "class='tableheader2'"); +label_cells(_("Payment Type"),bank_account_types::transfer_type($from_trans['account_type']), "class='tableheader2'"); end_row(); start_row(); label_cells(_("Reference"), $from_trans['ref'], "class='tableheader2'", "colspan=$colspan2"); diff --git a/gl/view/gl_trans_view.php b/gl/view/gl_trans_view.php index 0aec1027..e48b09bf 100644 --- a/gl/view/gl_trans_view.php +++ b/gl/view/gl_trans_view.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 8; $path_to_root="../.."; include_once($path_to_root . "/includes/session.inc"); @@ -66,6 +75,7 @@ $heading_shown = false; while ($myrow = db_fetch($result)) { + if ($myrow['amount'] == 0) continue; if (!$heading_shown) { display_gl_heading($myrow); diff --git a/includes/ajax.inc b/includes/ajax.inc index 135ee03d..a8a6981c 100644 --- a/includes/ajax.inc +++ b/includes/ajax.inc @@ -1,4 +1,14 @@ . +***********************************************************************/ require_once($path_to_root. "/includes/JsHttpRequest.php"); class Ajax extends JsHttpRequest { @@ -25,11 +35,17 @@ class Ajax extends JsHttpRequest { // function redirect($url) { if(in_ajax()) { - $this->_addCommand(true, array('n'=>'rd'),$url); - $this->run(); + $this->_addCommand(true, array('n'=>'rd'), absolute_url($url)); + $this->run(); } } // + // Popup window (target=_blank) + // + function popup($url) { + $this->_addCommand(true, array('n'=>'pu'), absolute_url($url)); + } + // // Adds an executable Javascript code. // function addScript($trigger, $sJS) @@ -136,4 +152,11 @@ function in_ajax() { return $Ajax->isActive(); } +// Returns absolute path of relative $url. To be used in ajax calls +// for proper redirection from any referer page. +// +function absolute_url($url) +{ + return strpos($url, '..')===0 ? dirname($_SERVER['PHP_SELF']).'/'.$url : $url; +} ?> diff --git a/includes/banking.inc b/includes/banking.inc index a86551df..4de6ae47 100644 --- a/includes/banking.inc +++ b/includes/banking.inc @@ -1,15 +1,33 @@ . +***********************************************************************/ include_once($path_to_root . "/gl/includes/gl_db.inc"); //---------------------------------------------------------------------------------- - +// Check if given account is used by any bank_account. +// Returns id of first bank_account using account_code, null otherwise. +// +// Keep in mind that direct posting to bank account is depreciated +// because we have no way to select right bank account if +// there is more than one using given gl account. +// function is_bank_account($account_code) { - $sql= "SELECT account_code FROM ".TB_PREF."bank_accounts WHERE account_code='$account_code'"; - $result = db_query($sql, "retreive bank account currency"); - - return (db_num_rows($result) > 0); + $sql= "SELECT id FROM ".TB_PREF."bank_accounts WHERE account_code='$account_code'"; + $result = db_query($sql, "checking account is bank account"); + if (db_num_rows($result) > 0) { + $acct = db_fetch($result); + return $acct['id']; + } else + return false; } //---------------------------------------------------------------------------------- @@ -35,9 +53,9 @@ function get_company_currency() //---------------------------------------------------------------------------------- -function get_bank_account_currency($bankAccount) +function get_bank_account_currency($id) { - $sql= "SELECT bank_curr_code FROM ".TB_PREF."bank_accounts WHERE account_code='$bankAccount'"; + $sql= "SELECT bank_curr_code FROM ".TB_PREF."bank_accounts WHERE id='$id'"; $result = db_query($sql, "retreive bank account currency"); $myrow = db_fetch_row($result); @@ -85,7 +103,9 @@ function get_exchange_rate_from_home_currency($currency_code, $date_) if (db_num_rows($result) == 0) { // no stored exchange rate, just return 1 - display_error(_("Cannot retrieve currency exchange rate for this date. Please add exchange rate manually on Exchange Rates page.") ); + display_error( + sprintf(_("Cannot retrieve exchange rate for currency %s as of %s. Please add exchange rate manually on Exchange Rates page."), + $currency_code, $date_)); return 1.000; } diff --git a/includes/current_user.inc b/includes/current_user.inc index 397347a0..023591d3 100644 --- a/includes/current_user.inc +++ b/includes/current_user.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ include_once($path_to_root . "/includes/prefs/userprefs.inc"); //-------------------------------------------------------------------------- @@ -11,18 +20,20 @@ class current_user var $username; var $name; var $company; + var $pos; var $access; var $logged; - + var $ui_mode = 0; + var $prefs; function current_user() { - $this->loginname = $username = $this->name = $this->company = ""; + $this->loginname = $this->username = $this->name = $this->company = ""; $this->logged = false; - $this->prefs = null; + $this->prefs = new user_prefs(); } function logged_in() @@ -47,6 +58,7 @@ class current_user $this->access = $myrow["full_access"]; $this->name = $myrow["real_name"]; + $this->pos = $myrow["pos"]; $this->loginname = $loginname; $this->username = $this->loginname; $this->prefs = new user_prefs($myrow); @@ -95,10 +107,14 @@ class current_user return $db; } - function update_prefs($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes, - $date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize, $show_hints) { - update_user_display_prefs($this->username, $price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, - $showcodes, $date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize, $show_hints); + function update_prefs($price_dec, $qty_dec, $exrate_dec, $percent_dec, + $showgl, $showcodes, $date_format, $date_sep, $tho_sep, $dec_sep, + $theme, $pagesize, $show_hints, $profile, $rep_popup, $query_size, + $graphic_links, $lang) { + update_user_display_prefs($this->username, $price_dec, + $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes, + $date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize, + $show_hints, $profile, $rep_popup, $query_size, $graphic_links, $lang); // re-read the prefs $user = get_user($this->username); @@ -123,6 +139,12 @@ function number_format2($number, $decimals=0) $delta = ($number < 0 ? -.000001 : .000001); return number_format($number+$delta, $decimals, $dsep, $tsep); } +// +// Current ui mode. +// +function fallback_mode() { + return $_SESSION["wa_current_user"]->ui_mode==0; +} function price_format($number) { return number_format2($number, @@ -180,6 +202,11 @@ function user_company() return $_SESSION["wa_current_user"]->company; } +function user_pos() +{ + return $_SESSION["wa_current_user"]->pos; +} + function user_language() { return $_SESSION["wa_current_user"]->prefs->language(); @@ -255,12 +282,34 @@ function user_hints() return $_SESSION["wa_current_user"]->prefs->show_hints(); } +function user_print_profile() +{ + return $_SESSION["wa_current_user"]->prefs->print_profile(); +} + +function user_rep_popup() +{ + return $_SESSION["wa_current_user"]->prefs->rep_popup(); +} + +function user_query_size() +{ + return $_SESSION["wa_current_user"]->prefs->query_size(); +} + +function user_graphic_links() +{ + return $_SESSION["wa_current_user"]->prefs->graphic_links(); +} + function set_user_prefs($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes, - $date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize, $show_hints) + $date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize, $show_hints, + $print_profile, $rep_popup, $query_size, $graphic_links, $lang) { $_SESSION["wa_current_user"]->update_prefs($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes, - $date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize, $show_hints); + $date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize, $show_hints, + $print_profile, $rep_popup, $query_size, $graphic_links, $lang); } function add_user_js_data() { diff --git a/includes/data_checks.inc b/includes/data_checks.inc index b79bf3d2..37da7a3f 100644 --- a/includes/data_checks.inc +++ b/includes/data_checks.inc @@ -1,4 +1,14 @@ . +***********************************************************************/ function db_has_customers() { return check_empty_result("SELECT COUNT(*) FROM ".TB_PREF."debtors_master"); @@ -111,22 +121,6 @@ function check_db_has_movement_types($msg) } } -function db_has_bank_trans_types() -{ - return check_empty_result("SELECT COUNT(*) FROM ".TB_PREF."bank_trans_types"); -} - -function check_db_has_bank_trans_types($msg) -{ - global $path_to_root; - if (!db_has_bank_trans_types()) - { - display_error($msg, true); - end_page(); - exit; - } -} - function db_customer_has_branches($customer_id) { return check_empty_result("SELECT COUNT(*) FROM ".TB_PREF."cust_branch WHERE debtor_no='$customer_id'"); @@ -420,6 +414,11 @@ function check_db_has_gl_account_groups($msg) } } +function db_has_quick_entries() +{ + return check_empty_result("SELECT COUNT(*) FROM ".TB_PREF."quick_entries"); +} + function check_empty_result($sql) { $result = db_query($sql, "could not do check empty query"); diff --git a/includes/date_functions.inc b/includes/date_functions.inc index febf609f..c6813531 100644 --- a/includes/date_functions.inc +++ b/includes/date_functions.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ /* date validation and parsing functions @@ -359,7 +368,7 @@ and converts to a yyyy/mm/dd format */ list($year, $month, $day) = jalali_to_gregorian($year, $month, $day); else if ($date_system == 2) list($year, $month, $day) = islamic_to_gregorian($year, $month, $day); - return $year."/".$month."/".$day; + return $year."-".$month."-".$day; }// end of function function date1_greater_date2 ($date1, $date2) @@ -369,8 +378,8 @@ function date1_greater_date2 ($date1, $date2) $date1 = date2sql($date1); $date2 = date2sql($date2); - list($year1, $month1, $day1) = explode("/", $date1); - list($year2, $month2, $day2) = explode("/", $date2); + list($year1, $month1, $day1) = explode("-", $date1); + list($year2, $month2, $day2) = explode("-", $date2); if ($year1 > $year2) { @@ -403,8 +412,8 @@ provided that both dates are after 1970. Also only works for dates up to the yea $date1 = date2sql($date1); $date2 = date2sql($date2); - list($year1, $month1, $day1) = explode("/", $date1); - list($year2, $month2, $day2) = explode("/", $date2); + list($year1, $month1, $day1) = explode("-", $date1); + list($year2, $month2, $day2) = explode("-", $date2); $stamp1 = mktime(0,0,0, (int)$month1, (int)$day1, (int)$year1); $stamp2 = mktime(0,0,0, (int)$month2, (int)$day2, (int)$year2); @@ -438,7 +447,7 @@ function explode_date_to_dmy($date_) echo "
Dates must be entered in the format $disp. Sent was $date_
"; exit; } - list($year, $month, $day) = explode("/", $date); + list($year, $month, $day) = explode("-", $date); return array($day, $month, $year); } diff --git a/includes/db/comments_db.inc b/includes/db/comments_db.inc index 9a484da2..d431e97d 100644 --- a/includes/db/comments_db.inc +++ b/includes/db/comments_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ //-------------------------------------------------------------------------------------------------- function get_comments($type, $type_no) diff --git a/includes/db/connect_db.inc b/includes/db/connect_db.inc index 3fc2bcfb..fa57b678 100644 --- a/includes/db/connect_db.inc +++ b/includes/db/connect_db.inc @@ -1,6 +1,14 @@ . +***********************************************************************/ function set_global_connection() { @@ -18,7 +26,7 @@ $db_duplicate_error_code = 1062; function db_query($sql, $err_msg=null) { - global $db, $show_sql; + global $db, $show_sql, $sql_trail, $select_trail; //echo "
$sql
"; if ($show_sql) @@ -28,9 +36,19 @@ function db_query($sql, $err_msg=null) echo $sql; echo "\n"; } - + $result = mysql_query($sql, $db); + if($sql_trail) { + if ($select_trail || (strstr($sql, 'SELECT') === false)) { + mysql_query( + "INSERT INTO ".TB_PREF."sql_trail + (`sql`, `result`, `msg`) + VALUES(".db_escape($sql).",".($result ? 1 : 0).", + ".db_escape($err_msg).")", $db); + } + } + if ($err_msg != null) if (function_exists('xdebug_call_file')) check_db_error('
At file '.xdebug_call_file().':'.xdebug_call_line().':
'.$err_msg, $sql); @@ -46,6 +64,12 @@ function db_fetch_row ($result) return mysql_fetch_row($result); } +function db_fetch_assoc ($result) +{ + + return mysql_fetch_assoc($result); +} + function db_fetch ($result) { @@ -54,7 +78,7 @@ function db_fetch ($result) function db_seek (&$result,$record) { - mysql_data_seek($result, $record); + return mysql_data_seek($result, $record); } function db_free_result ($result) diff --git a/includes/db/inventory_db.inc b/includes/db/inventory_db.inc index 46a16b41..4fcc7a41 100644 --- a/includes/db/inventory_db.inc +++ b/includes/db/inventory_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ function get_qoh_on_date($stock_id, $location=null, $date_=null, $exclude=0) { if ($date_ == null) @@ -37,8 +46,10 @@ function get_qoh_on_date($stock_id, $location=null, $date_=null, $exclude=0) function get_item_edit_info($stock_id) { - $sql = "SELECT material_cost + labour_cost + overhead_cost AS standard_cost, units - FROM ".TB_PREF."stock_master WHERE stock_id='$stock_id'"; + $sql = "SELECT material_cost + labour_cost + overhead_cost AS standard_cost, units, decimals + FROM ".TB_PREF."stock_master,".TB_PREF."item_units + WHERE stock_id='$stock_id' + AND ".TB_PREF."stock_master.units=".TB_PREF."item_units.abbr"; $result = db_query($sql, "The standard cost cannot be retrieved"); return db_fetch($result); diff --git a/includes/db/manufacturing_db.inc b/includes/db/manufacturing_db.inc index c7c8c5d9..622b6822 100644 --- a/includes/db/manufacturing_db.inc +++ b/includes/db/manufacturing_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ function get_mb_flag($stock_id) { $sql = "SELECT mb_flag FROM ".TB_PREF."stock_master WHERE stock_id = '" . $stock_id . "'"; diff --git a/includes/db/references_db.inc b/includes/db/references_db.inc index a41597f9..48b16fad 100644 --- a/includes/db/references_db.inc +++ b/includes/db/references_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ //-------------------------------------------------------------------------------------------------- function get_reference($type, $id) diff --git a/includes/db/sql_functions.inc b/includes/db/sql_functions.inc index 766fe545..b869f6bd 100644 --- a/includes/db/sql_functions.inc +++ b/includes/db/sql_functions.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ //------------------------------------------------------------------- function begin_transaction() diff --git a/includes/errors.inc b/includes/errors.inc index 536d23ad..8972a9eb 100644 --- a/includes/errors.inc +++ b/includes/errors.inc @@ -1,11 +1,20 @@ . +***********************************************************************/ $messages = array(); // container for system messages $before_box = ''; // temporary container for output html data before error box $msg_colors = array( E_USER_ERROR => array('bg'=>'#ffcccc', 'txt'=>'#dd2200', 'bd'=>'#cc3300'), - E_USER_WARNING => array('bg'=>'#ffcccc', 'txt'=>'#dd2200', 'bd'=>'#cc3300'), + E_USER_WARNING => array('bg'=>'#ffff00', 'txt'=>'#ff5500', 'bd'=>'#ff9900'), E_USER_NOTICE => array('bg'=>'#ccffcc', 'txt'=>'#007700', 'bd'=>'#33cc00')); //----------------------------------------------------------------------------- @@ -16,9 +25,9 @@ function error_handler($errno, $errstr, $file, $line) { global $messages; // error_reporting==0 when messages are set off with @ - if ($errno & error_reporting()) + if ($errno & error_reporting()) { $messages[] = array($errno, $errstr, $file, $line); - + } return true; } //------------------------------------------------------------------------------ @@ -33,14 +42,22 @@ function fmt_errors($center=true) { $content = ''; foreach($messages as $msg) { if ($msg[0]>$type) continue; - if ($msg[0]<$type && $type>E_USER_ERROR) { - $content = ''; // clean notices when we have errors - $type = E_USER_ERROR; // php or user errors + + if ($msg[0]<$type) { + if ($msg[0] == E_USER_WARNING) { + $type = E_USER_WARNING; // user warnings + $content = ''; // clean notices when we have errors + } else { + $type = E_USER_ERROR; // php or user errors + if($type == E_USER_WARNING) + $content = ''; // clean other messages + } } $str = $msg[1]; $c = $msg_colors[$type]; - if ($msg[0]" .$str.""; diff --git a/includes/lang/gettext.php b/includes/lang/gettext.php index 7bdb69a8..4c4f1633 100644 --- a/includes/lang/gettext.php +++ b/includes/lang/gettext.php @@ -94,9 +94,9 @@ class get_text } elseif (!isset($support_obj)) { - trigger_error("get_text not initialized !". endl. + trigger_error("get_text not initialized !". '\n'. "Please call get_text::init() before calling ". - "any get_text function !" . endl , E_USER_ERROR); + "any get_text function !" . '\n' , E_USER_ERROR); } return $support_obj; } @@ -216,7 +216,7 @@ class get_text } function raise_error($str) { - //echo "$str"; +// echo "$str"; return 1; } diff --git a/includes/lang/language.php b/includes/lang/language.php index 72a0b3e4..0727222c 100644 --- a/includes/lang/language.php +++ b/includes/lang/language.php @@ -1,6 +1,16 @@ . +***********************************************************************/ +// Prevent register_globals vulnerability +if (isset($_GET['path_to_root']) || isset($_POST['path_to_root'])) die("Restricted access"); include_once($path_to_root . "/lang/installed_languages.inc"); include_once($path_to_root . "/includes/lang/gettext.php"); @@ -12,7 +22,8 @@ class language var $encoding; // eg. UTF-8, CP1256, ISO8859-1 var $dir; // Currently support for Left-to-Right (ltr) and // Right-To-Left (rtl) - + var $is_locale_file; + function language($name, $code, $encoding) { $this->name = $name; @@ -26,7 +37,6 @@ class language return "lang/" . $this->code; } - function get_current_language_dir() { $lang = $_SESSION['language']; @@ -35,22 +45,29 @@ class language function set_language($code) { - global $comp_path; - - if (isset($_SESSION['languages'][$code]) && - $_SESSION['language'] != $_SESSION['languages'][$code]) + global $comp_path, $path_to_root; + + $changed = $_SESSION['language']->code != $code; + if (isset($_SESSION['languages'][$code]) && $changed) { - // flush cache as we can use several languages in one account flush_dir($comp_path.'/'.user_company().'/js_cache'); $_SESSION['language'] = $_SESSION['languages'][$code]; - reload_page(""); + $locale = $path_to_root . "/lang/" . $_SESSION['language']->code . "/locale.inc"; + // check id file exists only once for session + $_SESSION['language']->is_locale_file = file_exists($locale); } - } - function get_stylesheet() - { - return 'lang/' . $_SESSION['language']->code . '/stylesheet.css'; + $lang = $_SESSION['language']; + get_text::set_language($lang->code, $lang->encoding); + get_text::add_domain($lang->code, $path_to_root . "/lang"); + + // Necessary for ajax calls. Due to bug in php 4.3.10 for this + // version set globally in php.ini + ini_set('default_charset', $lang->encoding); + + if (isset($_SESSION['App']) && $changed) + $_SESSION['App']->init(); // refresh menu } /** @@ -59,7 +76,7 @@ class language */ function load_languages() { - global $installed_languages; + global $installed_languages, $dflt_lang; $_SESSION['languages'] = array(); @@ -72,33 +89,34 @@ class language } if (!isset($_SESSION['language'])) - $_SESSION['language'] = $_SESSION['languages']['en_GB']; + $_SESSION['language'] = $_SESSION['languages'][$dflt_lang]; } } +/* + Test if named function is defined in locale.inc file. +*/ +function has_locale($fun=null) +{ + global $path_to_root; + + if ($_SESSION['language']->is_locale_file) + { + global $path_to_root; + include_once($path_to_root . "/lang/" . + $_SESSION['language']->code . "/locale.inc"); -session_name('FrontAccounting'); -session_start(); -// this is to fix the "back-do-you-want-to-refresh" issue - thanx PHPFreaks -header("Cache-control: private"); + if (!isset($fun) || function_exists($fun)) + return true; + } + return false; +} -// Page Initialisation -if (!isset($_SESSION['languages'])) +function _set($key,$value) { - language::load_languages(); + get_text::set_var($key,$value); } -$lang = $_SESSION['language']; - -// get_text support -get_text::init(); -get_text::set_language($lang->code, $lang->encoding); -//get_text::add_domain("wa", $path_to_root . "/lang"); -get_text::add_domain($lang->code, $path_to_root . "/lang"); -// Unnecessary for ajax calls. -// Due to bug in php 4.3.10 for this version set globally in php.ini -ini_set('default_charset', $_SESSION['language']->encoding); - if (!function_exists("_")) { function _($text) @@ -109,30 +127,4 @@ if (!function_exists("_")) return $retVal; } } - -function _set($key,$value) -{ - get_text::set_var($key,$value); -} - -function reload_page($msg) -{ -// header("Location: $_SERVER['PHP_SELF'].""); -// exit; - echo ""; - echo ""; - echo "Changing Languages"; - echo ''; - echo ''; - echo ''; - echo '
'; - if ($msg != "") - echo $msg . " " . $_SERVER['PHP_SELF']; - echo "
"; - echo ""; - echo ""; -} - - - ?> \ No newline at end of file diff --git a/includes/main.inc b/includes/main.inc index 19279f04..5d4371ba 100644 --- a/includes/main.inc +++ b/includes/main.inc @@ -1,67 +1,75 @@ . +***********************************************************************/ +include_once($path_to_root . "/includes/db/connect_db.inc"); - include_once($path_to_root . "/includes/db/connect_db.inc"); +include_once($path_to_root . "/includes/reserved.inc"); +include_once($path_to_root . "/includes/errors.inc"); +include_once($path_to_root . "/includes/types.inc"); +include_once($path_to_root . "/includes/systypes.inc"); +include_once($path_to_root . "/includes/references.inc"); +include_once($path_to_root . "/includes/prefs/sysprefs.inc"); +include_once($path_to_root . "/includes/db/comments_db.inc"); +include_once($path_to_root . "/includes/db/sql_functions.inc"); - include_once($path_to_root . "/includes/reserved.inc"); - include_once($path_to_root . "/includes/errors.inc"); - include_once($path_to_root . "/includes/types.inc"); - include_once($path_to_root . "/includes/systypes.inc"); - include_once($path_to_root . "/includes/references.inc"); - include_once($path_to_root . "/includes/prefs/sysprefs.inc"); - include_once($path_to_root . "/includes/db/comments_db.inc"); - include_once($path_to_root . "/includes/db/sql_functions.inc"); - - include_once($path_to_root . "/admin/db/users_db.inc"); - include_once($path_to_root . "/includes/ui/ui_view.inc"); - include_once($path_to_root . "/includes/ui/ui_controls.inc"); +include_once($path_to_root . "/admin/db/users_db.inc"); +include_once($path_to_root . "/includes/ui/ui_view.inc"); +include_once($path_to_root . "/includes/ui/ui_controls.inc"); +include_once($path_to_root . "/installed_extensions.php"); - function page($title, $no_menu=false, $is_index=false, $onload="", $js="", $script_only=false) - { +function page($title, $no_menu=false, $is_index=false, $onload="", $js="", $script_only=false) +{ - global $path_to_root; + global $path_to_root; - $hide_menu = $no_menu; + $hide_menu = $no_menu; - include($path_to_root . "/includes/page/header.inc"); - - page_header($title, $no_menu, $is_index, $onload, $js); - error_box(); - if($script_only) { - echo ''; - div_start('_page_body', null, true); - } else { - div_start('_page_body'); // whole page content for ajax reloading - } - } + include($path_to_root . "/includes/page/header.inc"); - function end_page($no_menu=false, $is_index=false) - { - global $path_to_root, $Ajax; + page_header($title, $no_menu, $is_index, $onload, $js); + error_box(); + if($script_only) { + echo ''; + div_start('_page_body', null, true); + } else { + div_start('_page_body'); // whole page content for ajax reloading + } +} +function end_page($no_menu=false, $is_index=false) +{ + global $path_to_root, $Ajax; $hide_menu = $no_menu; - div_end(); // _page_body section - include($path_to_root . "/includes/page/footer.inc"); - + include($path_to_root . "/includes/page/footer.inc"); page_footer($no_menu, $is_index); - } +} - function flush_dir($path) { +function flush_dir($path) +{ $dir = opendir($path); while(false !== ($fname = readdir($dir))) { - if($fname=='.' || $fname=='..') continue; + if($fname=='.' || $fname=='..' || $fname=='index.php') continue; if(is_dir($path.'/'.$fname)) { flush_dir($path.'/'.$fname); @rmdir($path.'/'.$fname); } else @unlink($path.'/'.$fname); } - } +} - function cache_js_file($fpath, $text) - { +function cache_js_file($fpath, $text) +{ global $go_debug; if(!$go_debug) $text = js_compress($text); @@ -71,34 +79,34 @@ if (!fwrite($file, $text)) return false; return fclose($file); - } +} - function add_js_file($filename) - { +function add_js_file($filename) +{ global $js_static; $search = array_search($filename, $js_static); if ($search === false || $search === null) // php>4.2.0 returns null $js_static[] = $filename; - } +} - function add_js_ufile($filename) - { +function add_js_ufile($filename) +{ global $js_userlib; $search = array_search($filename, $js_userlib); if ($search === false || $search === null) // php>4.2.0 returns null $js_userlib[] = $filename; - } +} - function add_js_source($text) - { +function add_js_source($text) +{ global $js_lib; $search = array_search($text, $js_lib); if ($search === false || $search === null) // php>4.2.0 returns null $js_lib[] = $text; - } +} /** * Compresses the Javascript code for more efficient delivery. @@ -248,4 +256,37 @@ function js_compress($sJS) } return $sJS; } +//----------------------------------------------------------------------------- +// Inserts $elements into $array at position $index. +// $elements is list of any objects +// +function array_insert(&$array, $index, $elements) +{ + if (!is_array($elements)) $elements = array($elements); + + $head = array_splice($array, 0, $index); + $array = array_merge($head, $elements, $array); +} + +function array_remove(&$array, $index, $len=1) +{ + array_splice($array, $index, $len); +} + +function array_replace(&$array, $index, $len, $elements) +{ + array_splice($array, $index, $len); + array_insert($array, $index, $elements); +} + +function array_append(&$array, $elements) +{ + foreach($elements as $key => $el) { + if(is_int($key)) + $array[] = $el; + else + $array[$key] = $el; + } +} + ?> \ No newline at end of file diff --git a/includes/manufacturing.inc b/includes/manufacturing.inc index e3c213d1..dcbcba29 100644 --- a/includes/manufacturing.inc +++ b/includes/manufacturing.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ include_once($path_to_root . "/includes/db/manufacturing_db.inc"); diff --git a/includes/page/footer.inc b/includes/page/footer.inc index 7528b7bf..2ce07a29 100644 --- a/includes/page/footer.inc +++ b/includes/page/footer.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ function page_footer($no_menu=false, $is_index=false) { global $path_to_root; diff --git a/includes/page/header.inc b/includes/page/header.inc index 97529207..6abf7c93 100644 --- a/includes/page/header.inc +++ b/includes/page/header.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ function help_url($title, $app) { @@ -17,7 +26,7 @@ function help_url($title, $app) } elseif ($title==_("Main Menu")) { - $help_page_url = $applications[$app]; + $help_page_url = access_string($applications[$app], true); } else { @@ -104,11 +113,8 @@ function page_header($title, $no_menu=false, $is_index=false, $onload="", $js="" echo "\n"; echo "dir . "' >\n"; echo "$title"; - $local_stylesheet = $_SESSION['language']->get_stylesheet(); echo ""; echo " \n"; - if (file_exists($local_path_to_root. "/".$local_stylesheet)) - echo " \n"; send_scripts($js); echo " \n"; diff --git a/includes/prefs/sysprefs.inc b/includes/prefs/sysprefs.inc index 95c2eacd..2b59f33c 100644 --- a/includes/prefs/sysprefs.inc +++ b/includes/prefs/sysprefs.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ include_once($path_to_root . "/admin/db/company_db.inc"); class sys_prefs diff --git a/includes/prefs/userprefs.inc b/includes/prefs/userprefs.inc index 1bd5b022..43afba6f 100644 --- a/includes/prefs/userprefs.inc +++ b/includes/prefs/userprefs.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ class user_prefs { @@ -18,29 +27,45 @@ class user_prefs var $tho_sep; var $dec_sep; var $theme; + var $print_profile; + var $rep_popup; var $pagesize; // for printing var $show_hints; - - function user_prefs(&$user) - { - - $this->language = $user["language"]; - language::set_language($this->language); - - $this->qty_dec = $user["qty_dec"]; - $this->price_dec = $user["prices_dec"]; - $this->exrate_dec = $user["rates_dec"]; - $this->percent_dec = $user["percent_dec"]; - - $this->show_gl_info = $user["show_gl"]; - $this->show_codes = $user["show_codes"]; - $this->date_format = $user["date_format"]; - $this->date_sep = $user["date_sep"]; - $this->tho_sep = $user["tho_sep"]; - $this->dec_sep = $user["dec_sep"]; - $this->theme = $user["theme"]; - $this->pagesize = $user["page_size"]; - $this->show_hints = $user["show_hints"]; + var $query_size; // table pager page length + var $graphic_links; // use graphic links + + function user_prefs($user=null) + { + if ($user == null) { + // set default values, used before login + global $dflt_lang; + + $this->language = $dflt_lang; + $this->theme = 'default'; + + } else { + $this->language = $user["language"]; + language::set_language($this->language); + + $this->qty_dec = $user["qty_dec"]; + $this->price_dec = $user["prices_dec"]; + $this->exrate_dec = $user["rates_dec"]; + $this->percent_dec = $user["percent_dec"]; + + $this->show_gl_info = $user["show_gl"]; + $this->show_codes = $user["show_codes"]; + $this->date_format = $user["date_format"]; + $this->date_sep = $user["date_sep"]; + $this->tho_sep = $user["tho_sep"]; + $this->dec_sep = $user["dec_sep"]; + $this->theme = $user["theme"]; + $this->pagesize = $user["page_size"]; + $this->show_hints = $user["show_hints"]; + $this->print_profile = $user["print_profile"]; + $this->rep_popup = $user["rep_popup"]; + $this->query_size = $user["query_size"]; + $this->graphic_links = $user["graphic_links"]; + } } function language() @@ -125,6 +150,26 @@ class user_prefs return $this->show_hints; } + function print_profile() + { + return $this->print_profile; + } + + function rep_popup() + { + return $this->rep_popup; + } + + function query_size() + { + return $this->query_size; + } + + function graphic_links() + { + return $this->graphic_links; + } + function set_dec($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes) { $this->price_dec = $price_dec; diff --git a/includes/references.inc b/includes/references.inc index 07f397b6..6f3bd891 100644 --- a/includes/references.inc +++ b/includes/references.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ include_once($path_to_root . "/includes/db/references_db.inc"); class references diff --git a/includes/reserved.inc b/includes/reserved.inc index 14b2d8cc..5cc1fcdd 100644 --- a/includes/reserved.inc +++ b/includes/reserved.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ // always use capitals in reserved words (for is_reserved_word comparisons) $any_item = 'AN'; diff --git a/includes/session.inc b/includes/session.inc index 0e7d3113..6de875b9 100644 --- a/includes/session.inc +++ b/includes/session.inc @@ -1,175 +1,185 @@ )?:(.*)/i', $text, $m)) { - $Ajax->aCommands = array(); // Don't update page via ajax on errors +/********************************************************************** + Copyright (C) FrontAccounting, LLC. + Released under the terms of the GNU General Public License, GPL, + as published by the Free Software Foundation, either version 3 + of the License, or (at your option) any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License here . +***********************************************************************/ +function output_html($text) +{ + global $before_box, $Ajax, $messages; + // Fatal errors are not send to error_handler, + // so we must check the output + if ($text && preg_match('/\bFatal error(<.*?>)?:(.*)/i', $text, $m)) { + $Ajax->aCommands = array(); // Don't update page via ajax on errors $text = preg_replace('/\bFatal error(<.*?>)?:(.*)/i','', $text); $messages[] = array(E_ERROR, $m[2], null, null); - } - $Ajax->run(); - return in_ajax() ? fmt_errors() : ($before_box.fmt_errors().$text); } - - if (!isset($path_to_root)) + $Ajax->run(); + return in_ajax() ? fmt_errors() : ($before_box.fmt_errors().$text); +} +//---------------------------------------------------------------------------------------- + +function kill_login() +{ + session_unset(); + session_destroy(); +} +//---------------------------------------------------------------------------------------- + +function login_fail() +{ + header("HTTP/1.1 401 Authorization Required"); + echo "


" . _("Incorrect Password") . "

"; + echo "" . _("The user and password combination is not valid for the system.") . "

"; + + echo _("If you are not an authorized user, please contact your system administrator to obtain an account to enable you to use the system."); + echo "
" . _("Back") . ""; + echo "
"; + + kill_login(); + die(); +} + +//---------------------------------------------------------------------------------------- + +function check_page_security($page_security) +{ + if (!$_SESSION["wa_current_user"]->check_user_access()) { - $path_to_root = "."; - } - - include_once($path_to_root . "/includes/current_user.inc"); - -/* - // Make sure this directory exists and is writable! - $session_save_path = dirname(__FILE__).'/tmp/'; -*/ - - $session_save_path = session_save_path(); - if (strpos($session_save_path, ";") !== false) - $session_save_path = substr($session_save_path, strpos($session_save_path, ";") + 1); + echo "


"; + echo "" . _("Security settings have not been defined for your user account."); + echo "
" . _("Please contact your system administrator.") . "
"; - if (isset($session_save_path)) - { - session_save_path($session_save_path); - unset($session_save_path); + kill_login(); + exit; } - if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_to_root'])) - die("Restricted access"); - include_once($path_to_root . "/includes/lang/language.php"); - include_once($path_to_root . "/config_db.php"); - include_once($path_to_root . "/config.php"); - include_once($path_to_root . "/includes/ajax.inc"); - $Ajax =& new Ajax(); - - include_once($path_to_root . "/includes/main.inc"); - //---------------------------------------------------------------------------------------- - - function kill_login() + if (!$_SESSION["wa_current_user"]->can_access_page($page_security)) { - session_unset(); - session_destroy(); + page(_("Access denied")); + echo "



"; + echo _("The security settings on your account do not permit you to access this function"); + echo ""; + echo "



"; + end_page(); + //kill_login(); + exit; + } +} + +//----------------------------------------------------------------------------- +// Removing magic quotes from nested arrays/variables +// +function strip_quotes($data) +{ + if(get_magic_quotes_gpc()) { + if(is_array($data)) { + foreach($data as $k => $v) { + $data[$k] = strip_quotes($data[$k]); + } + } else + return stripslashes($data); } + return $data; +} + +//============================================================================ +if (!isset($path_to_root)) +{ + $path_to_root = "."; +} + +// Prevent register_globals vulnerability +if (isset($_GET['path_to_root']) || isset($_POST['path_to_root'])) + die("Restricted access"); + +include_once($path_to_root . "/frontaccounting.php"); +include_once($path_to_root . "/includes/current_user.inc"); +include_once($path_to_root . "/includes/lang/language.php"); +include_once($path_to_root . "/config_db.php"); +include_once($path_to_root . "/includes/ajax.inc"); +include_once($path_to_root . "/includes/ui/ui_msgs.inc"); - //---------------------------------------------------------------------------------------- +/* + Make sure this directory exists and is writable! +// $session_save_path = dirname(__FILE__).'/../tmp/'; +*/ - function login_fail() - { - echo "


" . _("Incorrect Password") . "

"; - echo "" . _("The user and password combination is not valid for the system.") . "

"; +session_name('FrontAccounting'); +session_start(); +// this is to fix the "back-do-you-want-to-refresh" issue - thanx PHPFreaks +header("Cache-control: private"); - echo _("If you are not an authorized user, please contact your system administrator to obtain an account to enable you to use the system."); - echo "
" . _("Back") . ""; - echo "
"; +get_text::init(); - kill_login(); - die(); - } +// Page Initialisation +if (!isset($_SESSION['languages'])) +{ + language::load_languages(); // sets also default $_SESSION['language'] +} - //---------------------------------------------------------------------------------------- +language::set_language($_SESSION['language']->code); - function check_page_security($page_security) - { - if (!$_SESSION["wa_current_user"]->check_user_access()) - { - echo "


"; - echo "" . _("Security settings have not been defined for your user account."); - echo "
" . _("Please contact your system administrator.") . "
"; +include_once($path_to_root . "/config.php"); +include_once($path_to_root . "/includes/main.inc"); - kill_login(); - exit; - } +$Ajax =& new Ajax(); - if (!$_SESSION["wa_current_user"]->can_access_page($page_security)) - { - page(_("Access denied")); - echo "



"; - echo _("The security settings on your account do not permit you to access this function"); - echo ""; - echo "



"; - //echo '' - end_page(); - //kill_login(); - exit; - } - } +// intercept all output to destroy it in case of ajax call +register_shutdown_function('ob_end_flush'); +ob_start('output_html',0); - //----------------------------------------------------------------------------- - // Removing magic quotes from nested arrays/variables - // - function strip_quotes($data) - { - if(get_magic_quotes_gpc()) { - if(is_array($data)) { - foreach($data as $k => $v) { - $data[$k] = strip_quotes($data[$k]); - } - } else - return stripslashes($data); - } - return $data; - } +// colect all error msgs +set_error_handler('error_handler' /*, errtypes */); +if (!isset($_SESSION["wa_current_user"])) + $_SESSION["wa_current_user"] = new current_user(); +set_global_connection(); - //---------------------------------------------------------------------------------------- - if (!isset($_SESSION["wa_current_user"]) || - (isset($_SESSION["wa_current_user"]) && !$_SESSION["wa_current_user"]->logged_in())) +if (!$_SESSION["wa_current_user"]->logged_in()) +{ + // Show login screen + if (!isset($_POST["user_name_entry_field"]) or $_POST["user_name_entry_field"] == "") { - - $_SESSION["wa_current_user"] = new current_user(); - - // Show login screen - if (!isset($_POST["user_name_entry_field"]) or $_POST["user_name_entry_field"] == "") - { - include($path_to_root . "/access/login.php"); + include($path_to_root . "/access/login.php"); $Ajax->redirect($path_to_root . "/access/login.php"); - exit; - } - } - include_once($path_to_root . "/includes/ui/ui_msgs.inc"); - // intercept all output to destroy it in case of ajax call - register_shutdown_function('ob_end_flush'); - ob_start('output_html',0); - // colect all error msgs - set_error_handler('error_handler' /*, errtypes */); - - if (isset($_POST["user_name_entry_field"])) - { + exit; + } else { $succeed = $_SESSION["wa_current_user"]->login($_POST["company_login_name"], $_POST["user_name_entry_field"], md5($_POST["password"])); - + // select full vs fallback ui mode on login + $_SESSION["wa_current_user"]->ui_mode = $_POST['ui_mode']; if (!$succeed) { // Incorrect password login_fail(); } - } + $lang = $_SESSION['language']; + language::set_language($_SESSION['language']->code); + } +} + +if (!isset($_SESSION["App"])) { + $_SESSION["App"] = new front_accounting(); + $_SESSION["App"]->init(); +} - // Run with debugging messages for the system administrator(s) but not anyone else - /*if (in_array(15, $security_groups[$_SESSION["AccessLevel"]])) { - $debug = 1; - } else { - $debug = 0; - }*/ +// Run with debugging messages for the system administrator(s) but not anyone else +/*if (in_array(15, $security_groups[$_SESSION["AccessLevel"]])) { + $debug = 1; +} else { + $debug = 0; +}*/ - //---------------------------------------------------------------------------------------- +//---------------------------------------------------------------------------------------- - check_page_security($page_security); +check_page_security($page_security); // POST vars cleanup needed for direct reuse. // We quote all values later with db_escape() before db update. diff --git a/includes/systypes.inc b/includes/systypes.inc index e7698231..fc0dbb9a 100644 --- a/includes/systypes.inc +++ b/includes/systypes.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ Function get_next_trans_no ($trans_type){ // sql to get the next display transaction number diff --git a/includes/types.inc b/includes/types.inc index c8c5f904..d4f3c4a1 100644 --- a/includes/types.inc +++ b/includes/types.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ //---------------------------------------------------------------------------------- $systypes_array = array ( @@ -110,11 +119,11 @@ class systypes //---------------------------------------------------------------------------------- $bank_account_types_array = array ( - 0=> array ('id' => 0, 'name' => _("Savings Account")), - 1=> array ('id' => 1, 'name' => _("Chequing Account")), - 2=> array ('id' => 2, 'name' => _("Credit Account")), - 3=> array ('id' => 3, 'name' => _("Cash Account")) - ); + 0=> array ('id' => 0, 'name' => _("Savings Account"), 'ptype' => _("Transfer")), + 1=> array ('id' => 1, 'name' => _("Chequing Account"),'ptype' => _("Cheque")), + 2=> array ('id' => 2, 'name' => _("Credit Account"), 'ptype' => _("Credit")), + 3=> array ('id' => 3, 'name' => _("Cash Account"), 'ptype' => _("Cash")) + ); class bank_account_types { @@ -130,8 +139,13 @@ class bank_account_types global $bank_account_types_array; return $bank_account_types_array[$index]['name']; } + + function transfer_type($index) + { + global $bank_account_types_array; + return $bank_account_types_array[$index]['ptype']; + } } - //---------------------------------------------------------------------------------- include_once($path_to_root . "/manufacturing/includes/manufacturing_db.inc"); @@ -144,6 +158,7 @@ $payment_person_types_array = array ( 1=> array ('id' => 1, 'name' => _("Work Order")), 2=> array ('id' => 2, 'name' => _("Customer")), 3=> array ('id' => 3, 'name' => _("Supplier")), + 4=> array ('id' => 4, 'name' => _("Quick Entry")) ); class payment_person_types @@ -175,12 +190,15 @@ class payment_person_types return 3; } - function dimension() + function QuickEntry() { return 4; } - //function Project() { return 4; } + function dimension() + { + return 5; + } function type_name($type) { @@ -194,6 +212,9 @@ class payment_person_types { case payment_person_types::misc() : return $person_id; + case payment_person_types::QuickEntry() : + $qe = get_quick_entry($person_id); + return ($full?payment_person_types::type_name($type) . " ":"") . $qe["description"]; case payment_person_types::WorkOrder() : $wo = get_work_order($person_id); return ($full?payment_person_types::type_name($type) . " ":"") . $wo["wo_ref"]; @@ -201,8 +222,6 @@ class payment_person_types return ($full?payment_person_types::type_name($type) . " ":"") . get_customer_name($person_id); case payment_person_types::supplier() : return ($full?payment_person_types::type_name($type) . " ":"") . get_supplier_name($person_id); - //case payment_person_types::Project() : - // return ($full?payment_person_types::type_name($type) . " ":"") . get_dimension_string($person_id); default : //DisplayDBerror("Invalid type sent to person_name"); //return; @@ -215,8 +234,8 @@ class payment_person_types switch ($type) { case payment_person_types::misc() : + case payment_person_types::QuickEntry() : case payment_person_types::WorkOrder() : - //case payment_person_types::Project() : return get_company_currency(); case payment_person_types::customer() : @@ -236,17 +255,17 @@ class payment_person_types { case payment_person_types::misc() : return true; - case payment_person_types::WorkOrder() : // 070305 changed to open workorders ES + case payment_person_types::QuickEntry() : + return db_has_quick_entries(); + case payment_person_types::WorkOrder() : // 070305 changed to open workorders JH return db_has_open_workorders(); case payment_person_types::customer() : return db_has_customers(); case payment_person_types::supplier() : return db_has_suppliers(); - //case payment_person_types::Project() : - // return db_has_dimensions(); default : display_db_error("Invalid type sent to has_items", ""); - return; + return false; } } } @@ -290,5 +309,34 @@ class wo_types } } +$quick_actions = array( + '=' => _('Remainder'), // post current base amount to GL account + 'a' => _('Amount'), // post amount to GL account + 'a+' => _('Amount, increase base'), // post amount to GL account and increase base + 'a-' => _('Amount, reduce base'), // post amount to GL account and reduce base + '%' => _('% amount of base'), // store acc*amount% to GL account + '%+' => _('% amount of base, increase base'), // ditto & increase base amount + '%-' => _('% amount of base, reduce base'), // ditto & reduce base amount + 'T' => _('Taxes added'), // post taxes calculated on base amount + 'T+' => _('Taxes added, increase base'), // ditto & increase base amount + 'T-' => _('Taxes added, reduce base'), // ditto & reduce base amount + 't' => _('Taxes included'), // post taxes calculated on base amount + 't+' => _('Taxes included, increase base'), // ditto & increase base amount + 't-' => _('Taxes included, reduce base') // ditto & reduce base amount +); + +define('QE_PAYMENT', '1'); +define('QE_DEPOSIT', '2'); +define('QE_JOURNAL', '3'); +define('QE_SUPPINV', '4'); + +$quick_entry_types = array( + QE_DEPOSIT => _("Bank Deposit"), + QE_PAYMENT => _("Bank Payment"), + QE_JOURNAL => _("Journal Entry"), + QE_SUPPINV => _("Supplier Invoice/Credit") +); + + ?> \ No newline at end of file diff --git a/includes/ui.inc b/includes/ui.inc index e1d472a7..33bd16b0 100644 --- a/includes/ui.inc +++ b/includes/ui.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ include_once($path_to_root . "/includes/ui/ui_lists.inc"); include_once($path_to_root . "/includes/ui/ui_controls.inc"); include_once($path_to_root . "/includes/ui/ui_input.inc"); diff --git a/includes/ui/allocation_cart.inc b/includes/ui/allocation_cart.inc index ee52150c..039e3bfb 100644 --- a/includes/ui/allocation_cart.inc +++ b/includes/ui/allocation_cart.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ /* definition of the Debtor Receipt/Credit note allocation class */ //----------------------------------------------------------------------------------- diff --git a/includes/ui/items_cart.inc b/includes/ui/items_cart.inc index a526852a..2178fba1 100644 --- a/includes/ui/items_cart.inc +++ b/includes/ui/items_cart.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ include_once($path_to_root . "/includes/prefs/sysprefs.inc"); include_once($path_to_root . "/inventory/includes/inventory_db.inc"); @@ -101,7 +110,7 @@ class items_cart else { // shouldn't come here under normal circumstances - display_db_error("unexpected - adding an invalid item or null quantity", "", true); + display_db_error("unexpected - invalid parameters in add_gl_item($code_id, $dimension_id, $dimension2_id, $amount,...)", "", true); } return false; diff --git a/includes/ui/ui_controls.inc b/includes/ui/ui_controls.inc index 1883ba2a..8546255b 100644 --- a/includes/ui/ui_controls.inc +++ b/includes/ui/ui_controls.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ //--------------------------------------------------------------------------------- function start_form($multi=false, $sid=false, $action="", $name="") @@ -47,6 +56,37 @@ function end_table($breaks=0) br($breaks); } +function start_outer_table($extra="", $padding='2', $spacing='0', $br=false) +{ + if ($br) + br(); + start_table($extra, $padding, $spacing); + echo "
"; - echo ""; // inner table + start_outer_table("width=90% $table_style2"); // outer table + table_section(1); + bank_accounts_list_row( $payment ? _("From:") : _("To:"), 'bank_account', null, true); date_row(_("Date:"), 'date_', '', null, 0, 0, 0, null, true); - echo "
"; // inner table - - echo "
"; - - echo ""; // inner table + table_section(2, "33%"); if (!isset($_POST['PayType'])) { @@ -67,6 +72,17 @@ function display_bank_header(&$order) hidden('PersonDetailID'); } break; + + case payment_person_types::QuickEntry() : + quick_entries_list_row(_("Type").":", 'person_id', null, ($payment ? QE_PAYMENT : QE_DEPOSIT), true); + $qid = get_quick_entry(get_post('person_id')); + if (list_updated('person_id')) { + unset($_POST['totamount']); // enable default + $Ajax->activate('totamount'); + } + amount_row($qid['base_desc'].":", 'totamount', price_format($qid['base_amount']), + null, "  ".submit('go', _("Go"), false, false, true)); + break; //case payment_person_types::Project() : // dimensions_list_row(_("Dimension:"), 'person_id', $_POST['person_id'], false, null, true); // break; @@ -77,24 +93,15 @@ function display_bank_header(&$order) exchange_rate_display($bank_currency, $person_currency, $_POST['date_']); - echo "
"; // inner table - - echo "
"; - - echo ""; // inner table - - bank_trans_types_list_row(_("Type:"), 'type', null); + table_section(3, "33%"); if (isset($_GET['NewPayment'])) ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::bank_payment())); else ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::bank_deposit())); - echo "
"; // inner table - - echo "
"; // outer table + $qes = has_quick_entries(QE_JOURNAL); + + start_outer_table("$table_style2 width=90%"); + table_section(1); - echo ""; start_row(); date_cells(_("Date:"), 'date_'); ref_cells(_("Reference:"), 'ref', '', references::get_next(0)); end_row(); - echo "
"; - - echo "
"; // outer table - - echo ""; + if ($qes) + table_section(2, "20%"); + else + table_section(2, "50%"); - check_row(_("Reverse Transaction:"), 'Reverse', null); - - echo "
"; + start_row(); + check_cells(_("Reverse Transaction:"), 'Reverse', null); + end_row(); + if ($qes !== false) + { + table_section(3, "50%"); + start_row(); + quick_entries_list_cells(_("Quick Entry").":", 'person_id', null, QE_JOURNAL, true); + $qid = get_quick_entry(get_post('person_id')); + if (list_updated('person_id')) { + unset($_POST['totamount']); // enable default + $Ajax->activate('totamount'); + } + amount_cells($qid['base_desc'].":", 'totamount', price_format($qid['base_amount']), + null, "  ".submit('go', _("Go"), false, false, true)); + end_row(); - echo "
\n"; // outer table +} + +function table_section($number=1, $width=false) +{ + if ($number > 1) + { + echo "
\n"; + $width = ($width ? "width=$width" : ""); + echo "
\n"; // outer table + } + echo "\n"; +} + +function end_outer_table($breaks=0, $close_table=true) +{ + if ($close_table) + echo "
\n"; + echo "
"; // outer table +} function meta_forward($forward_to, $params="") { global $Ajax; @@ -59,6 +99,27 @@ function meta_forward($forward_to, $params="") } //----------------------------------------------------------------------------------- +// Find and replace hotkey marker. +// if $clean == true marker is removed and clean label is returned +// (for use in wiki help system), otherwise result is array of label +// with underlined hotkey letter and access property string. +// +function access_string($label, $clean=false) +{ + $access = ''; + $slices = array(); + + if (preg_match('/(.*)&([a-zA-Z0-9])(.*)/', $label, $slices)) + { + $label = $clean ? $slices[1].$slices[2].$slices[3] : + $slices[1].''.$slices[2].''.$slices[3]; + $access = " accesskey='".strtoupper($slices[2])."'"; + } + + $label = str_replace( '&&', '&', $label); + + return $clean ? $label : array($label, $access); +} function hyperlink_back($center=true) { @@ -73,9 +134,10 @@ function hyperlink_back($center=true) function hyperlink_no_params($target, $label, $center=true) { + $pars = access_string($label); if ($center) echo "
"; - echo "$label\n"; + echo "$pars[0]\n"; if ($center) echo "
"; } @@ -91,9 +153,10 @@ function hyperlink_no_params_td($target, $label) function hyperlink_params($target, $label, $params, $center=true) { + $pars = access_string($label); if ($center) echo "
"; - echo "$label\n"; + echo "$pars[0]\n"; if ($center) echo "
"; } @@ -109,9 +172,10 @@ function hyperlink_params_td($target, $label, $params) function hyperlink_params_separate($target, $label, $params, $center=false) { + $pars = access_string($label); if ($center) echo "
"; - echo "$label\n"; + echo "$pars[0]\n"; if ($center) echo "
"; } @@ -139,48 +203,18 @@ function alt_table_row_color(&$k) } } -function table_section_title($msg) +function table_section_title($msg, $colspan=2) { - echo "
$msg
$msg
"; - edit_button($name, $value, $title); - echo ""; - button($name, $value, $onclick, $title); - echo "$label"; - check(null, $name, $value, $submit_on_change, $title); + echo check(null, $name, $value, $submit_on_change, $title); echo "
$label$value
"; + if ($label != null) + echo ""; + else + echo ""; echo ""; - if ($post_label) - echo " " . $post_label; - + if ($post_label) { + echo " $post_label"; + $Ajax->addUpdate($name, '_'.$name.'_label', $post_label); + } echo "$label"; - $str = dimensions_list($name, $selected_id, $no_option, $showname, false, $showclosed, $showtype); + $str = dimensions_list($name, $selected_id, $no_option, $showname, $submit_on_change, $showclosed, $showtype); echo "
$label
$label"; + $str = sales_items_list($name, $selected_id, $all_option, $submit_on_change, + 'local', array('cells'=>false)); + echo "
$label"; - $str = tax_groups_list($name, $selected_id, false, $submit_on_change); + $str = tax_groups_list($name, $selected_id, $none_option, $submit_on_change); echo "
$label"; + sales_groups_list($name, $selected_id, $special_option); + echo "
$label"; + templates_list($name, $selected_id, $special_option); + echo "
$label"; - bank_trans_types_list($name, $selected_id); + bank_reconciliation_list($account, $name, $selected_id, $submit_on_change, $special_option); echo "
$label"; + $str = combo_input($name, $selected_id, $sql, 'id', 'bank_account_name', + array( + 'format' => '_format_add_curr', + 'select_submit'=> $submit_on_change, + 'async' => true + ) ); + echo "
$label"; + + $str = combo_input($name, $selected_id, $sql, 'id', 'pos_name', + array( + 'select_submit'=> $submit_on_change, + 'async' => true, + 'spec_option' =>$spec_option, + 'spec_id' => -1, + ) ); + echo "
$label"; + $str = yesno_list($name, $selected_id, _('Cash'), _('Delayed'), $submit_on_change); + echo "$label"; - gl_all_accounts_list($name, $selected_id, $skip_bank_accounts, $show_group, $cells, $all_option); + gl_all_accounts_list($name, $selected_id, + $skip_bank_accounts, $cells, $all_option); echo "
$label"; + + array_selector($name, $selected_id, $profiles, + array( 'select_submit'=> $submit_on_change, + 'spec_option'=>$spec_opt, + 'spec_id' => '' + )); + + echo "
$label\n"; + quick_entries_list($name, $selected_id, $type, $submit_on_change); + echo "
$label"; + array_selector($name, $selected_id, $quick_actions, + array( + 'select_submit'=> $submit_on_change + ) ); + echo "
$label"; + array_selector($name, $selected_id, $quick_entry_types, + array( + 'select_submit'=> $submit_on_change + ) ); + echo "
"; + $style = $class_counter==$_REQUEST['Class'] ? '' : "style='display:none'"; + $acc = access_string($key); + $st_classes .= "$acc[0]
"; + $st_reports .= "
" . _("Reports For Class: ") . " $key
\n"; foreach($value as $report) { - $st_reports .= ""; - $st_params .= "
" . _("Reports For Class: ") . " $key
" . $report->name . "
"; - $st_params .= ""; + $acc = access_string($report->name); + $st_reports .= "id" + ."'$acc[1]>$acc[0]\n"; + if (isset($_REQUEST['rep_id']) && $_REQUEST['rep_id']==$report->id) { + + $action = $path_to_root.'/reporting/prn_redirect.php'; + + $st_params = "
\n" + . "
\n"; + $st_params .= hidden('REP_ID', $report->id, false); + $st_params .= submit('Rep'.$report->id, + _("Display: ") . access_string($report->name,true), + false, '', $pdf_debug==0) . '

'; + $st_params .= $report->getDisplay() + . "\n
\n"; + $Ajax->addUpdate(true, 'rep_form', $st_params); + } } $st_reports .= ""; + $class_counter++; } + $st_params = "
". + "$st_params
"; + + $st = " "; @@ -83,39 +116,12 @@ class Report $this->name = $name; $this->ar_params = $ar_params; } + function getDisplay() { - global $comp_path, $path_to_root, $use_date_picker; - - $rep_file = $comp_path.'/'.user_company(). - "/reporting/rep".$this->id.".php"; - if (!file_exists($rep_file)) - $rep_file = $path_to_root ."/reporting/rep".$this->id.".php"; - - $st = " - - "; - $st .= "

"; + $st = ''; $dummy = ""; if ($this->ar_params==null) return ""; @@ -126,7 +132,7 @@ class Report { case 'CURRENCY': $sql = "SELECT curr_abrev, concat(curr_abrev,' - ', currency) FROM ".TB_PREF."currencies"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Currency Filter")); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy, true, _("No Currency Filter")); break; case 'DATE': case 'DATEBEGIN': @@ -158,8 +164,8 @@ class Report $date = begin_month($bdate); } } - $name = "RP_" . $this->id . "_$index"; - //$st .= ""; + $name = "PARAM_$index"; + $st .= ""; if ($use_date_picker) $st .= "" @@ -168,81 +174,84 @@ class Report break; case 'YES_NO': $sel = array(_('No'), _("Yes")); - $st .= dup_simple_name_list("RP_" . $this->id . "_$index", $sel); + $st .= dup_simple_name_list("PARAM_$index", $sel); break; case 'PAYMENT_LINK': $sel = array(_("No Payment Link"), "PayPal"); - $st .= dup_simple_name_list("RP_" . $this->id . "_$index", $sel); + $st .= dup_simple_name_list("PARAM_$index", $sel); + break; + case 'DESTINATION': + $sel = array(_("PDF/Printer"), "Excel"); + $st .= dup_simple_name_list("PARAM_$index", $sel); break; case 'COMPARE': $sel = array(_("Accumulated"), _("Period Y-1"), _("Budget")); - $st .= dup_simple_name_list("RP_" . $this->id . "_$index", $sel); + $st .= dup_simple_name_list("PARAM_$index", $sel); break; case 'GRAPHIC': $sel = array(_("No Graphics"), _("Vertical bars"), _("Horizontal bars"), _("Dots"), _("Lines"), _("Pie"), _("Donut")); - $st .= dup_simple_name_list("RP_" . $this->id . "_$index", $sel); + $st .= dup_simple_name_list("PARAM_$index", $sel); break; case 'SYS_TYPES': - $st .= dup_systypes_list("RP_" . $this->id . "_$index", $dummy, true, _("No Type Filter"), true); + $st .= dup_systypes_list("PARAM_$index", $dummy, true, _("No Type Filter"), true); break; case 'TEXT': - $st .= ""; + $st .= ""; break; case 'TEXTBOX': - $st .= ""; + $st .= ""; break; case 'ACCOUNTS': $sql = "SELECT id, name FROM ".TB_PREF."chart_types ORDER BY name"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Account Group Filter"), true); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy, true, _("No Account Group Filter"), true); break; case 'GL_ACCOUNTS': $sql = "SELECT account_code, concat(account_code, ' - ', account_name) as account_name FROM ".TB_PREF."chart_master ORDER BY account_code"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy); break; case 'BANK_ACCOUNTS': - $sql = "SELECT ".TB_PREF."bank_accounts.account_code, concat(bank_account_name, if (bank_curr_code=curr_default,'', concat(' - ', bank_curr_code))) FROM ".TB_PREF."bank_accounts, ".TB_PREF."chart_master, ".TB_PREF."company - WHERE ".TB_PREF."bank_accounts.account_code=".TB_PREF."chart_master.account_code"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy); + $sql = "SELECT ".TB_PREF."bank_accounts.id, concat(bank_account_name, if (bank_curr_code=curr_default,'', concat(' - ', bank_curr_code))) FROM ".TB_PREF."bank_accounts, ".TB_PREF."company"; + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy); break; case 'DIMENSION': $sql = "SELECT reference, concat(reference, ' - ', name) AS DimName FROM ".TB_PREF."dimensions ORDER BY reference"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy); break; case 'DIMENSIONS': $sql = "SELECT reference, concat(reference, ' - ', name) as DimName FROM ".TB_PREF."dimensions ORDER BY reference"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Dimension Filter"), true); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy, true, _("No Dimension Filter"), true); break; case 'DIMENSION1': $sql = "SELECT reference, concat(reference, ' - ', name) AS DimName FROM ".TB_PREF."dimensions WHERE type_=1 ORDER BY reference"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index". "_$index", $dummy); break; case 'DIMENSIONS1': $sql = "SELECT reference, concat(reference, ' - ', name) as DimName FROM ".TB_PREF."dimensions WHERE type_=1 ORDER BY reference"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Dimension Filter"), true); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy, true, _("No Dimension Filter"), true); break; case 'DIMENSION2': $sql = "SELECT reference, concat(reference, ' - ', name) AS DimName FROM ".TB_PREF."dimensions WHERE type_=2 ORDER BY reference"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy); break; case 'DIMENSIONS2': $sql = "SELECT reference, concat(reference, ' - ', name) as DimName FROM ".TB_PREF."dimensions WHERE type_=2 ORDER BY reference"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Dimension Filter"), true); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy, true, _("No Dimension Filter"), true); break; case 'CUSTOMERS_NO_FILTER': case 'CUSTOMERS': $sql = "SELECT debtor_no, name FROM ".TB_PREF."debtors_master ORDER BY name"; if ($param->param_type == 'CUSTOMERS_NO_FILTER') - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Customer Filter"), true); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy, true, _("No Customer Filter"), true); else - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy); break; case 'SUPPLIERS_NO_FILTER': case 'SUPPLIERS': $sql = "SELECT supplier_id, supp_name FROM ".TB_PREF."suppliers ORDER BY supp_name"; if ($param->param_type == 'SUPPLIERS_NO_FILTER') - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Supplier Filter"), true); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy, true, _("No Supplier Filter"), true); else - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy); break; case 'INVOICE': $IV = _("IV"); @@ -250,7 +259,7 @@ class Report $sql = "SELECT concat(".TB_PREF."debtor_trans.trans_no, '-', ".TB_PREF."debtor_trans.type) AS TNO, concat(".TB_PREF."debtor_trans.trans_no, if (type=10, ' $IV ', ' $CN '), ".TB_PREF."debtors_master.name) as IName FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE (type=10 OR type=11) AND ".TB_PREF."debtors_master.debtor_no=".TB_PREF."debtor_trans.debtor_no ORDER BY ".TB_PREF."debtor_trans.trans_no DESC"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy); break; case 'DELIVERY': $DN = _("DN"); @@ -260,51 +269,51 @@ class Report FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE type=13 AND ".TB_PREF."debtors_master.debtor_no=". TB_PREF."debtor_trans.debtor_no ORDER BY ".TB_PREF."debtor_trans.trans_no DESC"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy); break; case 'ORDERS': $sql = "SELECT ".TB_PREF."sales_orders.order_no, concat(".TB_PREF."sales_orders.order_no, '-', ".TB_PREF."debtors_master.name) as IName FROM ".TB_PREF."debtors_master, ".TB_PREF."sales_orders WHERE ".TB_PREF."debtors_master.debtor_no=".TB_PREF."sales_orders.debtor_no ORDER BY ".TB_PREF."sales_orders.order_no DESC"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy); break; case 'PO': $sql = "SELECT ".TB_PREF."purch_orders.order_no, concat(".TB_PREF."purch_orders.order_no, '-', ".TB_PREF."suppliers.supp_name) as IName FROM ".TB_PREF."suppliers, ".TB_PREF."purch_orders WHERE ".TB_PREF."suppliers.supplier_id=".TB_PREF."purch_orders.supplier_id ORDER BY ".TB_PREF."purch_orders.order_no DESC"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy); break; case 'ITEMS': $sql = "SELECT stock_id, concat(stock_id, '-', description) as name FROM ".TB_PREF."stock_master WHERE (mb_flag='A' OR mb_flag='M') ORDER BY stock_id"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy); break; case 'LOCATIONS': $sql = "SELECT loc_code, location_name FROM ".TB_PREF."locations ORDER BY location_name"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Location Filter"), false); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy, true, _("No Location Filter"), false); break; case 'CATEGORIES': $sql = "SELECT category_id, description FROM ".TB_PREF."stock_category ORDER BY description"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Category Filter"), true); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy, true, _("No Category Filter"), true); break; case 'SALESTYPES': $sql = "SELECT id, sales_type FROM ".TB_PREF."sales_types ORDER BY sales_type"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy); break; case 'AREAS': $sql = "SELECT area_code, description FROM ".TB_PREF."areas ORDER BY description"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Area Filter"), true); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy, true, _("No Area Filter"), true); break; case 'SALESMEN': $sql = "SELECT salesman_code, salesman_name FROM ".TB_PREF."salesman ORDER BY salesman_name"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Sales Folk Filter"), true); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy, true, _("No Sales Folk Filter"), true); break; case 'TRANS_YEARS': $sql = "SELECT DISTINCT YEAR(tran_date), YEAR(tran_date) FROM ".TB_PREF."gl_trans"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy); break; case 'ACCOUNTS_NO_FILTER': $sql = "SELECT id, name FROM ".TB_PREF."chart_types ORDER BY name"; - $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy); + $st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy); break; } diff --git a/reporting/includes/tcpdf.php b/reporting/includes/tcpdf.php index 35e69dda..48504eb9 100644 --- a/reporting/includes/tcpdf.php +++ b/reporting/includes/tcpdf.php @@ -1756,7 +1756,8 @@ if (!class_exists('TCPDF')) { */ function Error($msg) { //Fatal error - die('TCPDF error: '.$msg); + display_error('TCPDF error: '.$msg); + exit; } /** @@ -2602,9 +2603,9 @@ if (!class_exists('TCPDF')) { if (isset($cw)) { unset($cw); } - include($this->_getfontpath().$file); + @include($this->_getfontpath().$file); if ((!isset($type)) OR (!isset($cw))) { - $this->Error('Could not include font definition file'); + $this->Error("Could not include font definition file: ".$file); } $i = count($this->fonts) + 1; // register CID font (all styles at once) @@ -5005,7 +5006,8 @@ if (!class_exists('TCPDF')) { * @access protected */ function _putheader() { - $this->_out('%PDF-'.$this->PDFVersion); + $this->buffer = '%PDF-'.$this->PDFVersion."\n".$this->buffer; +// $this->_out('%PDF-'.$this->PDFVersion); } /** diff --git a/reporting/rep101.php b/reporting/rep101.php index cd5bfef7..d8ad7d64 100644 --- a/reporting/rep101.php +++ b/reporting/rep101.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- @@ -8,12 +17,12 @@ $page_security = 2; // date_: 2005-05-19 // Title: Customer Balances // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); //---------------------------------------------------------------------------------------------------- @@ -45,12 +54,15 @@ function print_customer_balances() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - $to = $_POST['PARAM_0']; $fromcust = $_POST['PARAM_1']; $currency = $_POST['PARAM_2']; $comments = $_POST['PARAM_3']; + $destination = $_POST['PARAM_4']; + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); if ($fromcust == reserved_words::get_all_numeric()) $from = _('All'); @@ -78,7 +90,7 @@ function print_customer_balances() 2 => array('text' => _('Customer'), 'from' => $from, 'to' => ''), 3 => array('text' => _('Currency'), 'from' => $currency, 'to' => '')); - $rep = new FrontReport(_('Customer Balances'), "CustomerBalances.pdf", user_pagesize()); + $rep = new FrontReport(_('Customer Balances'), "CustomerBalances", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); @@ -112,10 +124,9 @@ function print_customer_balances() $rep->NewLine(1, 2); $rep->TextCol(0, 1, $trans['type_name']); $rep->TextCol(1, 2, $trans['reference']); - $date = sql2date($trans['tran_date']); - $rep->TextCol(2, 3, $date); + $rep->DateCol(2, 3, $trans['tran_date'], true); if ($trans['type'] == 10) - $rep->TextCol(3, 4, sql2date($trans['due_date'])); + $rep->DateCol(3, 4, $trans['due_date'], true); $item[0] = $item[1] = 0.0; if ($convert) $rate = $trans['rate']; @@ -126,15 +137,15 @@ function print_customer_balances() if ($trans['TotalAmount'] > 0.0) { $item[0] = round2(abs($trans['TotalAmount']) * $rate, $dec); - $rep->TextCol(4, 5, number_format2($item[0], $dec)); + $rep->AmountCol(4, 5, $item[0], $dec); } else { $item[1] = round2(Abs($trans['TotalAmount']) * $rate, $dec); - $rep->TextCol(5, 6, number_format2($item[1], $dec)); + $rep->AmountCol(5, 6, $item[1], $dec); } $item[2] = round2($trans['Allocated'] * $rate, $dec); - $rep->TextCol(6, 7, number_format2($item[2], $dec)); + $rep->AmountCol(6, 7, $item[2], $dec); /* if ($trans['type'] == 10) $item[3] = ($trans['TotalAmount'] - $trans['Allocated']) * $rate; @@ -145,7 +156,7 @@ function print_customer_balances() $item[3] = $item[0] + $item[1] - $item[2]; else $item[3] = $item[0] - $item[1] + $item[2]; - $rep->TextCol(7, 8, number_format2($item[3], $dec)); + $rep->AmountCol(7, 8, $item[3], $dec); for ($i = 0; $i < 4; $i++) { $total[$i] += $item[$i]; @@ -156,7 +167,7 @@ function print_customer_balances() $rep->NewLine(2); $rep->TextCol(0, 3, _('Total')); for ($i = 0; $i < 4; $i++) - $rep->TextCol($i + 4, $i + 5, number_format2($total[$i], $dec)); + $rep->AmountCol($i + 4, $i + 5, $total[$i], $dec); $rep->Line($rep->row - 4); $rep->NewLine(2); } @@ -164,8 +175,9 @@ function print_customer_balances() $rep->TextCol(0, 3, _('Grand Total')); $rep->fontSize -= 2; for ($i = 0; $i < 4; $i++) - $rep->TextCol($i + 4, $i + 5, number_format2($grandtotal[$i], $dec)); + $rep->AmountCol($i + 4, $i + 5, $grandtotal[$i], $dec); $rep->Line($rep->row - 4); + $rep->NewLine(); $rep->End(); } diff --git a/reporting/rep102.php b/reporting/rep102.php index 41d6379f..dfe44570 100644 --- a/reporting/rep102.php +++ b/reporting/rep102.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,16 +16,15 @@ $page_security = 2; // date_: 2005-05-19 // Title: Aged Customer Balances // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_aged_customer_analysis(); function get_invoices($costomer_id, $to) @@ -60,17 +68,20 @@ function print_aged_customer_analysis() { global $comp_path, $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - $to = $_POST['PARAM_0']; $fromcust = $_POST['PARAM_1']; $currency = $_POST['PARAM_2']; $summaryOnly = $_POST['PARAM_3']; $graphics = $_POST['PARAM_4']; $comments = $_POST['PARAM_5']; + $destination = $_POST['PARAM_6']; + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); if ($graphics) { - include_once($path_to_root . "reporting/includes/class.graphic.inc"); + include_once($path_to_root . "/reporting/includes/class.graphic.inc"); $pg = new graph(); } @@ -112,7 +123,7 @@ function print_aged_customer_analysis() if ($convert) $headers[2] = _('Currency'); - $rep = new FrontReport(_('Aged Customer Analysis'), "AgedCustomerAnalysis.pdf", user_pagesize()); + $rep = new FrontReport(_('Aged Customer Analysis'), "AgedCustomerAnalysis", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); @@ -131,11 +142,11 @@ function print_aged_customer_analysis() if (!$convert && $currency != $myrow['curr_code']) continue; $rep->fontSize += 2; - $rep->TextCol(0, 3, $myrow['name']); + $rep->TextCol(0, 2, $myrow['name']); if ($convert) { $rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $to); - $rep->TextCol(2, 4, $myrow['curr_code']); + $rep->TextCol(2, 3, $myrow['curr_code']); } else $rate = 1.0; @@ -148,13 +159,13 @@ function print_aged_customer_analysis() $total[2] += ($custrec["Overdue1"]-$custrec["Overdue2"]); $total[3] += $custrec["Overdue2"]; $total[4] += $custrec["Balance"]; - $str = array(number_format2(($custrec["Balance"] - $custrec["Due"]),$dec), - number_format2(($custrec["Due"]-$custrec["Overdue1"]),$dec), - number_format2(($custrec["Overdue1"]-$custrec["Overdue2"]) ,$dec), - number_format2($custrec["Overdue2"],$dec), - number_format2($custrec["Balance"],$dec)); + $str = array($custrec["Balance"] - $custrec["Due"], + $custrec["Due"]-$custrec["Overdue1"], + $custrec["Overdue1"]-$custrec["Overdue2"], + $custrec["Overdue2"], + $custrec["Balance"]); for ($i = 0; $i < count($str); $i++) - $rep->TextCol($i + 3, $i + 4, $str[$i]); + $rep->AmountCol($i + 3, $i + 4, $str[$i], $dec); $rep->NewLine(1, 2); if (!$summaryOnly) { @@ -167,7 +178,7 @@ function print_aged_customer_analysis() $rep->NewLine(1, 2); $rep->TextCol(0, 1, $trans['type_name'], -2); $rep->TextCol(1, 2, $trans['reference'], -2); - $rep->TextCol(2, 3, sql2date($trans['tran_date']), -2); + $rep->DateCol(2, 3, $trans['tran_date'], true, -2); if ($trans['type'] == 11 || $trans['type'] == 12 || $trans['type'] == 2) { $trans['Balance'] *= -1; @@ -177,13 +188,13 @@ function print_aged_customer_analysis() } foreach ($trans as $i => $value) $trans[$i] *= $rate; - $str = array(number_format2(($trans["Balance"] - $trans["Due"]),$dec), - number_format2(($trans["Due"]-$trans["Overdue1"]),$dec), - number_format2(($trans["Overdue1"]-$trans["Overdue2"]) ,$dec), - number_format2($trans["Overdue2"],$dec), - number_format2($trans["Balance"],$dec)); + $str = array($trans["Balance"] - $trans["Due"], + $trans["Due"]-$trans["Overdue1"], + $trans["Overdue1"]-$trans["Overdue2"], + $trans["Overdue2"], + $trans["Balance"]); for ($i = 0; $i < count($str); $i++) - $rep->TextCol($i + 3, $i + 4, $str[$i]); + $rep->AmountCol($i + 3, $i + 4, $str[$i], $dec); } $rep->Line($rep->row - 8); $rep->NewLine(2); @@ -199,7 +210,7 @@ function print_aged_customer_analysis() $rep->fontSize -= 2; for ($i = 0; $i < count($total); $i++) { - $rep->TextCol($i + 3, $i + 4, number_format2($total[$i], $dec)); + $rep->AmountCol($i + 3, $i + 4, $total[$i], $dec); if ($graphics && $i < count($total) - 1) { $pg->y[$i] = abs($total[$i]); @@ -217,7 +228,7 @@ function print_aged_customer_analysis() $pg->type = $graphics; $pg->skin = $graph_skin; $pg->built_in = false; - $pg->fontfile = $path_to_root . "reporting/fonts/Vera.ttf"; + $pg->fontfile = $path_to_root . "/reporting/fonts/Vera.ttf"; $pg->latin_notation = ($decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != "."); $filename = $comp_path .'/'. user_company(). "/images/test.png"; $pg->display($filename, true); @@ -229,6 +240,7 @@ function print_aged_customer_analysis() $rep->Header(); $rep->AddImage($filename, $x, $rep->row - $h, $w, $h); } + $rep->NewLine(); $rep->End(); } diff --git a/reporting/rep103.php b/reporting/rep103.php index dd655487..f7ae195e 100644 --- a/reporting/rep103.php +++ b/reporting/rep103.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,16 +16,15 @@ $page_security = 2; // date_: 2005-05-19 // Title: Customer Details Listing // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_customer_details_listing(); function get_customer_details_for_report($area=0, $salesid=0) @@ -87,14 +95,17 @@ function print_customer_details_listing() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - $from = $_POST['PARAM_0']; $area = $_POST['PARAM_1']; $folk = $_POST['PARAM_2']; $more = $_POST['PARAM_3']; $less = $_POST['PARAM_4']; $comments = $_POST['PARAM_5']; + $destination = $_POST['PARAM_6']; + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); $dec = 0; @@ -136,7 +147,7 @@ function print_customer_details_listing() 3 => array('text' => _('Sales Folk'), 'from' => $salesfolk, 'to' => ''), 4 => array('text' => _('Activity'), 'from' => $morestr, 'to' => $lessstr)); - $rep = new FrontReport(_('Customer Details Listing'), "CustomerDetailsListing.pdf", user_pagesize()); + $rep = new FrontReport(_('Customer Details Listing'), "CustomerDetailsListing", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); diff --git a/reporting/rep104.php b/reporting/rep104.php index 55660331..280f447a 100644 --- a/reporting/rep104.php +++ b/reporting/rep104.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,19 +16,18 @@ $page_security = 2; // date_: 2005-05-19 // Title: price Listing // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/ui/ui_input.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); -include_once($path_to_root . "sales/includes/db/sales_types_db.inc"); -include_once($path_to_root . "inventory/includes/db/items_category_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/ui/ui_input.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); +include_once($path_to_root . "/sales/includes/db/sales_types_db.inc"); +include_once($path_to_root . "/inventory/includes/db/items_category_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_price_listing(); function fetch_items($category=0) @@ -38,20 +46,39 @@ function fetch_items($category=0) return db_query($sql,"No transactions were returned"); } + +function get_kits($category=0) +{ + $sql = "SELECT i.item_code AS kit_code, i.description AS kit_name, c.category_id AS cat_id, c.description AS cat_name, count(*)>1 AS kit + FROM + ".TB_PREF."item_codes i + LEFT JOIN + ".TB_PREF."stock_category c + ON i.category_id=c.category_id"; + $sql .= " WHERE !i.is_foreign AND i.item_code!=i.stock_id"; + if ($category != 0) + $sql .= " AND c.category_id = '$category'"; + $sql .= " GROUP BY i.item_code"; + return db_query($sql,"No kits were returned"); +} + //---------------------------------------------------------------------------------------------------- function print_price_listing() { global $comp_path, $path_to_root, $pic_height, $pic_width; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - $currency = $_POST['PARAM_0']; $category = $_POST['PARAM_1']; $salestype = $_POST['PARAM_2']; $pictures = $_POST['PARAM_3']; $showGP = $_POST['PARAM_4']; $comments = $_POST['PARAM_5']; + $destination = $_POST['PARAM_6']; + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); $dec = user_price_dec(); @@ -94,7 +121,7 @@ function print_price_listing() else $user_comp = ""; - $rep = new FrontReport(_('Price Listing'), "PriceListing.pdf", user_pagesize()); + $rep = new FrontReport(_('Price Listing'), "PriceListing", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); @@ -120,7 +147,7 @@ function print_price_listing() $rep->TextCol(0, 1, $myrow['stock_id']); $rep->TextCol(1, 2, $myrow['name']); $price = get_price($myrow['stock_id'], $currency, $salestype); - $rep->TextCol(2, 3, number_format2($price, $dec)); + $rep->AmountCol(2, 3, $price, $dec); if ($showGP) { $price2 = get_price($myrow['stock_id'], $home_curr, $salestype); @@ -147,6 +174,38 @@ function print_price_listing() $rep->NewLine(0, 1); } $rep->Line($rep->row - 4); + + $result = get_kits($category); + + $catgor = ''; + while ($myrow=db_fetch($result)) + { + if ($catgor != $myrow['cat_name']) + { + if ($catgor == '') + { + $rep->NewLine(2); + $rep->fontSize += 2; + $rep->TextCol(0, 3, _("Sales Kits")); + $rep->fontSize -= 2; + } + $rep->Line($rep->row - $rep->lineHeight); + $rep->NewLine(2); + $rep->fontSize += 2; + $rep->TextCol(0, 3, $myrow['cat_id'] . " - " . $myrow['cat_name']); + $catgor = $myrow['cat_name']; + $rep->fontSize -= 2; + $rep->NewLine(); + } + $rep->NewLine(); + $rep->TextCol(0, 1, $myrow['kit_code']); + $rep->TextCol(1, 2, $myrow['kit_name']); + $price = get_kit_price($myrow['kit_code'], $currency, $salestype); + $rep->AmountCol(2, 3, $price, $dec); + $rep->NewLine(0, 1); + } + $rep->Line($rep->row - 4); + $rep->NewLine(); $rep->End(); } diff --git a/reporting/rep105.php b/reporting/rep105.php index e25b89aa..bc367e6a 100644 --- a/reporting/rep105.php +++ b/reporting/rep105.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,17 +16,16 @@ $page_security = 2; // date_: 2005-05-19 // Title: Order Status List // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "sales/includes/sales_db.inc"); -include_once($path_to_root . "inventory/includes/db/items_category_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/sales/includes/sales_db.inc"); +include_once($path_to_root . "/inventory/includes/db/items_category_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_order_status_list(); //---------------------------------------------------------------------------------------------------- @@ -63,14 +71,17 @@ function print_order_status_list() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; $category = $_POST['PARAM_2']; $location = $_POST['PARAM_3']; $backorder = $_POST['PARAM_4']; $comments = $_POST['PARAM_5']; + $destination = $_POST['PARAM_6']; + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); if ($category == reserved_words::get_all_numeric()) $category = 0; @@ -108,7 +119,7 @@ function print_order_status_list() $cols2 = $cols; $aligns2 = $aligns; - $rep = new FrontReport(_('Order Status Listing'), "OrderStatusListing.pdf", user_pagesize()); + $rep = new FrontReport(_('Order Status Listing'), "OrderStatusListing", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2); @@ -136,8 +147,8 @@ function print_order_status_list() $rep->TextCol(1, 2, get_customer_name($myrow['debtor_no'])); $rep->TextCol(2, 3, get_branch_name($myrow['branch_code'])); $rep->TextCol(3, 4, $myrow['customer_ref']); - $rep->TextCol(4, 5, sql2date($myrow['ord_date'])); - $rep->TextCol(5, 6, sql2date($myrow['delivery_date'])); + $rep->DateCol(4, 5, $myrow['ord_date'], true); + $rep->DateCol(5, 6, $myrow['delivery_date'], true); $rep->TextCol(6, 7, $myrow['from_stk_loc']); $rep->NewLine(2); $orderno = $myrow['order_no']; @@ -145,9 +156,9 @@ function print_order_status_list() $rep->TextCol(0, 1, $myrow['stk_code']); $rep->TextCol(1, 2, $myrow['description']); $dec = get_qty_dec($myrow['stk_code']); - $rep->TextCol(2, 3, number_format2($myrow['quantity'], $dec)); - $rep->TextCol(3, 4, number_format2($myrow['qty_sent'], $dec)); - $rep->TextCol(4, 5, number_format2($myrow['quantity'] - $myrow['qty_sent'], $dec)); + $rep->AmountCol(2, 3, $myrow['quantity'], $dec); + $rep->AmountCol(3, 4, $myrow['qty_sent'], $dec); + $rep->AmountCol(4, 5, $myrow['quantity'] - $myrow['qty_sent'], $dec); if ($myrow['quantity'] - $myrow['qty_sent'] > 0) { $rep->Font('italic'); diff --git a/reporting/rep106.php b/reporting/rep106.php index ad26d7dd..bc388935 100644 --- a/reporting/rep106.php +++ b/reporting/rep106.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,17 +16,16 @@ $page_security = 2; // date_: 2005-05-19 // Title: Order Status List // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "sales/includes/sales_db.inc"); -include_once($path_to_root . "inventory/includes/db/items_category_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/sales/includes/sales_db.inc"); +include_once($path_to_root . "/inventory/includes/db/items_category_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_salesman_list(); //---------------------------------------------------------------------------------------------------- @@ -51,12 +59,15 @@ function print_salesman_list() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; $summary = $_POST['PARAM_2']; $comments = $_POST['PARAM_3']; + $destination = $_POST['PARAM_4']; + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); if ($summary == 0) $sum = _("No"); @@ -82,7 +93,7 @@ function print_salesman_list() $cols2 = $cols; $aligns2 = $aligns; - $rep = new FrontReport(_('Salesman Listing'), "SalesmanListing.pdf", user_pagesize()); + $rep = new FrontReport(_('Salesman Listing'), "SalesmanListing", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2); @@ -107,17 +118,16 @@ function print_salesman_list() $rep->Line($rep->row - 8); $rep->NewLine(2); $rep->TextCol(0, 3, _('Total')); - $rep->TextCol(5, 6, number_format2($subtotal, $dec)); - $rep->TextCol(6, 7, number_format2($subprov, $dec)); + $rep->AmountCol(5, 6, $subtotal, $dec); + $rep->AmountCol(6, 7, $subprov, $dec); $rep->Line($rep->row - 4); $rep->NewLine(2); - //$rep->Line($rep->row); } $rep->TextCol(0, 2, $myrow['salesman_code']." ".$myrow['salesman_name']); $rep->TextCol(2, 3, $myrow['salesman_phone']); $rep->TextCol(3, 4, $myrow['salesman_email']); $rep->TextCol(4, 5, number_format2($myrow['provision'], user_percent_dec()) ." %"); - $rep->TextCol(5, 6, number_format2($myrow['break_pt'], $dec)); + $rep->AmountCol(5, 6, $myrow['break_pt'], $dec); $rep->TextCol(6, 7, number_format2($myrow['provision2'], user_percent_dec()) ." %"); $rep->NewLine(2); $salesman = $myrow['salesman_code']; @@ -126,7 +136,6 @@ function print_salesman_list() $subtotal = 0; $subprov = 0; } - $date = sql2date($myrow['tran_date']); $rate = $myrow['rate']; $amt = $myrow['InvoiceTotal'] * $rate; if ($subprov > $myrow['break_pt'] && $myrow['provision2'] != 0) @@ -139,9 +148,9 @@ function print_salesman_list() $rep->TextCol(1, 2, $myrow['DebtorName']); $rep->TextCol(2, 3, $myrow['br_name']); $rep->TextCol(3, 4, $myrow['contact_name']); - $rep->TextCol(4, 5, $date); - $rep->TextCol(5, 6, number_format2($amt, $dec)); - $rep->TextCol(6, 7, number_format2($prov, $dec)); + $rep->DateCol(4, 5, $myrow['tran_date'], true); + $rep->AmountCol(5, 6, $amt, $dec); + $rep->AmountCol(6, 7, $prov, $dec); $rep->NewLine(); if ($rep->row < $rep->bottomMargin + (2 * $rep->lineHeight)) { @@ -157,20 +166,20 @@ function print_salesman_list() $rep->Line($rep->row - 4); $rep->NewLine(2); $rep->TextCol(0, 3, _('Total')); - $rep->TextCol(5, 6, number_format2($subtotal, $dec)); - $rep->TextCol(6, 7, number_format2($subprov, $dec)); + $rep->AmountCol(5, 6, $subtotal, $dec); + $rep->AmountCol(6, 7, $subprov, $dec); $rep->Line($rep->row - 4); $rep->NewLine(2); - //$rep->Line($rep->row); $total += $subtotal; $provtotal += $subprov; } $rep->fontSize += 2; $rep->TextCol(0, 3, _('Grand Total')); $rep->fontSize -= 2; - $rep->TextCol(5, 6, number_format2($total, $dec)); - $rep->TextCol(6, 7, number_format2($provtotal, $dec)); + $rep->AmountCol(5, 6, $total, $dec); + $rep->AmountCol(6, 7, $provtotal, $dec); $rep->Line($rep->row - 4); + $rep->NewLine(); $rep->End(); } diff --git a/reporting/rep107.php b/reporting/rep107.php index 05b28c3f..d9f8aa22 100644 --- a/reporting/rep107.php +++ b/reporting/rep107.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,16 +16,15 @@ $page_security = 2; // date_: 2005-05-19 // Title: Print Invoices // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "sales/includes/sales_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/sales/includes/sales_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_invoices(); //---------------------------------------------------------------------------------------------------- @@ -25,7 +33,7 @@ function print_invoices() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; @@ -57,7 +65,7 @@ function print_invoices() if ($email == 0) { - $rep = new FrontReport(_('INVOICE'), "InvoiceBulk.pdf", user_pagesize()); + $rep = new FrontReport(_('INVOICE'), "InvoiceBulk", user_pagesize()); $rep->currency = $cur; $rep->Font(); $rep->Info($params, $cols, null, $aligns); @@ -115,13 +123,17 @@ function print_invoices() else $DisplayDiscount = number_format2($myrow2["discount_percent"]*100,user_percent_dec()) . "%"; $rep->TextCol(0, 1, $myrow2['stock_id'], -2); - $rep->TextCol(1, 2, $myrow2['StockDescription'], -2); + $oldrow = $rep->row; + $rep->TextColLines(1, 2, $myrow2['StockDescription'], -2); + $newrow = $rep->row; + $rep->row = $oldrow; $rep->TextCol(2, 3, $DisplayQty, -2); $rep->TextCol(3, 4, $myrow2['units'], -2); $rep->TextCol(4, 5, $DisplayPrice, -2); $rep->TextCol(5, 6, $DisplayDiscount, -2); $rep->TextCol(6, 7, $DisplayNet, -2); - $rep->NewLine(1); + $rep->row = $newrow; + //$rep->NewLine(1); if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight)) $rep->Header2($myrow, $branch, $sales_order, $baccount,$j); } @@ -137,16 +149,16 @@ function print_invoices() $DisplaySubTot = number_format2($SubTotal,$dec); $DisplayFreight = number_format2($sign*$myrow["ov_freight"],$dec); - $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight); + $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight); $linetype = true; $doctype = $j; if ($rep->currency != $myrow['curr_code']) { - include($path_to_root . "reporting/includes/doctext2.inc"); + include($path_to_root . "/reporting/includes/doctext2.inc"); } else { - include($path_to_root . "reporting/includes/doctext.inc"); + include($path_to_root . "/reporting/includes/doctext.inc"); } $rep->TextCol(3, 6, $doc_Sub_total, -2); @@ -155,7 +167,7 @@ function print_invoices() $rep->TextCol(3, 6, $doc_Shipping, -2); $rep->TextCol(6, 7, $DisplayFreight, -2); $rep->NewLine(); - $tax_items = get_customer_trans_tax_details($j, $i); + $tax_items = get_trans_tax_details($j, $i); while ($tax_item = db_fetch($tax_items)) { $DisplayTax = number_format2($sign*$tax_item['amount'], $dec); diff --git a/reporting/rep108.php b/reporting/rep108.php index f6eae3ee..8e0316d7 100644 --- a/reporting/rep108.php +++ b/reporting/rep108.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,16 +16,15 @@ $page_security = 2; // date_: 2005-05-19 // Title: Print Statements // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "sales/includes/sales_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/sales/includes/sales_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_statements(); //---------------------------------------------------------------------------------------------------- @@ -43,7 +51,7 @@ function print_statements() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); $customer = $_POST['PARAM_0']; $currency = $_POST['PARAM_1']; @@ -70,7 +78,7 @@ function print_statements() if ($email == 0) { - $rep = new FrontReport(_('STATEMENT'), "StatementBulk.pdf", user_pagesize()); + $rep = new FrontReport(_('STATEMENT'), "StatementBulk", user_pagesize()); $rep->currency = $cur; $rep->Font(); $rep->Info($params, $cols, null, $aligns); @@ -107,11 +115,11 @@ function print_statements() $doctype = 12; if ($rep->currency != $myrow['curr_code']) { - include($path_to_root . "reporting/includes/doctext2.inc"); + include($path_to_root . "/reporting/includes/doctext2.inc"); } else { - include($path_to_root . "reporting/includes/doctext.inc"); + include($path_to_root . "/reporting/includes/doctext.inc"); } $rep->fontSize += 2; $rep->TextCol(0, 8, $doc_Outstanding); @@ -136,7 +144,7 @@ function print_statements() $rep->TextCol(7, 8, $DisplayNet, -2); $rep->NewLine(); if ($rep->row < $rep->bottomMargin + (10 * $rep->lineHeight)) - $rep->Header2($myrow, null, null, $baccount); + $rep->Header2($myrow, null, null, $baccount, 12); } $nowdue = "1-" . $PastDueDays1 . " " . $doc_Days; $pastdue1 = $PastDueDays1 + 1 . "-" . $PastDueDays2 . " " . $doc_Days; diff --git a/reporting/rep109.php b/reporting/rep109.php index da7643bc..c5faf769 100644 --- a/reporting/rep109.php +++ b/reporting/rep109.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,16 +16,15 @@ $page_security = 2; // date_: 2005-05-19 // Title: Print Sales Orders // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "sales/includes/sales_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/sales/includes/sales_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_sales_orders(); $print_as_quote = 0; @@ -25,7 +33,7 @@ function print_sales_orders() { global $path_to_root, $print_as_quote; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; @@ -54,10 +62,10 @@ function print_sales_orders() if ($email == 0) { - if ($print_as_quote == 1) - $rep = new FrontReport(_("QUOTE"), "QuoteBulk.pdf", user_pagesize()); + if ($print_as_quote == 0) + $rep = new FrontReport(_("SALES ORDER"), "SalesOrderBulk", user_pagesize()); else - $rep = new FrontReport(_("SALES ORDER"), "SalesOrderBulk.pdf", user_pagesize()); + $rep = new FrontReport(_("QUOTE"), "QuoteBulk", user_pagesize()); $rep->currency = $cur; $rep->Font(); $rep->Info($params, $cols, null, $aligns); @@ -103,15 +111,19 @@ function print_sales_orders() else $DisplayDiscount = number_format2($myrow2["discount_percent"]*100,user_percent_dec()) . "%"; $rep->TextCol(0, 1, $myrow2['stk_code'], -2); - $rep->TextCol(1, 2, $myrow2['description'], -2); + $oldrow = $rep->row; + $rep->TextColLines(1, 2, $myrow2['description'], -2); + $newrow = $rep->row; + $rep->row = $oldrow; $rep->TextCol(2, 3, $DisplayQty, -2); $rep->TextCol(3, 4, $myrow2['units'], -2); $rep->TextCol(4, 5, $DisplayPrice, -2); $rep->TextCol(5, 6, $DisplayDiscount, -2); $rep->TextCol(6, 7, $DisplayNet, -2); - $rep->NewLine(1); + $rep->row = $newrow; + //$rep->NewLine(1); if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight)) - $rep->Header2($myrow, $branch, $sales_order, $baccount); + $rep->Header2($myrow, $branch, $myrow, $baccount, 9); } if ($myrow['comments'] != "") { @@ -126,11 +138,11 @@ function print_sales_orders() $doctype = 9; if ($rep->currency != $myrow['curr_code']) { - include($path_to_root . "reporting/includes/doctext2.inc"); + include($path_to_root . "/reporting/includes/doctext2.inc"); } else { - include($path_to_root . "reporting/includes/doctext.inc"); + include($path_to_root . "/reporting/includes/doctext.inc"); } $rep->TextCol(3, 6, $doc_Sub_total, -2); diff --git a/reporting/rep110.php b/reporting/rep110.php index 3ec50038..b7aeb500 100644 --- a/reporting/rep110.php +++ b/reporting/rep110.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -8,16 +17,15 @@ $page_security = 2; // Title: Print Delivery Notes // draft version! // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "sales/includes/sales_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/sales/includes/sales_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_deliveries(); //---------------------------------------------------------------------------------------------------- @@ -26,7 +34,7 @@ function print_deliveries() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; @@ -53,7 +61,7 @@ function print_deliveries() if ($email == 0) { - $rep = new FrontReport(_('DELIVERY'), "DeliveryNoteBulk.pdf", user_pagesize()); + $rep = new FrontReport(_('DELIVERY'), "DeliveryNoteBulk", user_pagesize()); $rep->currency = $cur; $rep->Font(); $rep->Info($params, $cols, null, $aligns); @@ -94,13 +102,17 @@ function print_deliveries() else $DisplayDiscount = number_format2($myrow2["discount_percent"]*100,user_percent_dec()) . "%"; $rep->TextCol(0, 1, $myrow2['stock_id'], -2); - $rep->TextCol(1, 2, $myrow2['StockDescription'], -2); + $oldrow = $rep->row; + $rep->TextColLines(1, 2, $myrow2['StockDescription'], -2); + $newrow = $rep->row; + $rep->row = $oldrow; $rep->TextCol(2, 3, $DisplayQty, -2); $rep->TextCol(3, 4, $myrow2['units'], -2); $rep->TextCol(4, 5, $DisplayPrice, -2); $rep->TextCol(5, 6, $DisplayDiscount, -2); $rep->TextCol(6, 7, $DisplayNet, -2); - $rep->NewLine(1); + $rep->row = $newrow; + //$rep->NewLine(1); if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight)) $rep->Header2($myrow, $branch, $sales_order,'',13); } @@ -121,11 +133,11 @@ function print_deliveries() $doctype=13; if ($rep->currency != $myrow['curr_code']) { - include($path_to_root . "reporting/includes/doctext2.inc"); + include($path_to_root . "/reporting/includes/doctext2.inc"); } else { - include($path_to_root . "reporting/includes/doctext.inc"); + include($path_to_root . "/reporting/includes/doctext.inc"); } $rep->TextCol(3, 6, $doc_Sub_total, -2); @@ -134,7 +146,7 @@ function print_deliveries() $rep->TextCol(3, 6, $doc_Shipping, -2); $rep->TextCol(6, 7, $DisplayFreight, -2); $rep->NewLine(); - $tax_items = get_customer_trans_tax_details(13, $i); + $tax_items = get_trans_tax_details(13, $i); while ($tax_item = db_fetch($tax_items)) { $DisplayTax = number_format2($tax_item['amount'], $dec); diff --git a/reporting/rep201.php b/reporting/rep201.php index 6ba1b3c0..380af70d 100644 --- a/reporting/rep201.php +++ b/reporting/rep201.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,16 +16,15 @@ $page_security = 2; // date_: 2005-05-19 // Title: Supplier Balances // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_supplier_balances(); function getTransactions($supplier_id, $date) @@ -44,12 +52,15 @@ function print_supplier_balances() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - $to = $_POST['PARAM_0']; $fromsupp = $_POST['PARAM_1']; $currency = $_POST['PARAM_2']; $comments = $_POST['PARAM_3']; + $destination = $_POST['PARAM_4']; + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); if ($fromsupp == reserved_words::get_all_numeric()) $from = _('All'); @@ -77,7 +88,7 @@ function print_supplier_balances() 2 => array('text' => _('Supplier'), 'from' => $from, 'to' => ''), 3 => array( 'text' => _('Currency'),'from' => $currency, 'to' => '')); - $rep = new FrontReport(_('Supplier Balances'), "SupplierBalances.pdf", user_pagesize()); + $rep = new FrontReport(_('Supplier Balances'), "SupplierBalances", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); @@ -112,28 +123,26 @@ function print_supplier_balances() $rep->NewLine(1, 2); $rep->TextCol(0, 1, $trans['type_name']); $rep->TextCol(1, 2, $trans['reference']); - $date = sql2date($trans['tran_date']); - $rep->TextCol(2, 3, $date); + $rep->DateCol(2, 3, $trans['tran_date'], true); if ($trans['type'] == 20) - $rep->TextCol(3, 4, sql2date($trans['due_date'])); + $rep->DateCol(3, 4, $trans['due_date'], true); $item[0] = $item[1] = 0.0; if ($convert) - //$rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $date); $rate = $trans['rate']; else $rate = 1.0; if ($trans['TotalAmount'] > 0.0) { $item[0] = round2(abs($trans['TotalAmount']) * $rate, $dec); - $rep->TextCol(4, 5, number_format2($item[0], $dec)); + $rep->AmountCol(4, 5, $item[0], $dec); } else { $item[1] = round2(abs($trans['TotalAmount']) * $rate, $dec); - $rep->TextCol(5, 6, number_format2($item[1], $dec)); + $rep->AmountCol(5, 6, $item[1], $dec); } $item[2] = round2($trans['Allocated'] * $rate, $dec); - $rep->TextCol(6, 7, number_format2($item[2], $dec)); + $rep->AmountCol(6, 7, $item[2], $dec); /* if ($trans['type'] == 20) $item[3] = ($trans['TotalAmount'] - $trans['Allocated']) * $rate; @@ -144,7 +153,7 @@ function print_supplier_balances() $item[3] = $item[0] + $item[1] - $item[2]; else $item[3] = $item[0] - $item[1] + $item[2]; - $rep->TextCol(7, 8, number_format2($item[3], $dec)); + $rep->AmountCol(7, 8, $item[3], $dec); for ($i = 0; $i < 4; $i++) { $total[$i] += $item[$i]; @@ -156,7 +165,7 @@ function print_supplier_balances() $rep->TextCol(0, 3, _('Total')); for ($i = 0; $i < 4; $i++) { - $rep->TextCol($i + 4, $i + 5, number_format2($total[$i], $dec)); + $rep->AmountCol($i + 4, $i + 5, $total[$i], $dec); $total[$i] = 0.0; } $rep->Line($rep->row - 4); @@ -166,8 +175,9 @@ function print_supplier_balances() $rep->TextCol(0, 3, _('Grand Total')); $rep->fontSize -= 2; for ($i = 0; $i < 4; $i++) - $rep->TextCol($i + 4, $i + 5,number_format2($grandtotal[$i], $dec)); + $rep->AmountCol($i + 4, $i + 5,$grandtotal[$i], $dec); $rep->Line($rep->row - 4); + $rep->NewLine(); $rep->End(); } diff --git a/reporting/rep202.php b/reporting/rep202.php index ad720ecc..fbb803db 100644 --- a/reporting/rep202.php +++ b/reporting/rep202.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,16 +16,15 @@ $page_security = 2; // date_: 2005-05-19 // Title: Ages Supplier Analysis // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_aged_supplier_analysis(); //---------------------------------------------------------------------------------------------------- @@ -61,17 +69,20 @@ function print_aged_supplier_analysis() { global $comp_path, $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - $to = $_POST['PARAM_0']; $fromsupp = $_POST['PARAM_1']; $currency = $_POST['PARAM_2']; $summaryOnly = $_POST['PARAM_3']; $graphics = $_POST['PARAM_4']; $comments = $_POST['PARAM_5']; + $destination = $_POST['PARAM_6']; + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); if ($graphics) { - include_once($path_to_root . "reporting/includes/class.graphic.inc"); + include_once($path_to_root . "/reporting/includes/class.graphic.inc"); $pg = new graph(); } @@ -113,7 +124,7 @@ function print_aged_supplier_analysis() if ($convert) $headers[2] = _('currency'); - $rep = new FrontReport(_('Aged Supplier Analysis'), "AgedSupplierAnalysis.pdf", user_pagesize()); + $rep = new FrontReport(_('Aged Supplier Analysis'), "AgedSupplierAnalysis", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); @@ -139,11 +150,11 @@ function print_aged_supplier_analysis() if (!$convert && $currency != $myrow['curr_code']) continue; $rep->fontSize += 2; - $rep->TextCol(0, 3, $myrow['name']); + $rep->TextCol(0, 2, $myrow['name']); if ($convert) { $rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $to); - $rep->TextCol(2, 4, $myrow['curr_code']); + $rep->TextCol(2, 3, $myrow['curr_code']); } else $rate = 1.0; @@ -156,13 +167,13 @@ function print_aged_supplier_analysis() $total[2] += ($supprec["Overdue1"]-$supprec["Overdue2"]); $total[3] += $supprec["Overdue2"]; $total[4] += $supprec["Balance"]; - $str = array(number_format2(($supprec["Balance"] - $supprec["Due"]),$dec), - number_format2(($supprec["Due"]-$supprec["Overdue1"]),$dec), - number_format2(($supprec["Overdue1"]-$supprec["Overdue2"]) ,$dec), - number_format2($supprec["Overdue2"],$dec), - number_format2($supprec["Balance"],$dec)); + $str = array($supprec["Balance"] - $supprec["Due"], + $supprec["Due"]-$supprec["Overdue1"], + $supprec["Overdue1"]-$supprec["Overdue2"], + $supprec["Overdue2"], + $supprec["Balance"]); for ($i = 0; $i < count($str); $i++) - $rep->TextCol($i + 3, $i + 4, $str[$i]); + $rep->AmountCol($i + 3, $i + 4, $str[$i], $dec); $rep->NewLine(1, 2); if (!$summaryOnly) { @@ -178,13 +189,13 @@ function print_aged_supplier_analysis() $rep->TextCol(2, 3, sql2date($trans['tran_date']), -2); foreach ($trans as $i => $value) $trans[$i] *= $rate; - $str = array(number_format2(($trans["Balance"] - $trans["Due"]),$dec), - number_format2(($trans["Due"]-$trans["Overdue1"]),$dec), - number_format2(($trans["Overdue1"]-$trans["Overdue2"]) ,$dec), - number_format2($trans["Overdue2"],$dec), - number_format2($trans["Balance"],$dec)); + $str = array($trans["Balance"] - $trans["Due"], + $trans["Due"]-$trans["Overdue1"], + $trans["Overdue1"]-$trans["Overdue2"], + $trans["Overdue2"], + $trans["Balance"]); for ($i = 0; $i < count($str); $i++) - $rep->TextCol($i + 3, $i + 4, $str[$i]); + $rep->AmountCol($i + 3, $i + 4, $str[$i], $dec); } $rep->Line($rep->row - 8); $rep->NewLine(2); @@ -200,13 +211,14 @@ function print_aged_supplier_analysis() $rep->fontSize -= 2; for ($i = 0; $i < count($total); $i++) { - $rep->TextCol($i + 3, $i + 4, number_format2($total[$i], $dec)); + $rep->AmountCol($i + 3, $i + 4, $total[$i], $dec); if ($graphics && $i < count($total) - 1) { $pg->y[$i] = abs($total[$i]); } } $rep->Line($rep->row - 8); + $rep->NewLine(); if ($graphics) { global $decseps, $graph_skin; @@ -218,7 +230,7 @@ function print_aged_supplier_analysis() $pg->type = $graphics; $pg->skin = $graph_skin; $pg->built_in = false; - $pg->fontfile = $path_to_root . "reporting/fonts/Vera.ttf"; + $pg->fontfile = $path_to_root . "/reporting/fonts/Vera.ttf"; $pg->latin_notation = ($decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != "."); $filename = $comp_path.'/'.user_company(). "/pdf_files/test.png"; $pg->display($filename, true); diff --git a/reporting/rep203.php b/reporting/rep203.php index d69bf519..c276188f 100644 --- a/reporting/rep203.php +++ b/reporting/rep203.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,16 +16,15 @@ $page_security = 2; // date_: 2005-05-19 // Title: Payment Report // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_payment_report(); function getTransactions($supplier, $date) @@ -50,12 +58,15 @@ function print_payment_report() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - $to = $_POST['PARAM_0']; $fromsupp = $_POST['PARAM_1']; $currency = $_POST['PARAM_2']; $comments = $_POST['PARAM_3']; + $destination = $_POST['PARAM_4']; + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); if ($fromsupp == reserved_words::get_all_numeric()) $from = _('All'); @@ -84,7 +95,7 @@ function print_payment_report() 2 => array('text' => _('Supplier'), 'from' => $from, 'to' => ''), 3 => array( 'text' => _('Currency'),'from' => $currency, 'to' => '')); - $rep = new FrontReport(_('Payment Report'), "PaymentReport.pdf", user_pagesize()); + $rep = new FrontReport(_('Payment Report'), "PaymentReport", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); @@ -126,18 +137,18 @@ function print_payment_report() $rep->TextCol(0, 1, $trans['type_name']); $rep->TextCol(1, 2, $trans['supp_reference']); if ($trans['type'] == 20) - $rep->TextCol(2, 3, sql2date($trans['due_date'])); + $rep->DateCol(2, 3, $trans['due_date'], true); else - $rep->TextCol(2, 3, sql2date($trans['tran_date'])); + $rep->DateCol(2, 3, $trans['tran_date'], true); if ($trans['type'] != 20) { $trans['TranTotal'] = -$trans['TranTotal']; $trans['Balance'] = -$trans['Balance']; } $item[0] = $trans['TranTotal'] * $rate; - $rep->TextCol(6, 7, number_format2($item[0], $dec)); + $rep->AmountCol(6, 7, $item[0], $dec); $item[1] = $trans['Balance'] * $rate; - $rep->TextCol(7, 8, number_format2($item[1], $dec)); + $rep->AmountCol(7, 8, $item[1], $dec); for ($i = 0; $i < 2; $i++) { $total[$i] += $item[$i]; @@ -149,7 +160,7 @@ function print_payment_report() $rep->TextCol(0, 3, _('Total')); for ($i = 0; $i < 2; $i++) { - $rep->TextCol($i + 6, $i + 7, number_format2($total[$i], $dec)); + $rep->AmountCol($i + 6, $i + 7, $total[$i], $dec); $total[$i] = 0.0; } $rep->Line($rep->row - 4); @@ -159,8 +170,9 @@ function print_payment_report() $rep->TextCol(0, 3, _('Grand Total')); $rep->fontSize -= 2; for ($i = 0; $i < 2; $i++) - $rep->TextCol($i + 6, $i + 7,number_format2($grandtotal[$i], $dec)); + $rep->AmountCol($i + 6, $i + 7,$grandtotal[$i], $dec); $rep->Line($rep->row - 4); + $rep->NewLine(); $rep->End(); } diff --git a/reporting/rep204.php b/reporting/rep204.php index e3d3dc5a..c0efd034 100644 --- a/reporting/rep204.php +++ b/reporting/rep204.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,16 +16,15 @@ $page_security = 2; // date_: 2005-05-19 // Title: Outstanding GRNs Report // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_outstanding_GRN(); function getTransactions($fromsupp) @@ -54,10 +62,13 @@ function print_outstanding_GRN() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - $fromsupp = $_POST['PARAM_0']; $comments = $_POST['PARAM_1']; + $destination = $_POST['PARAM_2']; + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); if ($fromsupp == reserved_words::get_all_numeric()) $from = _('All'); @@ -75,7 +86,7 @@ function print_outstanding_GRN() $params = array( 0 => $comments, 1 => array('text' => _('Supplier'), 'from' => $from, 'to' => '')); - $rep = new FrontReport(_('Outstanding GRNs Report'), "OutstandingGRN.pdf", user_pagesize()); + $rep = new FrontReport(_('Outstanding GRNs Report'), "OutstandingGRN", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); @@ -95,7 +106,7 @@ function print_outstanding_GRN() { $rep->NewLine(2); $rep->TextCol(0, 7, _('Total')); - $rep->TextCol(7, 8, number_format2($SuppTot_Val, $dec)); + $rep->AmountCol(7, 8, $SuppTot_Val, $dec); $rep->Line($rep->row - 2); $rep->NewLine(3); $SuppTot_Val = 0; @@ -107,13 +118,13 @@ function print_outstanding_GRN() $rep->TextCol(0, 1, $GRNs['id']); $rep->TextCol(1, 2, $GRNs['order_no']); $rep->TextCol(2, 3, $GRNs['item_code'] . '-' . $GRNs['description']); - $rep->TextCol(3, 4, number_format2($GRNs['qty_recd'], $dec2)); - $rep->TextCol(4, 5, number_format2($GRNs['quantity_inv'], $dec2)); + $rep->AmountCol(3, 4, $GRNs['qty_recd'], $dec2); + $rep->AmountCol(4, 5, $GRNs['quantity_inv'], $dec2); $QtyOstg = $GRNs['qty_recd'] - $GRNs['quantity_inv']; $Value = ($GRNs['qty_recd'] - $GRNs['quantity_inv']) * $GRNs['std_cost_unit']; - $rep->TextCol(5, 6, number_format2($QtyOstg, $dec2)); - $rep->TextCol(6, 7, number_format2($GRNs['std_cost_unit'], $dec)); - $rep->TextCol(7, 8, number_format2($Value, $dec)); + $rep->AmountCol(5, 6, $QtyOstg, $dec2); + $rep->AmountCol(6, 7, $GRNs['std_cost_unit'], $dec); + $rep->AmountCol(7, 8, $Value, $dec); $Tot_Val += $Value; $SuppTot_Val += $Value; @@ -123,15 +134,16 @@ function print_outstanding_GRN() { $rep->NewLine(); $rep->TextCol(0, 7, _('Total')); - $rep->TextCol(7, 8, number_format2($SuppTot_Val, $dec)); + $rep->AmountCol(7, 8, $SuppTot_Val, $dec); $rep->Line($rep->row - 2); $rep->NewLine(3); $SuppTot_Val = 0; } $rep->NewLine(2); $rep->TextCol(0, 7, _('Grand Total')); - $rep->TextCol(7, 8, number_format2($Tot_Val, $dec)); + $rep->AmountCol(7, 8, $Tot_Val, $dec); $rep->Line($rep->row - 2); + $rep->NewLine(); $rep->End(); } diff --git a/reporting/rep209.php b/reporting/rep209.php index 47ed4258..f8847fd7 100644 --- a/reporting/rep209.php +++ b/reporting/rep209.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,22 +16,20 @@ $page_security = 2; // date_: 2005-05-19 // Title: Purchase Orders // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -//include_once($path_to_root . "sales/includes/sales_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_po(); //---------------------------------------------------------------------------------------------------- function get_po($order_no) { - $sql = "SELECT ".TB_PREF."purch_orders.*, ".TB_PREF."suppliers.supp_name, + $sql = "SELECT ".TB_PREF."purch_orders.*, ".TB_PREF."suppliers.supp_name, ".TB_PREF."suppliers.supp_account_no, ".TB_PREF."suppliers.curr_code, ".TB_PREF."suppliers.payment_terms, ".TB_PREF."locations.location_name, ".TB_PREF."suppliers.email, ".TB_PREF."suppliers.address FROM ".TB_PREF."purch_orders, ".TB_PREF."suppliers, ".TB_PREF."locations @@ -48,7 +55,7 @@ function print_po() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; @@ -76,7 +83,7 @@ function print_po() if ($email == 0) { - $rep = new FrontReport(_('PURCHASE ORDER'), "PurchaseOrderBulk.pdf", user_pagesize()); + $rep = new FrontReport(_('PURCHASE ORDER'), "PurchaseOrderBulk", user_pagesize()); $rep->currency = $cur; $rep->Font(); $rep->Info($params, $cols, null, $aligns); @@ -103,6 +110,19 @@ function print_po() $SubTotal = 0; while ($myrow2=db_fetch($result)) { + $data = get_purchase_data($myrow['supplier_id'], $myrow2['item_code']); + if ($data !== false) + { + if ($data['supplier_description'] != "") + $myrow2['description'] = $data['supplier_description']; + if ($data['suppliers_uom'] != "") + $myrow2['units'] = $data['suppliers_uom']; + if ($data['conversion_factor'] != 1) + { + $myrow2['unit_price'] = round($myrow2['unit_price'] / $data['conversion_factor'], user_price_dec()); + $myrow2['quantiry_ordered'] = round($myrow2['quantiry_ordered'] / $data['conversion_factor'], user_qty_dec()); + } + } $Net = round2(($myrow2["unit_price"] * $myrow2["quantity_ordered"]), user_price_dec()); $SubTotal += $Net; @@ -118,7 +138,7 @@ function print_po() $rep->TextCol(6, 7, $DisplayNet, -2); $rep->NewLine(1); if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight)) - $rep->Header2($myrow, $branch, $sales_order, $baccount); + $rep->Header2($myrow, $branch, $myrow, $baccount, 8); } if ($myrow['comments'] != "") { @@ -132,11 +152,11 @@ function print_po() $doctype = 8; if ($rep->currency != $myrow['curr_code']) { - include($path_to_root . "reporting/includes/doctext2.inc"); + include($path_to_root . "/reporting/includes/doctext2.inc"); } else { - include($path_to_root . "reporting/includes/doctext.inc"); + include($path_to_root . "/reporting/includes/doctext.inc"); } $rep->TextCol(3, 6, $doc_Sub_total, -2); diff --git a/reporting/rep301.php b/reporting/rep301.php index a2801336..2b18d24b 100644 --- a/reporting/rep301.php +++ b/reporting/rep301.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,17 +16,16 @@ $page_security = 2; // date_: 2005-05-19 // Title: Supplier Balances // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); -include_once($path_to_root . "inventory/includes/db/items_category_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); +include_once($path_to_root . "/inventory/includes/db/items_category_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_inventory_valuation_report(); function getTransactions($category, $location) @@ -59,12 +67,15 @@ function print_inventory_valuation_report() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - $category = $_POST['PARAM_0']; $location = $_POST['PARAM_1']; $detail = $_POST['PARAM_2']; $comments = $_POST['PARAM_3']; + $destination = $_POST['PARAM_4']; + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); $dec = user_price_dec(); @@ -92,7 +103,7 @@ function print_inventory_valuation_report() 1 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 2 => array('text' => _('Location'), 'from' => $loc, 'to' => '')); - $rep = new FrontReport(_('Inventory Valuation Report'), "InventoryValReport.pdf", user_pagesize()); + $rep = new FrontReport(_('Inventory Valuation Report'), "InventoryValReport", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); @@ -112,7 +123,7 @@ function print_inventory_valuation_report() $rep->NewLine(2, 3); $rep->TextCol(0, 4, _('Total')); } - $rep->Textcol(4, 5, number_format2($total, $dec)); + $rep->AmountCol(4, 5, $total, $dec); if ($detail) { $rep->Line($rep->row - 2); @@ -133,9 +144,9 @@ function print_inventory_valuation_report() $rep->fontsize -= 2; $rep->TextCol(0, 1, $trans['stock_id']); $rep->TextCol(1, 2, $trans['description']); - $rep->TextCol(2, 3, number_format2($trans['QtyOnHand'], get_qty_dec($trans['stock_id']))); - $rep->TextCol(3, 4, number_format2($trans['UnitCost'], $dec)); - $rep->TextCol(4, 5, number_format2($trans['ItemTotal'], $dec)); + $rep->AmountCol(2, 3, $trans['QtyOnHand'], get_qty_dec($trans['stock_id'])); + $rep->AmountCol(3, 4, $trans['UnitCost'], $dec); + $rep->AmountCol(4, 5, $trans['ItemTotal'], $dec); $rep->fontsize += 2; } $total += $trans['ItemTotal']; @@ -146,7 +157,7 @@ function print_inventory_valuation_report() $rep->NewLine(2, 3); $rep->TextCol(0, 4, _('Total')); } - $rep->Textcol(4, 5, number_format2($total, $dec)); + $rep->Amountcol(4, 5, $total, $dec); if ($detail) { $rep->Line($rep->row - 2); @@ -154,8 +165,9 @@ function print_inventory_valuation_report() } $rep->NewLine(2, 1); $rep->TextCol(0, 4, _('Grand Total')); - $rep->TextCol(4, 5, number_format2($grandtotal, $dec)); + $rep->AmountCol(4, 5, $grandtotal, $dec); $rep->Line($rep->row - 4); + $rep->NewLine(); $rep->End(); } diff --git a/reporting/rep302.php b/reporting/rep302.php index 68758cd4..fc600e96 100644 --- a/reporting/rep302.php +++ b/reporting/rep302.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,17 +16,16 @@ $page_security = 2; // date_: 2005-05-19 // Title: Inventory Planning // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); -include_once($path_to_root . "inventory/includes/db/items_category_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); +include_once($path_to_root . "/inventory/includes/db/items_category_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_inventory_planning(); function getTransactions($category, $location) @@ -138,11 +146,14 @@ function print_inventory_planning() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - $category = $_POST['PARAM_0']; $location = $_POST['PARAM_1']; $comments = $_POST['PARAM_2']; + $destination = $_POST['PARAM_3']; + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); if ($category == reserved_words::get_all_numeric()) $category = 0; @@ -176,7 +187,7 @@ function print_inventory_planning() 1 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 2 => array('text' => _('Location'), 'from' => $loc, 'to' => '')); - $rep = new FrontReport(_('Inventory Planning Report'), "InventoryPlanning.pdf", user_pagesize()); + $rep = new FrontReport(_('Inventory Planning Report'), "InventoryPlanning", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); @@ -210,26 +221,27 @@ function print_inventory_planning() $dec = get_qty_dec($trans['stock_id']); $rep->TextCol(0, 1, $trans['stock_id']); $rep->TextCol(1, 2, $trans['description']); - $rep->TextCol(2, 3, number_format2($period['prd0'], $dec)); - $rep->TextCol(3, 4, number_format2($period['prd1'], $dec)); - $rep->TextCol(4, 5, number_format2($period['prd2'], $dec)); - $rep->TextCol(5, 6, number_format2($period['prd3'], $dec)); - $rep->TextCol(6, 7, number_format2($period['prd4'], $dec)); + $rep->AmountCol(2, 3, $period['prd0'], $dec); + $rep->AmountCol(3, 4, $period['prd1'], $dec); + $rep->AmountCol(4, 5, $period['prd2'], $dec); + $rep->AmountCol(5, 6, $period['prd3'], $dec); + $rep->AmountCol(6, 7, $period['prd4'], $dec); $MaxMthSales = Max($period['prd0'], $period['prd1'], $period['prd2'], $period['prd3']); $IdealStockHolding = $MaxMthSales * 3; - $rep->TextCol(7, 8, number_format2($IdealStockHolding, $dec)); + $rep->AmountCol(7, 8, $IdealStockHolding, $dec); - $rep->TextCol(8, 9, number_format2($trans['qty_on_hand'], $dec)); - $rep->TextCol(9, 10, number_format2($custqty, $dec)); - $rep->TextCol(10, 11, number_format2($suppqty, $dec)); + $rep->AmountCol(8, 9, $trans['qty_on_hand'], $dec); + $rep->AmountCol(9, 10, $custqty, $dec); + $rep->AmountCol(10, 11, $suppqty, $dec); $SuggestedTopUpOrder = $IdealStockHolding - $trans['qty_on_hand'] + $custqty - $suppqty; if ($SuggestedTopUpOrder < 0.0) $SuggestedTopUpOrder = 0.0; - $rep->TextCol(11, 12, number_format2($SuggestedTopUpOrder, $dec)); + $rep->AmountCol(11, 12, $SuggestedTopUpOrder, $dec); } $rep->Line($rep->row - 4); + $rep->NewLine(); $rep->End(); } diff --git a/reporting/rep303.php b/reporting/rep303.php index bc04f769..b46e1d81 100644 --- a/reporting/rep303.php +++ b/reporting/rep303.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,17 +16,16 @@ $page_security = 2; // date_: 2005-05-19 // Title: Stock Check // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); -include_once($path_to_root . "inventory/includes/db/items_category_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); +include_once($path_to_root . "/inventory/includes/db/items_category_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_stock_check(); function getTransactions($category, $location) @@ -98,13 +106,16 @@ function print_stock_check() { global $comp_path, $path_to_root, $pic_height, $pic_width; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - $category = $_POST['PARAM_0']; $location = $_POST['PARAM_1']; $pictures = $_POST['PARAM_2']; $check = $_POST['PARAM_3']; $comments = $_POST['PARAM_4']; + $destination = $_POST['PARAM_5']; + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); if ($category == reserved_words::get_all_numeric()) $category = 0; @@ -143,7 +154,7 @@ function print_stock_check() else $user_comp = ""; - $rep = new FrontReport(_('Stock Check Sheets'), "StockCheckSheet.pdf", user_pagesize()); + $rep = new FrontReport(_('Stock Check Sheets'), "StockCheckSheet", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); @@ -175,17 +186,17 @@ function print_stock_check() $dec = get_qty_dec($trans['stock_id']); $rep->TextCol(0, 1, $trans['stock_id']); $rep->TextCol(1, 2, $trans['description']); - $rep->TextCol(2, 3, number_format2($trans['QtyOnHand'], $dec)); + $rep->AmountCol(2, 3, $trans['QtyOnHand'], $dec); if ($check) { $rep->TextCol(3, 4, "_________"); - $rep->TextCol(4, 5, number_format2($demandqty, $dec)); - $rep->TextCol(5, 6, number_format2($trans['QtyOnHand'] - $demandqty, $dec)); + $rep->AmountCol(4, 5, $demandqty, $dec); + $rep->AmountCol(5, 6, $trans['QtyOnHand'] - $demandqty, $dec); } else { - $rep->TextCol(3, 4, number_format2($demandqty, $dec)); - $rep->TextCol(4, 5, number_format2($trans['QtyOnHand'] - $demandqty, $dec)); + $rep->AmountCol(3, 4, $demandqty, $dec); + $rep->AmountCol(4, 5, $trans['QtyOnHand'] - $demandqty, $dec); } if ($pictures) { @@ -202,6 +213,7 @@ function print_stock_check() } } $rep->Line($rep->row - 4); + $rep->NewLine(); $rep->End(); } diff --git a/reporting/rep304.php b/reporting/rep304.php index a53a9215..8929b1e6 100644 --- a/reporting/rep304.php +++ b/reporting/rep304.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,57 +16,23 @@ $page_security = 2; // date_: 2005-05-19 // Title: Inventory Planning // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "includes/banking.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); -include_once($path_to_root . "inventory/includes/db/items_category_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/includes/banking.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); +include_once($path_to_root . "/inventory/includes/db/items_category_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_inventory_sales(); function getTransactions($category, $location, $from, $to) { $from = date2sql($from); $to = date2sql($to); -/* - $sql = "SELECT ".TB_PREF."stock_master.category_id, - ".TB_PREF."stock_category.description AS cat_description, - ".TB_PREF."stock_master.stock_id, - ".TB_PREF."stock_master.description, - ".TB_PREF."stock_moves.loc_code, - SUM(-".TB_PREF."stock_moves.qty*".TB_PREF."stock_moves.price*(1-".TB_PREF."stock_moves.discount_percent)) AS amt, - SUM(-".TB_PREF."stock_moves.qty) *(".TB_PREF."stock_master.material_cost + ".TB_PREF."stock_master.labour_cost + ".TB_PREF."stock_master.overhead_cost) AS cost - FROM ".TB_PREF."stock_master, - ".TB_PREF."stock_category, - ".TB_PREF."debtor_trans, - ".TB_PREF."stock_moves - WHERE ".TB_PREF."stock_master.stock_id=".TB_PREF."stock_moves.stock_id - AND ".TB_PREF."stock_master.category_id=".TB_PREF."stock_category.category_id - - AND ".TB_PREF."stock_moves.type=".TB_PREF."debtor_trans.type - AND ".TB_PREF."stock_moves.trans_no=".TB_PREF."debtor_trans.trans_no - AND ".TB_PREF."stock_moves.tran_date>='$from' - AND ".TB_PREF."stock_moves.tran_date<='$to' - AND ((".TB_PREF."debtor_trans.type=13 AND ".TB_PREF."debtor_trans.version=1) OR ".TB_PREF."stock_moves.type=11) - AND (".TB_PREF."stock_master.mb_flag='B' OR ".TB_PREF."stock_master.mb_flag='M')"; - if ($category != 0) - $sql .= " AND ".TB_PREF."stock_master.category_id = '$category'"; - if ($location != 'all') - $sql .= " AND ".TB_PREF."stock_moves.loc_code = '$location'"; - //$sql .= " AND SUM(".TB_PREF."stock_moves.qty) != 0 - $sql .= " GROUP BY ".TB_PREF."stock_master.category_id, - ".TB_PREF."stock_category.description, - ".TB_PREF."stock_master.stock_id, - ".TB_PREF."stock_master.description - ORDER BY ".TB_PREF."stock_master.category_id, - ".TB_PREF."stock_master.stock_id"; -*/ $sql = "SELECT ".TB_PREF."stock_master.category_id, ".TB_PREF."stock_category.description AS cat_description, ".TB_PREF."stock_master.stock_id, @@ -97,14 +72,17 @@ function print_inventory_sales() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; $category = $_POST['PARAM_2']; $location = $_POST['PARAM_3']; $detail = $_POST['PARAM_4']; $comments = $_POST['PARAM_5']; + $destination = $_POST['PARAM_6']; + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); $dec = user_price_dec(); @@ -133,7 +111,7 @@ function print_inventory_sales() 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 3 => array('text' => _('Location'), 'from' => $loc, 'to' => '')); - $rep = new FrontReport(_('Inventory Sales Report'), "InventorySalesReport.pdf", user_pagesize()); + $rep = new FrontReport(_('Inventory Sales Report'), "InventorySalesReport", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); @@ -156,9 +134,9 @@ function print_inventory_sales() $rep->NewLine(2, 3); $rep->TextCol(0, 2, _('Total')); } - $rep->TextCol(2, 3, number_format2($total, $dec)); - $rep->TextCol(3, 4, number_format2($total1, $dec)); - $rep->Textcol(4, 5, number_format2($total2, $dec)); + $rep->AmountCol(2, 3, $total, $dec); + $rep->AmountCol(3, 4, $total1, $dec); + $rep->AmountCol(4, 5, $total2, $dec); if ($detail) { $rep->Line($rep->row - 2); @@ -183,9 +161,9 @@ function print_inventory_sales() $rep->fontsize -= 2; $rep->TextCol(0, 1, $stock_id); $rep->TextCol(1, 2, $stock_desc); - $rep->TextCol(2, 3, number_format2($amt, $dec)); - $rep->TextCol(3, 4, number_format2($cost, $dec)); - $rep->TextCol(4, 5, number_format2($cb, $dec)); + $rep->AmountCol(2, 3, $amt, $dec); + $rep->AmountCol(3, 4, $cost, $dec); + $rep->AmountCol(4, 5, $cb, $dec); $rep->fontsize += 2; } $amt = $cost = $cb = 0; @@ -213,17 +191,17 @@ function print_inventory_sales() $rep->fontsize -= 2; $rep->TextCol(0, 1, $stock_id); $rep->TextCol(1, 2, $stock_desc); - $rep->TextCol(2, 3, number_format2($amt, $dec)); - $rep->TextCol(3, 4, number_format2($cost, $dec)); - $rep->TextCol(4, 5, number_format2($cb, $dec)); + $rep->AmountCol(2, 3, $amt, $dec); + $rep->AmountCol(3, 4, $cost, $dec); + $rep->AmountCol(4, 5, $cb, $dec); $rep->fontsize += 2; $rep->NewLine(2, 3); $rep->TextCol(0, 2, _('Total')); } - $rep->TextCol(2, 3, number_format2($total, $dec)); - $rep->TextCol(3, 4, number_format2($total1, $dec)); - $rep->Textcol(4, 5, number_format2($total2, $dec)); + $rep->AmountCol(2, 3, $total, $dec); + $rep->AmountCol(3, 4, $total1, $dec); + $rep->AmountCol(4, 5, $total2, $dec); if ($detail) { $rep->Line($rep->row - 2); @@ -231,11 +209,12 @@ function print_inventory_sales() } $rep->NewLine(2, 1); $rep->TextCol(0, 2, _('Grand Total')); - $rep->TextCol(2, 3, number_format2($grandtotal, $dec)); - $rep->TextCol(3, 4, number_format2($grandtotal1, $dec)); - $rep->Textcol(4, 5, number_format2($grandtotal2, $dec)); + $rep->AmountCol(2, 3, $grandtotal, $dec); + $rep->AmountCol(3, 4, $grandtotal1, $dec); + $rep->AmountCol(4, 5, $grandtotal2, $dec); $rep->Line($rep->row - 4); + $rep->NewLine(); $rep->End(); } diff --git a/reporting/rep401.php b/reporting/rep401.php index 096952c7..8ae240e3 100644 --- a/reporting/rep401.php +++ b/reporting/rep401.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,17 +16,16 @@ $page_security = 2; // date_: 2005-05-19 // Title: Bill Of Material // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); -include_once($path_to_root . "inventory/includes/db/items_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); +include_once($path_to_root . "/inventory/includes/db/items_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_bill_of_material(); function getTransactions($from, $to) @@ -47,11 +55,14 @@ function print_bill_of_material() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - $frompart = $_POST['PARAM_0']; $topart = $_POST['PARAM_1']; $comments = $_POST['PARAM_2']; + $destination = $_POST['PARAM_3']; + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); $cols = array(0, 50, 305, 375, 445, 515); @@ -62,7 +73,7 @@ function print_bill_of_material() $params = array( 0 => $comments, 1 => array('text' => _('Component'), 'from' => $frompart, 'to' => $topart)); - $rep = new FrontReport(_('Bill of Material Listing'), "BillOfMaterial.pdf", user_pagesize()); + $rep = new FrontReport(_('Bill of Material Listing'), "BillOfMaterial", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); @@ -95,9 +106,10 @@ function print_bill_of_material() $wc = get_work_centre($trans['workcentre_added']); $rep->TextCol(2, 3, get_location_name($trans['loc_code'])); $rep->TextCol(3, 4, $wc['name']); - $rep->TextCol(4, 5, number_format2($trans['quantity'], $dec)); + $rep->AmountCol(4, 5, $trans['quantity'], $dec); } $rep->Line($rep->row - 4); + $rep->NewLine(); $rep->End(); } diff --git a/reporting/rep501.php b/reporting/rep501.php index d0c270f4..b697925f 100644 --- a/reporting/rep501.php +++ b/reporting/rep501.php @@ -1,22 +1,30 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ // Creator: Joe Hunt // date_: 2005-05-19 -// Title: Bill Of Material +// Title: Dimension Summary // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_dimension_summary(); function getTransactions($from, $to) @@ -62,13 +70,15 @@ function print_dimension_summary() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - $fromdim = $_POST['PARAM_0']; $todim = $_POST['PARAM_1']; $showbal = $_POST['PARAM_2']; $comments = $_POST['PARAM_3']; - + $destination = $_POST['PARAM_4']; + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); $cols = array(0, 50, 210, 250, 320, 395, 465, 515); @@ -79,7 +89,7 @@ function print_dimension_summary() $params = array( 0 => $comments, 1 => array('text' => _('Dimension'), 'from' => $fromdim, 'to' => $todim)); - $rep = new FrontReport(_('Dimension Summary'), "DimensionSummary.pdf", user_pagesize()); + $rep = new FrontReport(_('Dimension Summary'), "DimensionSummary", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); @@ -91,8 +101,8 @@ function print_dimension_summary() $rep->TextCol(0, 1, $trans['reference']); $rep->TextCol(1, 2, $trans['name']); $rep->TextCol(2, 3, $trans['type_']); - $rep->TextCol(3, 4, $trans['date_']); - $rep->TextCol(4, 5, $trans['due_date']); + $rep->DateCol(3, 4, $trans['date_'], true); + $rep->DateCol(4, 5, $trans['due_date'], true); if ($trans['closed']) $str = _('Yes'); else @@ -101,7 +111,7 @@ function print_dimension_summary() if ($showbal) { $balance = getYTD($trans['id']); - $rep->TextCol(6, 7, number_format2($balance, 0)); + $rep->AmountCol(6, 7, $balance, 0); } $rep->NewLine(1, 2); } diff --git a/reporting/rep601.php b/reporting/rep601.php index 0408c3ac..66fbbf2a 100644 --- a/reporting/rep601.php +++ b/reporting/rep601.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,16 +16,15 @@ $page_security = 2; // date_: 2005-05-19 // Title: Bank Accounts Transactions // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_bank_transactions(); //---------------------------------------------------------------------------------------------------- @@ -35,11 +43,10 @@ function get_bank_transactions($from, $to, $account) { $from = date2sql($from); $to = date2sql($to); - $sql = "SELECT ".TB_PREF."bank_trans.*,name AS BankTransType FROM ".TB_PREF."bank_trans, ".TB_PREF."bank_trans_types + $sql = "SELECT ".TB_PREF."bank_trans.* FROM ".TB_PREF."bank_trans WHERE ".TB_PREF."bank_trans.bank_act = '$account' AND trans_date >= '$from' AND trans_date <= '$to' - AND ".TB_PREF."bank_trans_types.id = ".TB_PREF."bank_trans.bank_trans_type_id ORDER BY trans_date,".TB_PREF."bank_trans.id"; return db_query($sql,"The transactions for '$account' could not be retrieved"); @@ -49,22 +56,24 @@ function print_bank_transactions() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - - $rep = new FrontReport(_('Bank Statement'), "BankStatement.pdf", user_pagesize()); - $acc = $_POST['PARAM_0']; $from = $_POST['PARAM_1']; $to = $_POST['PARAM_2']; $comments = $_POST['PARAM_3']; + $destination = $_POST['PARAM_4']; + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); + $rep = new FrontReport(_('Bank Statement'), "BankStatement", user_pagesize()); $dec = user_price_dec(); - $cols = array(0, 90, 110, 170, 225, 270, 350, 400, 460, 520); + $cols = array(0, 90, 110, 170, 225, 350, 400, 460, 520); - $aligns = array('left', 'left', 'left', 'left', 'left', 'left', 'right', 'right', 'right'); + $aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right', 'right'); - $headers = array(_('Type'), _('#'), _('Reference'), _('Date'), _('Type'), _('Person/Item'), + $headers = array(_('Type'), _('#'), _('Reference'), _('Date'), _('Person/Item'), _('Debit'), _('Credit'), _('Balance')); $account = get_bank_account($acc); @@ -78,9 +87,9 @@ function print_bank_transactions() $rep->Header(); - $prev_balance = get_bank_balance_to($from, $account["account_code"]); + $prev_balance = get_bank_balance_to($from, $account["id"]); - $trans = get_bank_transactions($from, $to, $account['account_code']); + $trans = get_bank_transactions($from, $to, $account['id']); $rows = db_num_rows($trans); if ($prev_balance != 0.0 || $rows != 0) @@ -89,9 +98,9 @@ function print_bank_transactions() $rep->TextCol(0, 3, $act); $rep->TextCol(3, 5, _('Opening Balance')); if ($prev_balance > 0.0) - $rep->TextCol(6, 7, number_format2(abs($prev_balance), $dec)); + $rep->AmountCol(5, 6, abs($prev_balance), $dec); else - $rep->TextCol(7, 8, number_format2(abs($prev_balance), $dec)); + $rep->AmountCol(6, 7, abs($prev_balance), $dec); $rep->Font(); $total = $prev_balance; $rep->NewLine(2); @@ -104,14 +113,13 @@ function print_bank_transactions() $rep->TextCol(0, 1, systypes::name($myrow["type"])); $rep->TextCol(1, 2, $myrow['trans_no']); $rep->TextCol(2, 3, $myrow['ref']); - $rep->TextCol(3, 4, sql2date($myrow["trans_date"])); - $rep->TextCol(4, 5, $myrow['BankTransType']); - $rep->TextCol(5, 6, payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"], false)); + $rep->DateCol(3, 4, $myrow["trans_date"], true); + $rep->TextCol(4, 5, payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"], false)); if ($myrow['amount'] > 0.0) - $rep->TextCol(6, 7, number_format2(abs($myrow['amount']), $dec)); + $rep->AmountCol(5, 6, abs($myrow['amount']), $dec); else - $rep->TextCol(7, 8, number_format2(abs($myrow['amount']), $dec)); - $rep->TextCol(8, 9, number_format2($total, $dec)); + $rep->AmountCol(6, 7, abs($myrow['amount']), $dec); + $rep->AmountCol(7, 8, $total, $dec); $rep->NewLine(); if ($rep->row < $rep->bottomMargin + $rep->lineHeight) { @@ -124,9 +132,9 @@ function print_bank_transactions() $rep->Font('bold'); $rep->TextCol(3, 5, _("Ending Balance")); if ($total > 0.0) - $rep->TextCol(6, 7, number_format2(abs($total), $dec)); + $rep->AmountCol(5, 6, abs($total), $dec); else - $rep->TextCol(7, 8, number_format2(abs($total), $dec)); + $rep->AmountCol(6, 7, abs($total), $dec); $rep->Font(); $rep->Line($rep->row - $rep->lineHeight + 4); $rep->NewLine(2, 1); diff --git a/reporting/rep701.php b/reporting/rep701.php index f01628f8..63c90c39 100644 --- a/reporting/rep701.php +++ b/reporting/rep701.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,16 +16,15 @@ $page_security = 2; // date_: 2005-05-19 // Title: Chart of GL Accounts // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_Chart_of_Accounts(); //---------------------------------------------------------------------------------------------------- @@ -25,10 +33,14 @@ function print_Chart_of_Accounts() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - $showbalance = $_POST['PARAM_0']; $comments = $_POST['PARAM_1']; + $destination = $_POST['PARAM_2']; + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); + $dec = 0; $cols = array(0, 50, 300, 425, 500); @@ -39,7 +51,7 @@ function print_Chart_of_Accounts() $params = array(0 => $comments); - $rep = new FrontReport(_('Chart of Accounts'), "ChartOfAccounts.pdf", user_pagesize()); + $rep = new FrontReport(_('Chart of Accounts'), "ChartOfAccounts", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); @@ -68,12 +80,14 @@ function print_Chart_of_Accounts() $rep->Font('bold'); $rep->TextCol(0, 4, $account['AccountClassName']); $rep->Font(); - $rep->row -= ($rep->lineHeight + 4); + //$rep->row -= ($rep->lineHeight + 4); + $rep->NewLine(); } $group = $account['AccountTypeName']; $rep->TextCol(0, 4, $account['AccountTypeName']); //$rep->Line($rep->row - 4); - $rep->row -= ($rep->lineHeight + 4); + //$rep->row -= ($rep->lineHeight + 4); + $rep->NewLine(); } $classname = $account['AccountClassName']; @@ -81,7 +95,7 @@ function print_Chart_of_Accounts() $rep->TextCol(1, 2, $account['account_name']); $rep->TextCol(2, 3, $account['account_code2']); if ($showbalance == 1) - $rep->TextCol(3, 4, number_format2($balance, $dec)); + $rep->AmountCol(3, 4, $balance, $dec); $rep->NewLine(); if ($rep->row < $rep->bottomMargin + 3 * $rep->lineHeight) diff --git a/reporting/rep702.php b/reporting/rep702.php index 71afa149..bbb6ec4b 100644 --- a/reporting/rep702.php +++ b/reporting/rep702.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,17 +16,16 @@ $page_security = 2; // date_: 2005-05-19 // Title: List of Journal Entries // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); -include_once($path_to_root . "includes/ui/ui_view.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); +include_once($path_to_root . "/includes/ui/ui_view.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_list_of_journal_entries(); //---------------------------------------------------------------------------------------------------- @@ -26,12 +34,16 @@ function print_list_of_journal_entries() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; $systype = $_POST['PARAM_2']; $comments = $_POST['PARAM_3']; + $destination = $_POST['PARAM_4']; + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); + $dec = user_price_dec(); $cols = array(0, 100, 240, 300, 400, 460, 520, 580); @@ -46,7 +58,7 @@ function print_list_of_journal_entries() 2 => array('text' => _('Type'), 'from' => systypes::name($systype), 'to' => '')); - $rep = new FrontReport(_('List of Journal Entries'), "JournalEntries.pdf", user_pagesize()); + $rep = new FrontReport(_('List of Journal Entries'), "JournalEntries", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); @@ -70,7 +82,7 @@ function print_list_of_journal_entries() $typeno = $myrow['type_no']; $TransName = systypes::name($myrow['type']); $rep->TextCol(0, 2, $TransName . " # " . $myrow['type_no']); - $rep->TextCol(2, 3, sql2date($myrow['tran_date'])); + $rep->DateCol(2, 3, $myrow['tran_date'], true); $coms = payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"]); $memo = get_comments_string($myrow['type'], $myrow['type_no']); if ($memo != '') @@ -87,9 +99,9 @@ function print_list_of_journal_entries() $rep->TextCol(2, 3, $dim_str); $rep->TextCol(3, 4, $myrow['memo_']); if ($myrow['amount'] > 0.0) - $rep->TextCol(4, 5, number_format2(abs($myrow['amount']), $dec)); + $rep->AmountCol(4, 5, abs($myrow['amount']), $dec); else - $rep->TextCol(5, 6, number_format2(abs($myrow['amount']), $dec)); + $rep->AmountCol(5, 6, abs($myrow['amount']), $dec); $rep->NewLine(1, 2); } $rep->Line($rep->row + 4); diff --git a/reporting/rep704.php b/reporting/rep704.php index 794b053a..b584c97c 100644 --- a/reporting/rep704.php +++ b/reporting/rep704.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,16 +16,15 @@ $page_security = 2; // date_: 2005-05-19 // Title: GL Accounts Transactions // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_GL_transactions(); //---------------------------------------------------------------------------------------------------- @@ -25,9 +33,6 @@ function print_GL_transactions() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - - $rep = new FrontReport(_('GL Account Transactions'), "GLAccountTransactions.pdf", user_pagesize()); $dim = get_company_pref('use_dimension'); $dimension = $dimension2 = 0; @@ -40,16 +45,25 @@ function print_GL_transactions() $dimension = $_POST['PARAM_4']; $dimension2 = $_POST['PARAM_5']; $comments = $_POST['PARAM_6']; + $destination = $_POST['PARAM_7']; } else if ($dim == 1) { $dimension = $_POST['PARAM_4']; $comments = $_POST['PARAM_5']; + $destination = $_POST['PARAM_6']; } else { $comments = $_POST['PARAM_4']; + $destination = $_POST['PARAM_5']; } + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); + + $rep = new FrontReport(_('GL Account Transactions'), "GLAccountTransactions", user_pagesize()); $dec = user_price_dec(); $cols = array(0, 70, 90, 140, 210, 280, 340, 400, 450, 510, 570); @@ -62,7 +76,7 @@ function print_GL_transactions() if ($dim == 2) $headers = array(_('Type'), _('#'), _('Date'), _('Dimension')." 1", _('Dimension')." 2", _('Person/Item'), _('Debit'), _('Credit'), _('Balance')); - else if ($dim == 1) + elseif ($dim == 1) $headers = array(_('Type'), _('#'), _('Date'), _('Dimension'), "", _('Person/Item'), _('Debit'), _('Credit'), _('Balance')); else @@ -121,9 +135,9 @@ function print_GL_transactions() $rep->TextCol(0, 3, $account['account_code'] . " " . $account['account_name']); $rep->TextCol(3, 5, _('Opening Balance')); if ($prev_balance > 0.0) - $rep->TextCol(6, 7, number_format2(abs($prev_balance), $dec)); + $rep->AmountCol(6, 7, abs($prev_balance), $dec); else - $rep->TextCol(7, 8, number_format2(abs($prev_balance), $dec)); + $rep->AmountCol(7, 8, abs($prev_balance), $dec); $rep->Font(); $total = $prev_balance; $rep->NewLine(2); @@ -135,16 +149,16 @@ function print_GL_transactions() $rep->TextCol(0, 1, systypes::name($myrow["type"])); $rep->TextCol(1, 2, $myrow['type_no']); - $rep->TextCol(2, 3, sql2date($myrow["tran_date"])); + $rep->DateCol(2, 3, $myrow["tran_date"], true); if ($dim >= 1) $rep->TextCol(3, 4, get_dimension_string($myrow['dimension_id'])); if ($dim > 1) $rep->TextCol(4, 5, get_dimension_string($myrow['dimension2_id'])); $rep->TextCol(5, 6, payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"], false)); if ($myrow['amount'] > 0.0) - $rep->TextCol(6, 7, number_format2(abs($myrow['amount']), $dec)); + $rep->AmountCol(6, 7, abs($myrow['amount']), $dec); else - $rep->TextCol(7, 8, number_format2(abs($myrow['amount']), $dec)); + $rep->AmountCol(7, 8, abs($myrow['amount']), $dec); $rep->TextCol(8, 9, number_format2($total, $dec)); $rep->NewLine(); if ($rep->row < $rep->bottomMargin + $rep->lineHeight) @@ -158,9 +172,9 @@ function print_GL_transactions() $rep->Font('bold'); $rep->TextCol(3, 5, _("Ending Balance")); if ($total > 0.0) - $rep->TextCol(6, 7, number_format2(abs($total), $dec)); + $rep->AmountCol(6, 7, abs($total), $dec); else - $rep->TextCol(7, 8, number_format2(abs($total), $dec)); + $rep->AmountCol(7, 8, abs($total), $dec); $rep->Font(); $rep->Line($rep->row - $rep->lineHeight + 4); $rep->NewLine(2, 1); diff --git a/reporting/rep705.php b/reporting/rep705.php index 86674fe3..699cc28a 100644 --- a/reporting/rep705.php +++ b/reporting/rep705.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,25 +16,21 @@ $page_security = 2; // date_: 2005-05-19 // Title: Annual expense breakdown // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_annual_expense_breakdown(); //---------------------------------------------------------------------------------------------------- function getPeriods($year, $account, $dimension, $dimension2) { - //$yr = date('Y'); - //$mo = date('m'): - // from now $yr = $year; $mo = 12; $date13 = date('Y-m-d',mktime(0,0,0,$mo+1,1,$yr)); @@ -72,7 +77,6 @@ function print_annual_expense_breakdown() { global $path_to_root, $date_system; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); $dim = get_company_pref('use_dimension'); $dimension = $dimension2 = 0; @@ -82,18 +86,26 @@ function print_annual_expense_breakdown() $dimension = $_POST['PARAM_1']; $dimension2 = $_POST['PARAM_2']; $comments = $_POST['PARAM_3']; + $destination = $_POST['PARAM_4']; } else if ($dim == 1) { $year = $_POST['PARAM_0']; $dimension = $_POST['PARAM_1']; $comments = $_POST['PARAM_2']; + $destination = $_POST['PARAM_3']; } else { $year = $_POST['PARAM_0']; $comments = $_POST['PARAM_1']; + $destination = $_POST['PARAM_2']; } + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); + $dec = 1; //$pdec = user_percent_dec(); @@ -160,7 +172,7 @@ function print_annual_expense_breakdown() 'to' => '')); } - $rep = new FrontReport(_('Annual Expense Breakdown'), "AnnualBreakDown.pdf", user_pagesize()); + $rep = new FrontReport(_('Annual Expense Breakdown'), "AnnualBreakDown", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); @@ -196,27 +208,29 @@ function print_annual_expense_breakdown() { if ($group != '') { - $rep->Line($rep->row + 6); - $rep->row -= 6; + $rep->row += 6; + $rep->Line($rep->row); + $rep->NewLine(); $rep->TextCol(0, 2, _('Total') . " " . $group); for ($i = 1; $i <= 12; $i++) - $rep->TextCol($i + 1, $i + 2, number_format2($total[$i], $dec)); + $rep->AmountCol($i + 1, $i + 2, $total[$i], $dec); $total = Array(1 => 0,0,0,0,0,0,0,0,0,0,0,0); - $rep->row -= ($rep->lineHeight + 4); + $rep->NewLine(); if ($closeclass) { - $rep->Line($rep->row + 6); - $rep->row -= 6; + $rep->row += 6; + $rep->Line($rep->row); + $rep->NewLine(); $rep->Font('bold'); $rep->TextCol(0, 2, _('Total') . " " . $classname); for ($i = 1; $i <= 12; $i++) { - $rep->TextCol($i + 1, $i + 2, number_format2($total2[$i], $dec)); + $rep->AmountCol($i + 1, $i + 2, $total2[$i], $dec); $sales[$i] += $total2[$i]; } $rep->Font(); $total2 = Array(1 => 0,0,0,0,0,0,0,0,0,0,0,0); - $rep->NewLine(3); + $rep->NewLine(2); $closeclass = false; } } @@ -225,19 +239,21 @@ function print_annual_expense_breakdown() $rep->Font('bold'); $rep->TextCol(0, 5, $account['AccountClassName']); $rep->Font(); - $rep->row -= ($rep->lineHeight + 4); + $rep->NewLine(); } $group = $account['AccountTypeName']; + $rep->row -= 4; $rep->TextCol(0, 5, $account['AccountTypeName']); - $rep->Line($rep->row - 4); - $rep->row -= ($rep->lineHeight + 4); + $rep->row -= 4; + $rep->Line($rep->row); + $rep->NewLine(); } $classname = $account['AccountClassName']; $rep->TextCol(0, 1, $account['account_code']); $rep->TextCol(1, 2, $account['account_name']); for ($i = 1; $i <= 12; $i++) { - $rep->TextCol($i + 1, $i + 2, number_format2($balance[$i], $dec)); + $rep->AmountCol($i + 1, $i + 2, $balance[$i], $dec); $total[$i] += $balance[$i]; $total2[$i] += $balance[$i]; } @@ -261,29 +277,31 @@ function print_annual_expense_breakdown() { if ($group != '') { - $rep->Line($rep->row + 6); - $rep->row -= 6; + $rep->row += 6; + $rep->Line($rep->row); + $rep->NewLine(); $rep->TextCol(0, 2, _('Total') . " " . $group); for ($i = 1; $i <= 12; $i++) - $rep->TextCol($i + 1, $i + 2, number_format2($total[$i], $dec)); - $rep->row -= ($rep->lineHeight + 4); + $rep->AmountCol($i + 1, $i + 2, $total[$i], $dec); + $rep->NewLine(); if ($closeclass) { - $rep->Line($rep->row + 6); - $rep->row -= 6; + $rep->row += 6; + $rep->Line($rep->row); + $rep->NewLine(); $rep->Font('bold'); $rep->TextCol(0, 2, _('Total') . " " . $classname); for ($i = 1; $i <= 12; $i++) { - $rep->TextCol($i + 1, $i + 2, number_format2($total2[$i], $dec)); + $rep->AmountCol($i + 1, $i + 2, $total2[$i], $dec); $calc[$i] = $sales[$i] + $total2[$i]; } - $rep->row -= ($rep->lineHeight + 8); + $rep->NewLine(2); $rep->TextCol(0, 2, _('Calculated Return')); for ($i = 1; $i <= 12; $i++) - $rep->TextCol($i + 1, $i + 2, number_format2($calc[$i], $dec)); + $rep->AmountCol($i + 1, $i + 2, $calc[$i], $dec); $rep->Font(); $rep->NewLine(); diff --git a/reporting/rep706.php b/reporting/rep706.php index 9917bf53..d045d558 100644 --- a/reporting/rep706.php +++ b/reporting/rep706.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,16 +16,15 @@ $page_security = 2; // date_: 2005-05-19 // Title: Balance Sheet // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_balance_sheet(); @@ -26,7 +34,6 @@ function print_balance_sheet() { global $comp_path, $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); $dim = get_company_pref('use_dimension'); $dimension = $dimension2 = 0; @@ -38,21 +45,28 @@ function print_balance_sheet() $dimension2 = $_POST['PARAM_3']; $graphics = $_POST['PARAM_4']; $comments = $_POST['PARAM_5']; + $destination = $_POST['PARAM_6']; } else if ($dim == 1) { $dimension = $_POST['PARAM_2']; $graphics = $_POST['PARAM_3']; $comments = $_POST['PARAM_4']; + $destination = $_POST['PARAM_5']; } else { $graphics = $_POST['PARAM_2']; $comments = $_POST['PARAM_3']; + $destination = $_POST['PARAM_4']; } + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); if ($graphics) { - include_once($path_to_root . "reporting/includes/class.graphic.inc"); + include_once($path_to_root . "/reporting/includes/class.graphic.inc"); $pg = new graph(); } $dec = 0; @@ -87,12 +101,10 @@ function print_balance_sheet() 1 => array('text' => _('Period'),'from' => $from, 'to' => $to)); } - $rep = new FrontReport(_('Balance Sheet'), "BalanceSheet.pdf", user_pagesize()); - + $rep = new FrontReport(_('Balance Sheet'), "BalanceSheet", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); $rep->Header(); - $classname = ''; $group = ''; $totalopen = 0.0; @@ -105,6 +117,7 @@ function print_balance_sheet() $assetsperiod = 0.0; $assetsclose = 0.0; $closeclass = false; + $rep->NewLine(); $accounts = get_gl_accounts_all(1); @@ -129,34 +142,36 @@ function print_balance_sheet() { if ($group != '') { - $rep->Line($rep->row + 6); - $rep->row -= 6; + $rep->row += 6; + $rep->Line($rep->row); + $rep->NewLine(); $rep->TextCol(0, 2, _('Total') . " " . $group); - $rep->TextCol(2, 3, number_format2($totalopen, $dec)); - $rep->TextCol(3, 4, number_format2($totalperiod, $dec)); - $rep->TextCol(4, 5, number_format2($totalclose, $dec)); + $rep->AmountCol(2, 3, $totalopen, $dec); + $rep->AmountCol(3, 4, $totalperiod, $dec); + $rep->AmountCol(4, 5, $totalclose, $dec); if ($graphics) { $pg->x[] = $group; $pg->y[] = abs($totalclose); } $totalopen = $totalperiod = $totalclose = 0.0; - $rep->row -= ($rep->lineHeight + 4); + $rep->NewLine(); if ($closeclass) { - $rep->Line($rep->row + 6); - $rep->row -= 6; + $rep->row += 6; + $rep->Line($rep->row); + $rep->NewLine(); $rep->Font('bold'); - $rep->TextCol(0, 2, _('Total') . " " . $classname); - $rep->TextCol(2, 3, number_format2($classopen, $dec)); - $rep->TextCol(3, 4, number_format2($classperiod, $dec)); - $rep->TextCol(4, 5, number_format2($classclose, $dec)); + $rep->TextCol(0, 2, _('Total') . " " . $classname); + $rep->AmountCol(2, 3, $classopen, $dec); + $rep->AmountCol(3, 4, $classperiod, $dec); + $rep->AmountCol(4, 5, $classclose, $dec); $rep->Font(); $assetsopen += $classopen; $assetsperiod += $classperiod; $assetsclose += $classclose; $classopen = $classperiod = $classclose = 0.0; - $rep->NewLine(3); + $rep->NewLine(2); $closeclass = false; } } @@ -165,12 +180,14 @@ function print_balance_sheet() $rep->Font('bold'); $rep->TextCol(0, 5, $account['AccountClassName']); $rep->Font(); - $rep->row -= ($rep->lineHeight + 4); + $rep->NewLine(); } $group = $account['AccountTypeName']; + $rep->row -= 4; $rep->TextCol(0, 5, $account['AccountTypeName']); - $rep->Line($rep->row - 4); - $rep->row -= ($rep->lineHeight + 4); + $rep->row -= 4; + $rep->Line($rep->row); + $rep->NewLine(); } $classname = $account['AccountClassName']; @@ -183,9 +200,9 @@ function print_balance_sheet() $rep->TextCol(0, 1, $account['account_code']); $rep->TextCol(1, 2, $account['account_name']); - $rep->TextCol(2, 3, number_format2($prev_balance, $dec)); - $rep->TextCol(3, 4, number_format2($curr_balance, $dec)); - $rep->TextCol(4, 5, number_format2($curr_balance + $prev_balance, $dec)); + $rep->AmountCol(2, 3, $prev_balance, $dec); + $rep->AmountCol(3, 4, $curr_balance, $dec); + $rep->AmountCol(4, 5, $curr_balance + $prev_balance, $dec); $rep->NewLine(); @@ -206,42 +223,42 @@ function print_balance_sheet() { if ($group != '') { - $rep->Line($rep->row + 6); - $rep->row -= 6; + $rep->row += 6; + $rep->Line($rep->row); + $rep->NewLine(); $rep->TextCol(0, 2, _('Total') . " " . $group); - $rep->TextCol(2, 3, number_format2($totalopen, $dec)); - $rep->TextCol(3, 4, number_format2($totalperiod, $dec)); - $rep->TextCol(4, 5, number_format2($totalclose, $dec)); + $rep->AmountCol(2, 3, $totalopen, $dec); + $rep->AmountCol(3, 4, $totalperiod, $dec); + $rep->AmountCol(4, 5, $totalclose, $dec); if ($graphics) { $pg->x[] = $group; $pg->y[] = abs($totalclose); } - $rep->row -= ($rep->lineHeight + 4); + $rep->NewLine(); if ($closeclass) { - $rep->Line($rep->row + 6); $calculateopen = -$assetsopen - $classopen; $calculateperiod = -$assetsperiod - $classperiod; $calculateclose = -$assetsclose - $classclose; - $rep->row -= 6; - + $rep->row += 6; + $rep->Line($rep->row); + $rep->NewLine(); $rep->TextCol(0, 2, _('Calculated Return')); - $rep->TextCol(2, 3, number_format2($calculateopen, $dec)); - $rep->TextCol(3, 4, number_format2($calculateperiod, $dec)); - $rep->TextCol(4, 5, number_format2($calculateclose, $dec)); + $rep->AmountCol(2, 3, $calculateopen, $dec); + $rep->AmountCol(3, 4, $calculateperiod, $dec); + $rep->AmountCol(4, 5, $calculateclose, $dec); if ($graphics) { $pg->x[] = _('Calculated Return'); $pg->y[] = abs($calculateclose); } - $rep->row -= ($rep->lineHeight + 4); - + $rep->NewLine(2); $rep->Font('bold'); $rep->TextCol(0, 2, _('Total') . " " . $classname); - $rep->TextCol(2, 3, number_format2(-$assetsopen, $dec)); - $rep->TextCol(3, 4, number_format2(-$assetsperiod, $dec)); - $rep->TextCol(4, 5, number_format2(-$assetsclose, $dec)); + $rep->AmountCol(2, 3, -$assetsopen, $dec); + $rep->AmountCol(3, 4, -$assetsperiod, $dec); + $rep->AmountCol(4, 5, -$assetsclose, $dec); $rep->Font(); $rep->NewLine(); } @@ -258,7 +275,7 @@ function print_balance_sheet() $pg->type = $graphics; $pg->skin = $graph_skin; $pg->built_in = false; - $pg->fontfile = $path_to_root . "reporting/fonts/Vera.ttf"; + $pg->fontfile = $path_to_root . "/reporting/fonts/Vera.ttf"; $pg->latin_notation = ($decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != "."); $filename = $comp_path.'/'.user_company()."/pdf_files/test.png"; $pg->display($filename, true); diff --git a/reporting/rep707.php b/reporting/rep707.php index 9d2f0d2c..5dd3ff5c 100644 --- a/reporting/rep707.php +++ b/reporting/rep707.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,16 +16,15 @@ $page_security = 2; // date_: 2005-05-19 // Title: Profit and Loss Statement // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_profit_and_loss_statement(); //---------------------------------------------------------------------------------------------------- @@ -39,7 +47,6 @@ function print_profit_and_loss_statement() { global $comp_path, $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); $dim = get_company_pref('use_dimension'); $dimension = $dimension2 = 0; @@ -52,21 +59,28 @@ function print_profit_and_loss_statement() $dimension2 = $_POST['PARAM_4']; $graphics = $_POST['PARAM_5']; $comments = $_POST['PARAM_6']; + $destination = $_POST['PARAM_7']; } else if ($dim == 1) { $dimension = $_POST['PARAM_3']; $graphics = $_POST['PARAM_4']; $comments = $_POST['PARAM_5']; + $destination = $_POST['PARAM_6']; } else { $graphics = $_POST['PARAM_3']; $comments = $_POST['PARAM_4']; + $destination = $_POST['PARAM_5']; } + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); if ($graphics) { - include_once($path_to_root . "reporting/includes/class.graphic.inc"); + include_once($path_to_root . "/reporting/includes/class.graphic.inc"); $pg = new graph(); } $dec = 0; @@ -120,7 +134,7 @@ function print_profit_and_loss_statement() $headers[3] = _('Period Y-1'); } - $rep = new FrontReport(_('Profit and Loss Statement'), "ProfitAndLoss.pdf", user_pagesize()); + $rep = new FrontReport(_('Profit and Loss Statement'), "ProfitAndLoss", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); @@ -160,12 +174,13 @@ function print_profit_and_loss_statement() { if ($group != '') { - $rep->Line($rep->row + 6); - $rep->row -= 6; + $rep->row += 6; + $rep->Line($rep->row); + $rep->NewLine(); $rep->TextCol(0, 2, _('Total') . " " . $group); - $rep->TextCol(2, 3, number_format2($totalper, $dec)); - $rep->TextCol(3, 4, number_format2($totalacc, $dec)); - $rep->TextCol(4, 5, number_format2(Achieve($totalper, $totalacc), $pdec)); + $rep->AmountCol(2, 3, $totalper, $dec); + $rep->AmountCol(3, 4, $totalacc, $dec); + $rep->AmountCol(4, 5, Achieve($totalper, $totalacc), $pdec); if ($graphics) { $pg->x[] = $group; @@ -173,21 +188,22 @@ function print_profit_and_loss_statement() $pg->z[] = abs($totalacc); } $totalper = $totalacc = 0.0; - $rep->row -= ($rep->lineHeight + 4); + $rep->NewLine(); if ($closeclass) { - $rep->Line($rep->row + 6); - $rep->row -= 6; + $rep->row += 6; + $rep->Line($rep->row); + $rep->NewLine(); $rep->Font('bold'); $rep->TextCol(0, 2, _('Total') . " " . $classname); - $rep->TextCol(2, 3, number_format2($classper, $dec)); - $rep->TextCol(3, 4, number_format2($classacc, $dec)); - $rep->TextCol(4, 5, number_format2(Achieve($classper, $classacc), $pdec)); + $rep->AmountCol(2, 3, $classper, $dec); + $rep->AmountCol(3, 4, $classacc, $dec); + $rep->AmountCol(4, 5, Achieve($classper, $classacc), $pdec); $rep->Font(); $salesper += $classper; $salesacc += $classacc; $classper = $classacc = 0.0; - $rep->NewLine(3); + $rep->NewLine(2); $closeclass = false; } } @@ -196,12 +212,14 @@ function print_profit_and_loss_statement() $rep->Font('bold'); $rep->TextCol(0, 5, $account['AccountClassName']); $rep->Font(); - $rep->row -= ($rep->lineHeight + 4); + $rep->NewLine(); } $group = $account['AccountTypeName']; + $rep->row -= 4; $rep->TextCol(0, 5, $account['AccountTypeName']); - $rep->Line($rep->row - 4); - $rep->row -= ($rep->lineHeight + 4); + $rep->row -= 4; + $rep->Line($rep->row); + $rep->NewLine(); } $classname = $account['AccountClassName']; @@ -214,9 +232,9 @@ function print_profit_and_loss_statement() $rep->TextCol(0, 1, $account['account_code']); $rep->TextCol(1, 2, $account['account_name']); - $rep->TextCol(2, 3, number_format2($per_balance, $dec)); - $rep->TextCol(3, 4, number_format2($acc_balance, $dec)); - $rep->TextCol(4, 5, number_format2(Achieve($per_balance, $acc_balance), $pdec)); + $rep->AmountCol(2, 3, $per_balance, $dec); + $rep->AmountCol(3, 4, $acc_balance, $dec); + $rep->AmountCol(4, 5, Achieve($per_balance, $acc_balance), $pdec); $rep->NewLine(); @@ -237,37 +255,40 @@ function print_profit_and_loss_statement() { if ($group != '') { - $rep->Line($rep->row + 6); - $rep->row -= 6; + $rep->row += 6; + $rep->Line($rep->row); + $rep->NewLine(); $rep->TextCol(0, 2, _('Total') . " " . $group); - $rep->TextCol(2, 3, number_format2($totalper, $dec)); - $rep->TextCol(3, 4, number_format2($totalacc, $dec)); - $rep->TextCol(4, 5, number_format2(Achieve($totalper, $totalacc), $pdec)); + $rep->AmountCol(2, 3, $totalper, $dec); + $rep->AmountCol(3, 4, $totalacc, $dec); + $rep->AmountCol(4, 5, Achieve($totalper, $totalacc), $pdec); if ($graphics) { $pg->x[] = $group; $pg->y[] = abs($totalper); $pg->z[] = abs($totalacc); } - $rep->row -= ($rep->lineHeight + 4); + $rep->NewLine(); if ($closeclass) { $rep->Line($rep->row + 6); $calculateper = $salesper + $classper; $calculateacc = $salesacc + $classacc; - $rep->row -= 6; + $rep->row += 6; + $rep->Line($rep->row); + $rep->NewLine(); $rep->Font('bold'); $rep->TextCol(0, 2, _('Total') . " " . $classname); - $rep->TextCol(2, 3, number_format2($classper, $dec)); - $rep->TextCol(3, 4, number_format2($classacc, $dec)); - $rep->TextCol(4, 5, number_format2(Achieve($classper, $classacc), $pdec)); + $rep->AmountCol(2, 3, $classper, $dec); + $rep->AmountCol(3, 4, $classacc, $dec); + $rep->AmountCol(4, 5, Achieve($classper, $classacc), $pdec); - $rep->row -= ($rep->lineHeight + 8); + $rep->NewLine(2); $rep->TextCol(0, 2, _('Calculated Return')); - $rep->TextCol(2, 3, number_format2($calculateper, $dec)); - $rep->TextCol(3, 4, number_format2($calculateacc, $dec)); - $rep->TextCol(4, 5, number_format2(Achieve($calculateper, $calculateacc), $pdec)); + $rep->AmountCol(2, 3, $calculateper, $dec); + $rep->AmountCol(3, 4, $calculateacc, $dec); + $rep->AmountCol(4, 5, Achieve($calculateper, $calculateacc), $pdec); if ($graphics) { $pg->x[] = _('Calculated Return'); @@ -293,7 +314,7 @@ function print_profit_and_loss_statement() $pg->type = $graphics; $pg->skin = $graph_skin; $pg->built_in = false; - $pg->fontfile = $path_to_root . "reporting/fonts/Vera.ttf"; + $pg->fontfile = $path_to_root . "/reporting/fonts/Vera.ttf"; $pg->latin_notation = ($decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != "."); $filename = $comp_path.'/'.user_company(). "/pdf_files/test.png"; $pg->display($filename, true); diff --git a/reporting/rep708.php b/reporting/rep708.php index 97d2d95d..6f3086b5 100644 --- a/reporting/rep708.php +++ b/reporting/rep708.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,16 +16,15 @@ $page_security = 2; // date_: 2005-05-19 // Title: Trial Balance // ---------------------------------------------------------------- -$path_to_root="../"; +$path_to_root=".."; -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_trial_balance(); //---------------------------------------------------------------------------------------------------- @@ -55,7 +63,6 @@ function print_trial_balance() { global $path_to_root; - include_once($path_to_root . "reporting/includes/pdf_report.inc"); $dim = get_company_pref('use_dimension'); $dimension = $dimension2 = 0; @@ -68,16 +75,23 @@ function print_trial_balance() $dimension = $_POST['PARAM_4']; $dimension2 = $_POST['PARAM_5']; $comments = $_POST['PARAM_6']; + $destination = $_POST['PARAM_7']; } else if ($dim == 1) { $dimension = $_POST['PARAM_4']; $comments = $_POST['PARAM_5']; + $destination = $_POST['PARAM_6']; } else { $comments = $_POST['PARAM_4']; + $destination = $_POST['PARAM_5']; } + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); $dec = user_price_dec(); //$cols2 = array(0, 50, 230, 330, 430, 530); @@ -119,7 +133,7 @@ function print_trial_balance() 1 => array('text' => _('Period'),'from' => $from, 'to' => $to)); } - $rep = new FrontReport(_('Trial Balance'), "TrialBalance.pdf", user_pagesize()); + $rep = new FrontReport(_('Trial Balance'), "TrialBalance", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2); @@ -145,26 +159,26 @@ function print_trial_balance() if ($balances != 0) { if ($prev['balance'] >= 0.0) - $rep->TextCol(2, 3, number_format2($prev['balance'], $dec)); + $rep->AmountCol(2, 3, $prev['balance'], $dec); else - $rep->TextCol(3, 4, number_format2(abs($prev['balance']), $dec)); + $rep->AmountCol(3, 4, abs($prev['balance']), $dec); if ($curr['balance'] >= 0.0) - $rep->TextCol(4, 5, number_format2($curr['balance'], $dec)); + $rep->AmountCol(4, 5, $curr['balance'], $dec); else - $rep->TextCol(5, 6, number_format2(abs($curr['balance']), $dec)); + $rep->AmountCol(5, 6, abs($curr['balance']), $dec); if ($tot['balance'] >= 0.0) - $rep->TextCol(6, 7, number_format2($tot['balance'], $dec)); + $rep->AmountCol(6, 7, $tot['balance'], $dec); else - $rep->TextCol(7, 8, number_format2(abs($tot['balance']), $dec)); + $rep->AmountCol(7, 8, abs($tot['balance']), $dec); } else { - $rep->TextCol(2, 3, number_format2($prev['debit'], $dec)); - $rep->TextCol(3, 4, number_format2($prev['credit'], $dec)); - $rep->TextCol(4, 5, number_format2($curr['debit'], $dec)); - $rep->TextCol(5, 6, number_format2($curr['credit'], $dec)); - $rep->TextCol(6, 7, number_format2($tot['debit'], $dec)); - $rep->TextCol(7, 8, number_format2($tot['credit'], $dec)); + $rep->AmountCol(2, 3, $prev['debit'], $dec); + $rep->AmountCol(3, 4, $prev['credit'], $dec); + $rep->AmountCol(4, 5, $curr['debit'], $dec); + $rep->AmountCol(5, 6, $curr['credit'], $dec); + $rep->AmountCol(6, 7, $tot['debit'], $dec); + $rep->AmountCol(7, 8, $tot['credit'], $dec); $pdeb += $prev['debit']; $pcre += $prev['credit']; $cdeb += $curr['debit']; @@ -195,30 +209,31 @@ function print_trial_balance() if ($balances == 0) { $rep->TextCol(0, 2, _("Total")); - $rep->TextCol(2, 3, number_format2($pdeb, $dec)); - $rep->TextCol(3, 4, number_format2($pcre, $dec)); - $rep->TextCol(4, 5, number_format2($cdeb, $dec)); - $rep->TextCol(5, 6, number_format2($ccre, $dec)); - $rep->TextCol(6, 7, number_format2($tdeb, $dec)); - $rep->TextCol(7, 8, number_format2($tcre, $dec)); + $rep->AmountCol(2, 3, $pdeb, $dec); + $rep->AmountCol(3, 4, $pcre, $dec); + $rep->AmountCol(4, 5, $cdeb, $dec); + $rep->AmountCol(5, 6, $ccre, $dec); + $rep->AmountCol(6, 7, $tdeb, $dec); + $rep->AmountCol(7, 8, $tcre, $dec); $rep->NewLine(); } $rep->TextCol(0, 2, _("Ending Balance")); if ($pbal >= 0.0) - $rep->TextCol(2, 3, number_format2($pbal, $dec)); + $rep->AmountCol(2, 3, $pbal, $dec); else - $rep->TextCol(3, 4, number_format2(abs($pbal), $dec)); + $rep->AmountCol(3, 4, abs($pbal), $dec); if ($cbal >= 0.0) - $rep->TextCol(4, 5, number_format2($cbal, $dec)); + $rep->AmountCol(4, 5, $cbal, $dec); else - $rep->TextCol(5, 6, number_format2(abs($cbal), $dec)); + $rep->AmountCol(5, 6, abs($cbal), $dec); if ($tbal >= 0.0) - $rep->TextCol(6, 7, number_format2($tbal, $dec)); + $rep->AmountCol(6, 7, $tbal, $dec); else - $rep->TextCol(7, 8, number_format2(abs($tbal), $dec)); + $rep->AmountCol(7, 8, abs($tbal), $dec); + $rep->NewLine(); - $rep->Line($rep->row - 6); + $rep->Line($rep->row); $rep->End(); } diff --git a/reporting/rep709.php b/reporting/rep709.php index 6f0139a1..c135445f 100644 --- a/reporting/rep709.php +++ b/reporting/rep709.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; // ---------------------------------------------------------------- // $ Revision: 2.0 $ @@ -7,89 +16,50 @@ $page_security = 2; // date_: 2005-05-19 // Title: Tax Report // ---------------------------------------------------------------- -$path_to_root="../"; - -include_once($path_to_root . "includes/session.inc"); -include_once($path_to_root . "includes/date_functions.inc"); -include_once($path_to_root . "includes/data_checks.inc"); -include_once($path_to_root . "gl/includes/gl_db.inc"); - -//---------------------------------------------------------------------------------------------------- - -print_tax_report(); - -function getTax($tno, $tpe) -{ - // GROUP BY debtor_trans_type, debtor_trans_no"; - $sql = "SELECT SUM(amount) AS Amount, MAX(included_in_price) AS Included FROM ".TB_PREF."debtor_trans_tax_details - WHERE debtor_trans_no=$tno - AND debtor_trans_type=$tpe - AND amount <> 0"; +$path_to_root=".."; - $result = db_query($sql,"No transactions were returned"); - return db_fetch($result); -} - -function getCustTransactions($from, $to) -{ - $fromdate = date2sql($from); - $todate = date2sql($to); +include_once($path_to_root . "/includes/session.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/gl/includes/gl_db.inc"); - $netamount = "IF(".TB_PREF."debtor_trans.type=11,-(ov_amount+ov_freight+ov_discount),ov_amount+ov_freight+ov_discount)*".TB_PREF."debtor_trans.rate"; +//------------------------------------------------------------------ - $sql = "SELECT ".TB_PREF."debtor_trans.reference, - ".TB_PREF."debtor_trans.trans_no, - ".TB_PREF."debtor_trans.type, - ".TB_PREF."debtor_trans.rate, - ".TB_PREF."sys_types.type_name, - ".TB_PREF."debtor_trans.tran_date, - ".TB_PREF."debtor_trans.debtor_no, - ".TB_PREF."debtors_master.name, - ".TB_PREF."debtors_master.curr_code, - ".TB_PREF."debtor_trans.branch_code, - ".TB_PREF."debtor_trans.order_, - $netamount AS NetAmount - FROM ".TB_PREF."debtor_trans - INNER JOIN ".TB_PREF."debtors_master ON ".TB_PREF."debtor_trans.debtor_no=".TB_PREF."debtors_master.debtor_no - INNER JOIN ".TB_PREF."sys_types ON ".TB_PREF."debtor_trans.type=".TB_PREF."sys_types.type_id - WHERE ".TB_PREF."debtor_trans.tran_date >= '$fromdate' - AND ".TB_PREF."debtor_trans.tran_date <= '$todate' - AND (".TB_PREF."debtor_trans.type=10 OR ".TB_PREF."debtor_trans.type=11) - ORDER BY ".TB_PREF."debtor_trans.tran_date"; - return db_query($sql,"No transactions were returned"); -} +print_tax_report(); -function getSuppTransactions($from, $to) +function getTaxTransactions($from, $to) { $fromdate = date2sql($from); $todate = date2sql($to); - $sql = "SELECT ".TB_PREF."supp_trans.supp_reference, - ".TB_PREF."supp_trans.type, - ".TB_PREF."sys_types.type_name, - ".TB_PREF."supp_trans.tran_date, - ".TB_PREF."supp_trans.supplier_id, - ".TB_PREF."supp_trans.rate, - ".TB_PREF."suppliers.supp_name, - ".TB_PREF."suppliers.curr_code, - ".TB_PREF."supp_trans.rate, - (ov_amount+ov_discount)*rate AS NetAmount, - ov_gst*rate AS Tax - FROM ".TB_PREF."supp_trans - INNER JOIN ".TB_PREF."suppliers ON ".TB_PREF."supp_trans.supplier_id=".TB_PREF."suppliers.supplier_id - INNER JOIN ".TB_PREF."sys_types ON ".TB_PREF."supp_trans.type=".TB_PREF."sys_types.type_id - WHERE ".TB_PREF."supp_trans.tran_date >= '$fromdate' - AND ".TB_PREF."supp_trans.tran_date <= '$todate' - AND (".TB_PREF."supp_trans.type=20 OR ".TB_PREF."supp_trans.type=21) - ORDER BY ".TB_PREF."supp_trans.tran_date"; - + $sql = "SELECT taxrec.*, taxrec.amount*ex_rate AS amount, + taxrec.net_amount*ex_rate AS net_amount, + stype.type_name, + IF(ISNULL(supp.supp_name), debt.name, supp.supp_name) as name, + branch.br_name + FROM ".TB_PREF."trans_tax_details taxrec + LEFT JOIN ".TB_PREF."supp_trans strans + ON taxrec.trans_no=strans.trans_no AND taxrec.trans_type=strans.type + LEFT JOIN ".TB_PREF."suppliers as supp ON strans.supplier_id=supp.supplier_id + LEFT JOIN ".TB_PREF."debtor_trans dtrans + ON taxrec.trans_no=dtrans.trans_no AND taxrec.trans_type=dtrans.type + LEFT JOIN ".TB_PREF."debtors_master as debt ON dtrans.debtor_no=debt.debtor_no + LEFT JOIN ".TB_PREF."cust_branch as branch ON dtrans.branch_code=branch.branch_code, + ".TB_PREF."sys_types stype + WHERE taxrec.trans_type=stype.type_id + AND (taxrec.amount != 0 OR taxrec.net_amount != 0) + AND taxrec.trans_type != 13 + AND taxrec.tran_date >= '$fromdate' + AND taxrec.tran_date <= '$todate' + ORDER BY taxrec.tran_date"; +//display_error($sql); return db_query($sql,"No transactions were returned"); } function getTaxTypes() { - $sql = "SELECT id FROM ".TB_PREF."tax_types ORDER BY id"; + $sql = "SELECT * FROM ".TB_PREF."tax_types ORDER BY id"; return db_query($sql,"No transactions were returned"); } @@ -100,135 +70,71 @@ function getTaxInfo($id) return db_fetch($result); } -function getCustInvTax($taxtype, $from, $to) -{ - $fromdate = date2sql($from); - $todate = date2sql($to); - $amount = "IF(".TB_PREF."debtor_trans_tax_details.debtor_trans_type=11,-amount,amount)*".TB_PREF."debtor_trans.rate"; - $mamount = "IF(".TB_PREF."debtor_trans_tax_details.included_in_price=0, 0, $amount)"; - $netamount = "IF(".TB_PREF."debtor_trans.type=11,-quantity,quantity)*unit_price*".TB_PREF."debtor_trans.rate-$mamount"; - - $sql = "SELECT SUM($netamount), - SUM($amount) - FROM ".TB_PREF."debtor_trans_details, ".TB_PREF."debtor_trans_tax_details, ".TB_PREF."debtor_trans - WHERE ".TB_PREF."debtor_trans.type>=10 - AND ".TB_PREF."debtor_trans.type<=11 - AND ".TB_PREF."debtor_trans_details.debtor_trans_no=".TB_PREF."debtor_trans.trans_no - AND ".TB_PREF."debtor_trans_details.debtor_trans_type=".TB_PREF."debtor_trans.type - AND ".TB_PREF."debtor_trans.trans_no=".TB_PREF."debtor_trans_tax_details.debtor_trans_no - AND ".TB_PREF."debtor_trans.type=".TB_PREF."debtor_trans_tax_details.debtor_trans_type - AND ".TB_PREF."debtor_trans_tax_details.amount <> 0 - AND ".TB_PREF."debtor_trans_tax_details.tax_type_id=$taxtype - AND ".TB_PREF."debtor_trans.tran_date >= '$fromdate' - AND ".TB_PREF."debtor_trans.tran_date <= '$todate'"; - - $result = db_query($sql,"No transactions were returned"); - return db_fetch_row($result); -} - -function getSuppInvTax($taxtype, $from, $to) -{ - $fromdate = date2sql($from); - $todate = date2sql($to); - $sql = "SELECT SUM(unit_price * quantity * ".TB_PREF."supp_trans.rate), SUM(amount*".TB_PREF."supp_trans.rate) - FROM ".TB_PREF."supp_invoice_items, ".TB_PREF."supp_invoice_tax_items, ".TB_PREF."supp_trans - WHERE ".TB_PREF."supp_trans.type>=20 - AND ".TB_PREF."supp_trans.type<=21 - AND ".TB_PREF."supp_trans.trans_no=".TB_PREF."supp_invoice_tax_items.supp_trans_no - AND ".TB_PREF."supp_trans.type=".TB_PREF."supp_invoice_tax_items.supp_trans_type - AND ".TB_PREF."supp_invoice_items.supp_trans_no=".TB_PREF."supp_trans.trans_no - AND ".TB_PREF."supp_invoice_items.supp_trans_type=".TB_PREF."supp_trans.type - AND ".TB_PREF."supp_invoice_tax_items.tax_type_id=$taxtype - AND ".TB_PREF."supp_invoice_tax_items.amount <> 0 - AND ".TB_PREF."supp_trans.tran_date >= '$fromdate' - AND ".TB_PREF."supp_trans.tran_date <= '$todate'"; - - $result = db_query($sql,"No transactions were returned"); - return db_fetch_row($result); -} - //---------------------------------------------------------------------------------------------------- function print_tax_report() { - global $path_to_root; - - include_once($path_to_root . "reporting/includes/pdf_report.inc"); - - $rep = new FrontReport(_('Tax Report'), "TaxReport.pdf", user_pagesize()); - + global $path_to_root, $trans_dir; + $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; $summaryOnly = $_POST['PARAM_2']; $comments = $_POST['PARAM_3']; + + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); + $dec = user_price_dec(); + $rep = new FrontReport(_('Tax Report'), "TaxReport", user_pagesize()); if ($summaryOnly == 1) $summary = _('Summary Only'); else $summary = _('Detailed Report'); - $res = getTaxTypes(); $taxes = array(); - $i = 0; while ($tax=db_fetch($res)) - $taxes[$i++] = $tax['id']; - $idcounter = count($taxes); + $taxes[$tax['id']] = array('in'=>0, 'out'=>0, 'taxin'=>0, 'taxout'=>0); + + $params = array( 0 => $comments, + 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), + 2 => array('text' => _('Type'), 'from' => $summary, 'to' => '')); - $totalinvout = array(0,0,0,0,0,0,0,0,0,0); - $totaltaxout = array(0,0,0,0,0,0,0,0,0,0); - $totalinvin = array(0,0,0,0,0,0,0,0,0,0); - $totaltaxin = array(0,0,0,0,0,0,0,0,0,0); + $cols = array(0, 80, 130, 180, 290, 370, 455, 505, 555); + $headers = array(_('Trans Type'), _('Ref'), _('Date'), _('Name'), _('Branch Name'), + _('Net'), _('Rate'), _('Tax')); + $aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right', 'right'); + $rep->Font(); + $rep->Info($params, $cols, $headers, $aligns); if (!$summaryOnly) { - $cols = array(0, 80, 130, 190, 290, 370, 435, 500, 565); - - $headers = array(_('Trans Type'), _('#'), _('Date'), _('Name'), _('Branch Name'), - _('Net'), _('Tax')); - - $aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right'); - - $params = array( 0 => $comments, - 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), - 2 => array('text' => _('Type'), 'from' => $summary, 'to' => '')); - - $rep->Font(); - $rep->Info($params, $cols, $headers, $aligns); $rep->Header(); } + $totalnet = 0.0; $totaltax = 0.0; - - $transactions = getCustTransactions($from, $to); + $transactions = getTaxTransactions($from, $to); while ($trans=db_fetch($transactions)) { - $tx = getTax($trans['trans_no'], $trans['type']); - if ($tx === false) - $tax_amt = 0; - else - { - $tx['Amount'] *= $trans['rate']; - if ($trans['type'] == 11) - $tx['Amount'] *= -1; - if ($tx['Included'] > 0) - $trans['NetAmount'] -= $tx['Amount']; - $tax_amt = $tx['Amount']; + if (in_array($trans['trans_type'], array(11,20,1))) { + $trans['net_amount'] *= -1; + $trans['amount'] *= -1; } + if (!$summaryOnly) { $rep->TextCol(0, 1, $trans['type_name']); - $rep->TextCol(1, 2, $trans['reference']); - $rep->TextCol(2, 3, sql2date($trans['tran_date'])); + $rep->TextCol(1, 2, $trans['memo']); + $rep->DateCol(2, 3, $trans['tran_date'], true); $rep->TextCol(3, 4, $trans['name']); - if ($trans["branch_code"] > 0) - $rep->TextCol(4, 5, get_branch_name($trans["branch_code"])); + $rep->TextCol(4, 5, $trans['br_name']); - $rep->TextCol(5, 6, number_format2($trans['NetAmount'], $dec)); - $rep->TextCol(6, 7, number_format2($tax_amt, $dec)); + $rep->AmountCol(5, 6, $trans['net_amount'], $dec); + $rep->AmountCol(6, 7, $trans['rate'], $dec); + $rep->AmountCol(7, 8, $trans['amount'], $dec); $rep->NewLine(); @@ -238,221 +144,66 @@ function print_tax_report() $rep->Header(); } } - $totalnet += $trans['NetAmount']; - $totaltax += $tax_amt; - - } - if (!$summaryOnly) - { - $rep->NewLine(); - - if ($rep->row < $rep->bottomMargin + $rep->lineHeight) - { - $rep->Line($rep->row - 2); - $rep->Header(); - } - $rep->Line($rep->row + $rep->lineHeight); - $rep->TextCol(3, 5, _('Total Outputs')); - $rep->TextCol(5, 6, number_format2($totalnet, $dec)); - $rep->TextCol(6, 7, number_format2($totaltax, $dec)); - $rep->Line($rep->row - 5); - $rep->Header(); - } - $totalinnet = 0.0; - $totalintax = 0.0; - - $transactions = getSuppTransactions($from, $to); - - while ($trans=db_fetch($transactions)) - { - if (!$summaryOnly) - { - $rep->TextCol(0, 1, $trans['type_name']); - $rep->TextCol(1, 2, $trans['supp_reference']); - $rep->TextCol(2, 3, sql2date($trans['tran_date'])); - $rep->TextCol(3, 5, $trans['supp_name']); - $rep->TextCol(5, 6, number_format2($trans['NetAmount'], $dec)); - $rep->TextCol(6, 7, number_format2($trans['Tax'], $dec)); - - $rep->NewLine(); - if ($rep->row < $rep->bottomMargin + $rep->lineHeight) - { - $rep->Line($rep->row - 2); - $rep->Header(); - } - } - $totalinnet += $trans['NetAmount']; - $totalintax += $trans['Tax']; - - } - if (!$summaryOnly) - { - $rep->NewLine(); - - if ($rep->row < $rep->bottomMargin + $rep->lineHeight) - { - $rep->Line($rep->row - 2); - $rep->Header(); + if (in_array($trans['trans_type'], array(0,2,10,11))) { + $taxes[$trans['tax_type_id']]['taxout'] += $trans['amount']; + $taxes[$trans['tax_type_id']]['out'] += $trans['net_amount']; + } else { + $taxes[$trans['tax_type_id']]['taxin'] += $trans['amount']; + $taxes[$trans['tax_type_id']]['in'] += $trans['net_amount']; } - $rep->Line($rep->row + $rep->lineHeight); - $rep->TextCol(3, 5, _('Total Inputs')); - $rep->TextCol(5, 6, number_format2($totalinnet, $dec)); - $rep->TextCol(6, 7, number_format2($totalintax, $dec)); - $rep->Line($rep->row - 5); + $totalnet += $trans['net_amount']; + $totaltax += $trans['amount']; } - $cols2 = array(0, 100, 200, 300, 400, 500, 600); + + // Summary + $cols2 = array(0, 100, 180, 260, 340, 420, 500); - $headers2 = array(_('Tax Rate'), _('Outputs'), _('Output Tax'), _('Inputs'), _('Input Tax'), '', ''); + $headers2 = array(_('Tax Rate'), _('Outputs'), _('Output Tax'), _('Inputs'), _('Input Tax'), _('Net Tax')); $aligns2 = array('left', 'right', 'right', 'right', 'right', 'right', 'right'); - $invamount = 0.0; - for ($i = 0; $i < $idcounter; $i++) - { - $amt = getCustInvTax($taxes[$i], $from, $to); - $totalinvout[$i] += $amt[0]; - $totaltaxout[$i] += $amt[1]; - $invamount += $amt[0]; - } - if ($totalnet != $invamount) - { - $totalinvout[$idcounter] = ($totalnet - $invamount); - $totaltaxout[$idcounter] = 0.0; - } - $invamount2 = 0.0; - for ($i = 0; $i < $idcounter; $i++) - { - $amt = getSuppInvTax($taxes[$i], $from, $to); - $totalinvin[$i] += $amt[0]; - $totaltaxin[$i] += $amt[1]; - $invamount2 += $amt[0]; - } - if ($totalinnet != $invamount2) - { - $totalinvin[$idcounter] = ($totalinnet - $invamount2); - $totaltaxin[$idcounter] = 0.0; - } - if ($totalnet != $invamount || $totalinnet != $invamount2) - $idcounter++; for ($i = 0; $i < count($cols2); $i++) - { $rep->cols[$i] = $rep->leftMargin + $cols2[$i]; - $rep->headers[$i] = $headers2[$i]; - $rep->aligns[$i] = $aligns2[$i]; - } + + $rep->headers = $headers2; + $rep->aligns = $aligns2; $rep->Header(); - //$counter = count($totalinvout); - //$counter = max($counter, $idcounter); - $trow = $rep->row; - $i = 0; - for ($j = 0; $j < $idcounter; $j++) - { - if (isset($taxes[$j]) && $taxes[$j] > 0) - { - $tx = getTaxInfo($taxes[$j]); - $str = $tx['name'] . " " . number_format2($tx['rate'], $dec) . "%"; - } - else - $str = _('No tax specified'); - $rep->TextCol($i, $i + 1, $str); + $taxtotal = 0; + foreach( $taxes as $id=>$sum) + { + $tx = getTaxInfo($id); + + $rep->TextCol(0, 1, $tx['name'] . " " . number_format2($tx['rate'], $dec) . "%"); + $rep->AmountCol(1, 2, $sum['out'], $dec); + $rep->AmountCol(2, 3, $sum['taxout'], $dec); + $rep->AmountCol(3, 4, $sum['in'], $dec); + $rep->AmountCol(4, 5, $sum['taxin'], $dec); + $rep->AmountCol(5, 6, $sum['taxout']+$sum['taxin'], $dec); + $taxtotal += $sum['taxout']+$sum['taxin']; $rep->NewLine(); } - $i++; - $rep->row = $trow; - for ($j = 0; $j < $idcounter; $j++) - { - $rep->TextCol($i, $i + 1, number_format2($totalinvout[$j], $dec)); - $rep->NewLine(); - } - $i++; - $rep->row = $trow; - for ($j = 0; $j < $idcounter; $j++) - { - $rep->TextCol($i, $i + 1,number_format2($totaltaxout[$j], $dec)); - $rep->NewLine(); - } - $i++; - $rep->row = $trow; - for ($j = 0; $j < $idcounter; $j++) - { - $rep->TextCol($i, $i + 1, number_format2($totalinvin[$j], $dec)); - $rep->NewLine(); - } - $i++; - $rep->row = $trow; - for ($j = 0; $j < $idcounter; $j++) - { - $rep->TextCol($i, $i + 1, number_format2($totaltaxin[$j], $dec)); - $rep->NewLine(); - } - $rep->Line($rep->row - 4); - $rep->row -= 16; - $rep->TextCol(0, 5, _("General Ledger")); - $rep->Line($rep->row - 6); + $rep->Font('bold'); + $rep->NewLine(); + $rep->Line($rep->row + $rep->lineHeight); + $rep->TextCol(3, 5, _("Total payable or refund")); + $rep->AmountCol(5, 6, $taxtotal, $dec); + $rep->Line($rep->row - 5); + $rep->Font(); + $rep->NewLine(); - $rep->row -= 22; - - $trow = $rep->row; - - $idcounter = count($taxes); - $i = 0; - for ($j = 0; $j < $idcounter; $j++) - { - $tx = getTaxInfo($taxes[$j]); - $str = $tx['name'] . " " . number_format2($tx['rate'], $dec) . "%"; - $rep->TextCol($i, $i + 1, $str); - $rep->NewLine(); - } - $i++; - $rep->row = $trow; - for ($j = 0; $j < $idcounter; $j++) - { - $tx = getTaxInfo($taxes[$j]); - $acc = get_gl_account($tx['sales_gl_code']); - $rep->TextCol($i, $i + 1, $acc['account_code']." ".$acc['account_name']); - $rep->NewLine(); - } - $i++; - $rep->row = $trow; - for ($j = 0; $j < $idcounter; $j++) - { - $tx = getTaxInfo($taxes[$j]); - $amount = get_gl_trans_from_to($from, $to, $tx['sales_gl_code']); - $rep->TextCol($i, $i + 1,number_format2(-$amount, $dec)); - $rep->NewLine(); - } - $i++; - $rep->row = $trow; - for ($j = 0; $j < $idcounter; $j++) - { - $tx = getTaxInfo($taxes[$j]); - $acc = get_gl_account($tx['purchasing_gl_code']); - $rep->TextCol($i, $i + 1, $acc['account_code']." ".$acc['account_name']); - $rep->NewLine(); - } - $i++; - $rep->row = $trow; - for ($j = 0; $j < $idcounter; $j++) - { - $tx = getTaxInfo($taxes[$j]); - $amount = get_gl_trans_from_to($from, $to, $tx['purchasing_gl_code']); - $rep->TextCol($i, $i + 1,number_format2($amount, $dec)); - $rep->NewLine(); - } - $rep->Line($rep->row - 4); - - $locale = $path_to_root . "lang/" . $_SESSION['language']->code . "/locale.inc"; + $locale = $path_to_root . "/lang/" . $_SESSION['language']->code . "/locale.inc"; if (file_exists($locale)) { $taxinclude = true; include($locale); - /* - if (function_exists("TaxFunction")) - TaxFunction(); - */ + +// if (function_exists("TaxFunction")) +// TaxFunction(); + } + $rep->End(); } diff --git a/reporting/reports_main.php b/reporting/reports_main.php index 3b03af35..9eff484c 100644 --- a/reporting/reports_main.php +++ b/reporting/reports_main.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $path_to_root=".."; $page_security = 5; include_once($path_to_root . "/includes/session.inc"); @@ -11,49 +20,58 @@ include_once($path_to_root . "/reporting/includes/reports_classes.inc"); $js = ""; if ($use_date_picker) $js .= get_js_date_picker(); -page(_("Reports and Analysis"), false, false, "", $js, true); +page(_("Reports and Analysis"), false, false, "", $js); $reports = new BoxReports; $dim = get_company_pref('use_dimension'); $reports->addReportClass(_('Customer')); -$reports->addReport(_('Customer'),101,_('Customer Balances'), +$reports->addReport(_('Customer'),101,_('Customer &Balances'), array( new ReportParam(_('End Date'),'DATE'), new ReportParam(_('Customer'),'CUSTOMERS_NO_FILTER'), new ReportParam(_('Currency Filter'),'CURRENCY'), - new ReportParam(_('Comments'),'TEXTBOX'))); -$reports->addReport(_('Customer'),102,_('Aged Customer Analysis'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); +$reports->addReport(_('Customer'),102,_('&Aged Customer Analysis'), array( new ReportParam(_('End Date'),'DATE'), new ReportParam(_('Customer'),'CUSTOMERS_NO_FILTER'), new ReportParam(_('Currency Filter'),'CURRENCY'), new ReportParam(_('Summary Only'),'YES_NO'), new ReportParam(_('Graphics'),'GRAPHIC'), - new ReportParam(_('Comments'),'TEXTBOX'))); -$reports->addReport(_('Customer'),103,_('Customer Detail Listing'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); +$reports->addReport(_('Customer'),103,_('Customer &Detail Listing'), array( new ReportParam(_('Activity Since'),'DATEBEGIN'), new ReportParam(_('Sales Areas'),'AREAS'), - new ReportParam(_('Sales Folk'),'SALESMEN'), new ReportParam(_('Activity Greater Than'),'TEXT'), new ReportParam(_('Activity Less Than'),'TEXT'), new ReportParam(_('Comments'),'TEXTBOX'))); -$reports->addReport(_('Customer'),104,_('Price Listing'), + new ReportParam(_('Sales Folk'),'SALESMEN'), + new ReportParam(_('Activity Greater Than'),'TEXT'), + new ReportParam(_('Activity Less Than'),'TEXT'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); +$reports->addReport(_('Customer'),104,_('&Price Listing'), array( new ReportParam(_('Currency Filter'),'CURRENCY'), new ReportParam(_('Inventory Category'),'CATEGORIES'), new ReportParam(_('Sales Types'),'SALESTYPES'), new ReportParam(_('Show Pictures'),'YES_NO'), new ReportParam(_('Show GP %'),'YES_NO'), - new ReportParam(_('Comments'),'TEXTBOX'))); -$reports->addReport(_('Customer'),105,_('Order Status Listing'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); +$reports->addReport(_('Customer'),105,_('&Order Status Listing'), array( new ReportParam(_('Start Date'),'DATEBEGINM'), new ReportParam(_('End Date'),'DATEENDM'), new ReportParam(_('Inventory Category'),'CATEGORIES'), new ReportParam(_('Stock Location'),'LOCATIONS'), new ReportParam(_('Back Orders Only'),'YES_NO'), - new ReportParam(_('Comments'),'TEXTBOX'))); -$reports->addReport(_('Customer'),106,_('Salesman Listing'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); +$reports->addReport(_('Customer'),106,_('&Salesman Listing'), array( new ReportParam(_('Start Date'),'DATEBEGINM'), new ReportParam(_('End Date'),'DATEENDM'), new ReportParam(_('Summary Only'),'YES_NO'), - new ReportParam(_('Comments'),'TEXTBOX'))); -$reports->addReport(_('Customer'),107,_('Print Invoices/Credit Notes'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); +$reports->addReport(_('Customer'),107,_('Print &Invoices/Credit Notes'), array( new ReportParam(_('From'),'INVOICE'), new ReportParam(_('To'),'INVOICE'), new ReportParam(_('Currency Filter'),'CURRENCY'), @@ -61,18 +79,18 @@ $reports->addReport(_('Customer'),107,_('Print Invoices/Credit Notes'), new ReportParam(_('email Customers'),'YES_NO'), new ReportParam(_('Payment Link'),'PAYMENT_LINK'), new ReportParam(_('Comments'),'TEXTBOX'))); -$reports->addReport(_('Customer'),110,_('Print Deliveries'), +$reports->addReport(_('Customer'),110,_('Print &Deliveries'), array( new ReportParam(_('From'),'DELIVERY'), new ReportParam(_('To'),'DELIVERY'), new ReportParam(_('email Customers'),'YES_NO'), new ReportParam(_('Comments'),'TEXTBOX'))); -$reports->addReport(_('Customer'),108,_('Print Statements'), +$reports->addReport(_('Customer'),108,_('Print &Statements'), array( new ReportParam(_('Customer'),'CUSTOMERS_NO_FILTER'), new ReportParam(_('Currency Filter'),'CURRENCY'), new ReportParam(_('Bank Account'),'BANK_ACCOUNTS'), new ReportParam(_('Email Customers'),'YES_NO'), new ReportParam(_('Comments'),'TEXTBOX'))); -$reports->addReport(_('Customer'),109,_('Print Sales Orders'), +$reports->addReport(_('Customer'),109,_('&Print Sales Orders'), array( new ReportParam(_('From'),'ORDERS'), new ReportParam(_('To'),'ORDERS'), new ReportParam(_('Currency Filter'),'CURRENCY'), @@ -82,27 +100,31 @@ $reports->addReport(_('Customer'),109,_('Print Sales Orders'), new ReportParam(_('Comments'),'TEXTBOX'))); $reports->addReportClass(_('Supplier')); -$reports->addReport(_('Supplier'),201,_('Supplier Balances'), +$reports->addReport(_('Supplier'),201,_('Supplier &Balances'), array( new ReportParam(_('End Date'),'DATE'), new ReportParam(_('Supplier'),'SUPPLIERS_NO_FILTER'), new ReportParam(_('Currency Filter'),'CURRENCY'), - new ReportParam(_('Comments'),'TEXTBOX'))); -$reports->addReport(_('Supplier'),202,_('Aged Supplier Analyses'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); +$reports->addReport(_('Supplier'),202,_('&Aged Supplier Analyses'), array( new ReportParam(_('End Date'),'DATE'), new ReportParam(_('Supplier'),'SUPPLIERS_NO_FILTER'), new ReportParam(_('Currency Filter'),'CURRENCY'), new ReportParam(_('Summary Only'),'YES_NO'), new ReportParam(_('Graphics'),'GRAPHIC'), - new ReportParam(_('Comments'),'TEXTBOX'))); -$reports->addReport(_('Supplier'),203,_('Payment Report'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); +$reports->addReport(_('Supplier'),203,_('&Payment Report'), array( new ReportParam(_('End Date'),'DATE'), new ReportParam(_('Supplier'),'SUPPLIERS_NO_FILTER'), new ReportParam(_('Currency Filter'),'CURRENCY'), - new ReportParam(_('Comments'),'TEXTBOX'))); -$reports->addReport(_('Supplier'),204,_('Outstanding GRNs Report'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); +$reports->addReport(_('Supplier'),204,_('Outstanding &GRNs Report'), array( new ReportParam(_('Supplier'),'SUPPLIERS_NO_FILTER'), - new ReportParam(_('Comments'),'TEXTBOX'))); -$reports->addReport(_('Supplier'),209,_('Print Purchase Orders'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); +$reports->addReport(_('Supplier'),209,_('Print Purchase &Orders'), array( new ReportParam(_('From'),'PO'), new ReportParam(_('To'),'PO'), new ReportParam(_('Currency Filter'),'CURRENCY'), @@ -111,185 +133,198 @@ $reports->addReport(_('Supplier'),209,_('Print Purchase Orders'), new ReportParam(_('Comments'),'TEXTBOX'))); $reports->addReportClass(_('Inventory')); -$reports->addReport(_('Inventory'),301,_('Inventory Valuation Report'), +$reports->addReport(_('Inventory'),301,_('Inventory &Valuation Report'), array( new ReportParam(_('Inventory Category'),'CATEGORIES'), new ReportParam(_('Location'),'LOCATIONS'), new ReportParam(_('Detailed Report'),'YES_NO'), - new ReportParam(_('Comments'),'TEXTBOX'))); -$reports->addReport(_('Inventory'),302,_('Inventory Planning Report'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); +$reports->addReport(_('Inventory'),302,_('Inventory &Planning Report'), array( new ReportParam(_('Inventory Category'),'CATEGORIES'), new ReportParam(_('Location'),'LOCATIONS'), - new ReportParam(_('Comments'),'TEXTBOX'))); -$reports->addReport(_('Inventory'),303,_('Stock Check Sheets'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); +$reports->addReport(_('Inventory'),303,_('Stock &Check Sheets'), array( new ReportParam(_('Inventory Category'),'CATEGORIES'), new ReportParam(_('Location'),'LOCATIONS'), new ReportParam(_('Show Pictures'),'YES_NO'), new ReportParam(_('Inventory Column'),'YES_NO'), - new ReportParam(_('Comments'),'TEXTBOX'))); -$reports->addReport(_('Inventory'),304,_('Inventory Sales Report'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); +$reports->addReport(_('Inventory'),304,_('Inventory &Sales Report'), array( new ReportParam(_('Start Date'),'DATEBEGINM'), new ReportParam(_('End Date'),'DATEENDM'), new ReportParam(_('Inventory Category'),'CATEGORIES'), new ReportParam(_('Location'),'LOCATIONS'), new ReportParam(_('Detailed Report'),'YES_NO'), - new ReportParam(_('Comments'),'TEXTBOX'))); + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); $reports->addReportClass(_('Manufactoring')); -$reports->addReport(_('Manufactoring'),401,_('Bill of Material Listing'), +$reports->addReport(_('Manufactoring'),401,_('&Bill of Material Listing'), array( new ReportParam(_('From component'),'ITEMS'), new ReportParam(_('To component'),'ITEMS'), - new ReportParam(_('Comments'),'TEXTBOX'))); + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); $reports->addReportClass(_('Dimensions')); if ($dim > 0) { - $reports->addReport(_('Dimensions'),501,_('Dimension Summary'), + $reports->addReport(_('Dimensions'),501,_('Dimension &Summary'), array( new ReportParam(_('From Dimension'),'DIMENSION'), new ReportParam(_('To Dimension'),'DIMENSION'), new ReportParam(_('Show Balance'),'YES_NO'), - new ReportParam(_('Comments'),'TEXTBOX'))); + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); //$reports->addReport(_('Dimensions'),502,_('Dimension Details'), //array( new ReportParam(_('Dimension'),'DIMENSIONS'), // new ReportParam(_('Comments'),'TEXTBOX'))); } $reports->addReportClass(_('Banking')); - $reports->addReport(_('Banking'),601,_('Bank Statement'), + $reports->addReport(_('Banking'),601,_('Bank &Statement'), array( new ReportParam(_('Bank Accounts'),'BANK_ACCOUNTS'), new ReportParam(_('Start Date'),'DATEBEGINM'), new ReportParam(_('End Date'),'DATEENDM'), - new ReportParam(_('Comments'),'TEXTBOX'))); + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); $reports->addReportClass(_('General Ledger')); -$reports->addReport(_('General Ledger'),701,_('Chart of Accounts'), +$reports->addReport(_('General Ledger'),701,_('Chart of &Accounts'), array( new ReportParam(_('Show Balances'),'YES_NO'), - new ReportParam(_('Comments'),'TEXTBOX'))); -$reports->addReport(_('General Ledger'),702,_('List of Journal Entries'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); +$reports->addReport(_('General Ledger'),702,_('List of &Journal Entries'), array( new ReportParam(_('Start Date'),'DATEBEGINM'), new ReportParam(_('End Date'),'DATEENDM'), new ReportParam(_('Type'),'SYS_TYPES'), - new ReportParam(_('Comments'),'TEXTBOX'))); + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); //$reports->addReport(_('General Ledger'),703,_('GL Account Group Summary'), // array( new ReportParam(_('Comments'),'TEXTBOX'))); if ($dim == 2) { - $reports->addReport(_('General Ledger'),704,_('GL Account Transactions'), + $reports->addReport(_('General Ledger'),704,_('GL Account &Transactions'), array( new ReportParam(_('Start Date'),'DATEBEGINM'), new ReportParam(_('End Date'),'DATEENDM'), new ReportParam(_('From Account'),'GL_ACCOUNTS'), new ReportParam(_('To Account'),'GL_ACCOUNTS'), new ReportParam(_('Dimension')." 1", 'DIMENSIONS1'), new ReportParam(_('Dimension')." 2", 'DIMENSIONS2'), - new ReportParam(_('Comments'),'TEXTBOX'))); - $reports->addReport(_('General Ledger'),705,_('Annual Expense Breakdown'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); + $reports->addReport(_('General Ledger'),705,_('Annual &Expense Breakdown'), array( new ReportParam(_('Year'),'TRANS_YEARS'), new ReportParam(_('Dimension')." 1", 'DIMENSIONS1'), new ReportParam(_('Dimension')." 2", 'DIMENSIONS2'), - new ReportParam(_('Comments'),'TEXTBOX'))); - $reports->addReport(_('General Ledger'),706,_('Balance Sheet'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); + $reports->addReport(_('General Ledger'),706,_('&Balance Sheet'), array( new ReportParam(_('Start Date'),'DATEBEGIN'), new ReportParam(_('End Date'),'DATEENDM'), new ReportParam(_('Dimension')." 1", 'DIMENSIONS1'), new ReportParam(_('Dimension')." 2", 'DIMENSIONS2'), new ReportParam(_('Graphics'),'GRAPHIC'), - new ReportParam(_('Comments'),'TEXTBOX'))); - $reports->addReport(_('General Ledger'),707,_('Profit and Loss Statement'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); + $reports->addReport(_('General Ledger'),707,_('&Profit and Loss Statement'), array( new ReportParam(_('Start Date'),'DATEBEGINM'), new ReportParam(_('End Date'),'DATEENDM'), new ReportParam(_('Compare to'),'COMPARE'), new ReportParam(_('Dimension')." 1", 'DIMENSIONS1'), new ReportParam(_('Dimension')." 2", 'DIMENSIONS2'), new ReportParam(_('Graphics'),'GRAPHIC'), - new ReportParam(_('Comments'),'TEXTBOX'))); - $reports->addReport(_('General Ledger'),708,_('Trial Balance'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); + $reports->addReport(_('General Ledger'),708,_('Trial &Balance'), array( new ReportParam(_('Start Date'),'DATEBEGINM'), new ReportParam(_('End Date'),'DATEENDM'), new ReportParam(_('Zero values'),'YES_NO'), new ReportParam(_('Only balances'),'YES_NO'), new ReportParam(_('Dimension')." 1", 'DIMENSIONS1'), new ReportParam(_('Dimension')." 2", 'DIMENSIONS2'), - new ReportParam(_('Comments'),'TEXTBOX'))); + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); } else if ($dim == 1) { - $reports->addReport(_('General Ledger'),704,_('GL Account Transactions'), + $reports->addReport(_('General Ledger'),704,_('GL Account &Transactions'), array( new ReportParam(_('Start Date'),'DATEBEGINM'), new ReportParam(_('End Date'),'DATEENDM'), new ReportParam(_('From Account'),'GL_ACCOUNTS'), new ReportParam(_('To Account'),'GL_ACCOUNTS'), new ReportParam(_('Dimension'), 'DIMENSIONS1'), - new ReportParam(_('Comments'),'TEXTBOX'))); - $reports->addReport(_('General Ledger'),705,_('Annual Expense Breakdown'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); + $reports->addReport(_('General Ledger'),705,_('Annual &Expense Breakdown'), array( new ReportParam(_('Year'),'TRANS_YEARS'), new ReportParam(_('Dimension'), 'DIMENSIONS1'), - new ReportParam(_('Comments'),'TEXTBOX'))); - $reports->addReport(_('General Ledger'),706,_('Balance Sheet'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); + $reports->addReport(_('General Ledger'),706,_('&Balance Sheet'), array( new ReportParam(_('Start Date'),'DATEBEGIN'), new ReportParam(_('End Date'),'DATEENDM'), new ReportParam(_('Dimension'), 'DIMENSIONS1'), new ReportParam(_('Graphics'),'GRAPHIC'), - new ReportParam(_('Comments'),'TEXTBOX'))); - $reports->addReport(_('General Ledger'),707,_('Profit and Loss Statement'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); + $reports->addReport(_('General Ledger'),707,_('&Profit and Loss Statement'), array( new ReportParam(_('Start Date'),'DATEBEGINM'), new ReportParam(_('End Date'),'DATEENDM'), new ReportParam(_('Compare to'),'COMPARE'), new ReportParam(_('Dimension'), 'DIMENSIONS1'), new ReportParam(_('Graphics'),'GRAPHIC'), - new ReportParam(_('Comments'),'TEXTBOX'))); - $reports->addReport(_('General Ledger'),708,_('Trial Balance'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); + $reports->addReport(_('General Ledger'),708,_('Trial &Balance'), array( new ReportParam(_('Start Date'),'DATEBEGINM'), new ReportParam(_('End Date'),'DATEENDM'), new ReportParam(_('Zero values'),'YES_NO'), new ReportParam(_('Only balances'),'YES_NO'), new ReportParam(_('Dimension'), 'DIMENSIONS1'), - new ReportParam(_('Comments'),'TEXTBOX'))); + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); } else { - $reports->addReport(_('General Ledger'),704,_('GL Account Transactions'), + $reports->addReport(_('General Ledger'),704,_('GL Account &Transactions'), array( new ReportParam(_('Start Date'),'DATEBEGINM'), new ReportParam(_('End Date'),'DATEENDM'), new ReportParam(_('From Account'),'GL_ACCOUNTS'), new ReportParam(_('To Account'),'GL_ACCOUNTS'), - new ReportParam(_('Comments'),'TEXTBOX'))); - $reports->addReport(_('General Ledger'),705,_('Annual Expense Breakdown'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); + $reports->addReport(_('General Ledger'),705,_('Annual &Expense Breakdown'), array( new ReportParam(_('Year'),'TRANS_YEARS'), - new ReportParam(_('Comments'),'TEXTBOX'))); - $reports->addReport(_('General Ledger'),706,_('Balance Sheet'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); + $reports->addReport(_('General Ledger'),706,_('&Balance Sheet'), array( new ReportParam(_('Start Date'),'DATEBEGIN'), new ReportParam(_('End Date'),'DATEENDM'), new ReportParam(_('Graphics'),'GRAPHIC'), - new ReportParam(_('Comments'),'TEXTBOX'))); - $reports->addReport(_('General Ledger'),707,_('Profit and Loss Statement'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'), + new ReportParam(_('Destination'),'DESTINATION'))); + $reports->addReport(_('General Ledger'),707,_('&Profit and Loss Statement'), array( new ReportParam(_('Start Date'),'DATEBEGINM'), new ReportParam(_('End Date'),'DATEENDM'), new ReportParam(_('Compare to'),'COMPARE'), new ReportParam(_('Graphics'),'GRAPHIC'), - new ReportParam(_('Comments'),'TEXTBOX'))); - $reports->addReport(_('General Ledger'),708,_('Trial Balance'), + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); + $reports->addReport(_('General Ledger'),708,_('Trial &Balance'), array( new ReportParam(_('Start Date'),'DATEBEGINM'), new ReportParam(_('End Date'),'DATEENDM'), new ReportParam(_('Zero values'),'YES_NO'), new ReportParam(_('Only balances'),'YES_NO'), - new ReportParam(_('Comments'),'TEXTBOX'))); + new ReportParam(_('Comments'),'TEXTBOX'), + new ReportParam(_('Destination'),'DESTINATION'))); } -$reports->addReport(_('General Ledger'),709,_('Tax Report'), +$reports->addReport(_('General Ledger'),709,_('Ta&x Report'), array( new ReportParam(_('Start Date'),'DATEBEGINTAX'), new ReportParam(_('End Date'),'DATEENDTAX'), new ReportParam(_('Summary Only'),'YES_NO'), new ReportParam(_('Comments'),'TEXTBOX'))); -echo " -
- - - - - - - - - - - "; echo $reports->getDisplay(); -echo "
"; end_page(); ?> \ No newline at end of file diff --git a/sales/allocations/customer_allocate.php b/sales/allocations/customer_allocate.php index 5f30f66c..c0785cb1 100644 --- a/sales/allocations/customer_allocate.php +++ b/sales/allocations/customer_allocate.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $path_to_root="../.."; $page_security = 3; diff --git a/sales/allocations/customer_allocation_main.php b/sales/allocations/customer_allocation_main.php index 2cbce6a0..ee373036 100644 --- a/sales/allocations/customer_allocation_main.php +++ b/sales/allocations/customer_allocation_main.php @@ -1,7 +1,17 @@ . +***********************************************************************/ $path_to_root="../.."; $page_security = 3; +include($path_to_root . "/includes/db_pager.inc"); include_once($path_to_root . "/includes/session.inc"); include_once($path_to_root . "/sales/includes/sales_ui.inc"); @@ -20,11 +30,7 @@ if (isset($_POST['_customer_id_editor'])) { context_call($path_to_root.'/sales/manage/customers.php?debtor_no='.$_POST['customer_id'] ); } -function display_allocatable_transactions() -{ - global $table_style, $path_to_root; - start_form(); - +start_form(); /* show all outstanding receipts and credits to be allocated */ /*Clear any previous allocation records */ if (isset($_SESSION['alloc'])) @@ -62,67 +68,65 @@ function display_allocatable_transactions() if (isset($_POST['customer_id'])) $customer_id = $_POST['customer_id']; - $trans_items = get_allocatable_from_cust_transactions($customer_id, $settled); - div_start('alloc_tbl'); - start_table($table_style); - if (!isset($_POST['customer_id'])) - $th = array(_("Transaction Type"), _("#"), _("Reference"), _("Date"), _("Customer"), - _("Currency"), _("Total"), _("Left To Allocate"), ""); - else - $th = array(_("Transaction Type"), _("#"), _("Reference"), _("Date"), - _("Total"), _("Left To Allocate"), ""); - table_header($th); - $k = 0; //row colour counter - $has_settled_items = false; - - while ($myrow = db_fetch($trans_items)) - { - if ($myrow["settled"] == 1) - { - start_row("class='settledbg'"); - $has_settled_items = true; - } - else - { - alt_table_row_color($k); - } - - label_cell(systypes::name($myrow["type"])); - label_cell(get_trans_view_str($myrow["type"], $myrow["trans_no"])); - label_cell($myrow["reference"]); - label_cell(sql2date($myrow["tran_date"])); - - if (!isset($_POST['customer_id'])) - { - label_cell($myrow["DebtorName"]); - label_cell($myrow["curr_code"]); - } - amount_cell($myrow["Total"]); - amount_cell($myrow["Total"] - $myrow["alloc"]); - label_cell("
" . _("Allocate") . ""); - end_row(); - } +//-------------------------------------------------------------------------------- +function systype_name($dummy, $type) +{ + return systypes::name($type); +} - end_table(); +function trans_view($trans) +{ + return get_trans_view_str($trans["type"], $trans["trans_no"]); +} - if ($has_settled_items) - display_note(_("Marked items are settled."), 0, 1, "class='settledfg'"); +function alloc_link($row) +{ + return pager_link(_("Allocate"), + "/sales/allocations/customer_allocate.php?trans_no=" + .$row["trans_no"] . "&trans_type=" . $row["type"], ICON_MONEY); +} - if (db_num_rows($trans_items) == 0) - display_note(_("There are no allocations to be done."), 1, 2); - div_end(); - end_form(); +function amount_left($row) +{ + return price_format($row["Total"]-$row["alloc"]); } -//-------------------------------------------------------------------------------- -if (get_post('_ShowSettled_update')) { - $Ajax->activate('alloc_tbl'); +function check_settled($row) +{ + return $row['settled'] == 1; } -display_allocatable_transactions(); -//-------------------------------------------------------------------------------- -end_page(); +$sql = get_allocatable_from_cust_sql($customer_id, $settled); + +$cols = array( + _("Transaction Type") => array('fun'=>'systype_name'), + _("#") => array('fun'=>'trans_view'), + _("Reference"), + _("Date") => array('name'=>'tran_date', 'type'=>'date', 'ord'=>'asc'), + _("Customer") => array('ord'=>''), + _("Currency") => array('align'=>'center'), + _("Total") => 'amount', + _("Left to Allocate") => array('align'=>'right','insert'=>true, 'fun'=>'amount_left'), + array('insert'=>true, 'fun'=>'alloc_link') + ); + +if (isset($_POST['customer_id'])) { + $cols[_("Customer")] = 'skip'; + $cols[_("Currency")] = 'skip'; +} + +$table =& new_db_pager('alloc_tbl', $sql, $cols); +$table->set_marker('check_settled', _("Marked items are settled."), 'settledbg', 'settledfg'); + +if (get_post('_ShowSettled_update') || get_post('_customer_id_update')) { + $table->set_sql($sql); + $table->set_columns($cols); +} +$table->width = "75%"; + +display_db_pager($table); +end_form(); +end_page(); ?> \ No newline at end of file diff --git a/sales/credit_note_entry.php b/sales/credit_note_entry.php index 51d75ab7..c53a080d 100644 --- a/sales/credit_note_entry.php +++ b/sales/credit_note_entry.php @@ -1,4 +1,14 @@ . +***********************************************************************/ //--------------------------------------------------------------------------- // // Entry/Modify free hand Credit Note @@ -13,6 +23,7 @@ include_once($path_to_root . "/sales/includes/sales_ui.inc"); include_once($path_to_root . "/sales/includes/db/sales_types_db.inc"); include_once($path_to_root . "/sales/includes/ui/sales_credit_ui.inc"); include_once($path_to_root . "/sales/includes/ui/sales_order_ui.inc"); +include_once($path_to_root . "/reporting/includes/reporting.inc"); $js = ""; if ($use_popup_windows) { @@ -59,14 +70,18 @@ if (isset($_GET['AddedID'])) { display_notification_centered(sprintf(_("Credit Note # %d has been processed"),$credit_no)); - display_note(get_customer_trans_view_str($trans_type, $credit_no, _("View this credit note")), 0, 1); + display_note(get_customer_trans_view_str($trans_type, $credit_no, _("&View this credit note")), 0, 1); - display_note(get_gl_view_str($trans_type, $credit_no, _("View the GL Journal Entries for this Credit Note"))); + display_note(print_document_link($credit_no, _("&Print This Credit Invoice"), true, 11),0, 1); - hyperlink_params($_SERVER['PHP_SELF'], _("Enter Another Credit Note"), "NewCredit=yes"); + display_note(get_gl_view_str($trans_type, $credit_no, _("View the GL &Journal Entries for this Credit Note"))); + + hyperlink_params($_SERVER['PHP_SELF'], _("Enter Another &Credit Note"), "NewCredit=yes"); display_footer_exit(); -} +} else + check_edit_conflicts(); + //-------------------------------------------------------------------------------- function line_start_focus() { @@ -80,7 +95,6 @@ function line_start_focus() { function copy_to_cn() { $cart = &$_SESSION['Items']; - $cart->Comments = $_POST['CreditText']; $cart->document_date = $_POST['OrderDate']; $cart->freight_cost = input_num('ChargeFreightCost'); @@ -88,6 +102,8 @@ function copy_to_cn() $cart->sales_type = $_POST['sales_type_id']; $cart->reference = $_POST['ref']; $cart->ship_via = $_POST['ShipperID']; + $cart->dimension_id = $_POST['dimension_id']; + $cart->dimension2_id = $_POST['dimension2_id']; } //----------------------------------------------------------------------------- @@ -95,7 +111,6 @@ function copy_to_cn() function copy_from_cn() { $cart = &$_SESSION['Items']; - $_POST['CreditText'] = $cart->Comments; $_POST['OrderDate'] = $cart->document_date; $_POST['ChargeFreightCost'] = price_format($cart->freight_cost); @@ -103,6 +118,9 @@ function copy_from_cn() $_POST['sales_type_id'] = $cart->sales_type; $_POST['ref'] = $cart->reference; $_POST['ShipperID'] = $cart->ship_via; + $_POST['dimension_id'] = $cart->dimension_id; + $_POST['dimension2_id'] = $cart->dimension2_id; + $_POST['cart_id'] = $cart->cart_id; } //----------------------------------------------------------------------------- @@ -149,6 +167,7 @@ function can_process() //----------------------------------------------------------------------------- if (isset($_POST['ProcessCredit']) && can_process()) { + copy_to_cn(); if ($_POST['CreditType'] == "WriteOff" && (!isset($_POST['WriteOffGLCode']) || $_POST['WriteOffGLCode'] == '')) { display_note(_("For credit notes created to write off the stock, a general ledger account is required to be selected."), 1, 0); @@ -242,6 +261,7 @@ if (!processing_active()) { //----------------------------------------------------------------------------- start_form(false, true); +hidden('cart_id'); $customer_error = display_credit_header($_SESSION['Items']); @@ -249,7 +269,7 @@ if ($customer_error == "") { start_table("$table_style width=80%", 10); echo ""; display_credit_items(_("Credit Note Items"), $_SESSION['Items']); - credit_options_controls(); + credit_options_controls($_SESSION['Items']); echo ""; end_table(); } else { diff --git a/sales/customer_credit_invoice.php b/sales/customer_credit_invoice.php index 12b12a48..4959c23c 100644 --- a/sales/customer_credit_invoice.php +++ b/sales/customer_credit_invoice.php @@ -1,4 +1,14 @@ . +***********************************************************************/ //--------------------------------------------------------------------------- // // Entry/Modify Credit Note for selected Sales Invoice @@ -39,33 +49,33 @@ page($_SESSION['page_title'], false, false, "", $js); if (isset($_GET['AddedID'])) { $credit_no = $_GET['AddedID']; $trans_type = 11; - print_hidden_script(11); display_notification_centered(_("Credit Note has been processed")); - display_note(get_customer_trans_view_str($trans_type, $credit_no, _("View This Credit Note")), 0, 0); + display_note(get_customer_trans_view_str($trans_type, $credit_no, _("&View This Credit Note")), 0, 0); - display_note(print_document_link($credit_no, _("Print This Credit Note"), true, 11),1); + display_note(print_document_link($credit_no, _("&Print This Credit Note"), true, 11),1); - display_note(get_gl_view_str($trans_type, $credit_no, _("View the GL Journal Entries for this Credit Note")),1); + display_note(get_gl_view_str($trans_type, $credit_no, _("View the GL &Journal Entries for this Credit Note")),1); display_footer_exit(); } elseif (isset($_GET['UpdatedID'])) { $credit_no = $_GET['UpdatedID']; $trans_type = 11; - print_hidden_script(11); display_notification_centered(_("Credit Note has been updated")); - display_note(get_customer_trans_view_str($trans_type, $credit_no, _("View This Credit Note")), 0, 0); + display_note(get_customer_trans_view_str($trans_type, $credit_no, _("&View This Credit Note")), 0, 0); - display_note(print_document_link($credit_no, _("Print This Credit Note"), true, 11),1); + display_note(print_document_link($credit_no, _("&Print This Credit Note"), true, 11),1); - display_note(get_gl_view_str($trans_type, $credit_no, _("View the GL Journal Entries for this Credit Note")),1); + display_note(get_gl_view_str($trans_type, $credit_no, _("View the GL &Journal Entries for this Credit Note")),1); display_footer_exit(); -} +} else + check_edit_conflicts(); + //----------------------------------------------------------------------------- @@ -185,6 +195,7 @@ function copy_from_cart() $_POST['CreditDate']= $cart->document_date; $_POST['Location']= $cart->Location; $_POST['CreditText']= $cart->Comments; + $_POST['cart_id'] = $cart->cart_id; } //----------------------------------------------------------------------------- @@ -219,6 +230,7 @@ function display_credit_items() global $table_style, $table_style2; start_form(false, true); + hidden('cart_id'); start_table("$table_style2 width=80%", 5); echo ""; // outer table diff --git a/sales/customer_delivery.php b/sales/customer_delivery.php index 0909fd3c..ae077419 100644 --- a/sales/customer_delivery.php +++ b/sales/customer_delivery.php @@ -1,4 +1,14 @@ . +***********************************************************************/ //----------------------------------------------------------------------------- // // Entry/Modify Delivery Note against Sales Order @@ -36,7 +46,6 @@ page($_SESSION['page_title'], false, false, "", $js); if (isset($_GET['AddedID'])) { $dispatch_no = $_GET['AddedID']; - print_hidden_script(13); display_notification(_("Dispatch processed:") . ' '.$_GET['AddedID'], true); @@ -55,7 +64,6 @@ if (isset($_GET['AddedID'])) { } elseif (isset($_GET['UpdatedID'])) { $delivery_no = $_GET['UpdatedID']; - print_hidden_script(13); display_notification_centered(sprintf(_('Delivery Note # %d has been updated.'),$delivery_no)); @@ -116,14 +124,17 @@ if (isset($_GET['OrderNumber']) && $_GET['OrderNumber'] > 0) { end_page(); exit; -} elseif (!check_quantities()) { - display_error(_("Selected quantity cannot be less than quantity invoiced nor more than quantity - not dispatched on sales order.")); +} else { + check_edit_conflicts(); -} elseif(!check_num('ChargeFreightCost', 0)) - display_error(_("Freight cost cannot be less than zero")); - set_focus('ChargeFreightCost'); + if (!check_quantities()) { + display_error(_("Selected quantity cannot be less than quantity invoiced nor more than quantity + not dispatched on sales order.")); + } elseif(!check_num('ChargeFreightCost', 0)) + display_error(_("Freight cost cannot be less than zero")); + set_focus('ChargeFreightCost'); +} //----------------------------------------------------------------------------- @@ -208,6 +219,7 @@ function copy_from_cart() $_POST['due_date'] = $cart->due_date; $_POST['Location'] = $cart->Location; $_POST['Comments'] = $cart->Comments; + $_POST['cart_id'] = $cart->cart_id; } //------------------------------------------------------------------------------ @@ -296,6 +308,7 @@ if (isset($_POST['Update']) || isset($_POST['_Location_update'])) { } //------------------------------------------------------------------------------ start_form(false, true); +hidden('cart_id'); start_table("$table_style2 width=80%", 5); echo ""; // outer table diff --git a/sales/customer_invoice.php b/sales/customer_invoice.php index 5c0b5121..d935978f 100644 --- a/sales/customer_invoice.php +++ b/sales/customer_invoice.php @@ -1,4 +1,14 @@ . +***********************************************************************/ //--------------------------------------------------------------------------- // // Entry/Modify Sales Invoice against single delivery @@ -35,37 +45,36 @@ if (isset($_GET['ModifyInvoice'])) { page($_SESSION['page_title'], false, false, "", $js); //----------------------------------------------------------------------------- +check_edit_conflicts(); if (isset($_GET['AddedID'])) { $invoice_no = $_GET['AddedID']; $trans_type = 10; - print_hidden_script(10); display_notification(_("Selected deliveries has been processed"), true); - display_note(get_customer_trans_view_str($trans_type, $invoice_no, _("View This Invoice")), 0, 1); + display_note(get_customer_trans_view_str($trans_type, $invoice_no, _("&View This Invoice")), 0, 1); - display_note(print_document_link($invoice_no, _("Print This Invoice"), true, 10)); + display_note(print_document_link($invoice_no, _("&Print This Invoice"), true, 10)); - display_note(get_gl_view_str($trans_type, $invoice_no, _("View the GL Journal Entries for this Invoice")),1); + display_note(get_gl_view_str($trans_type, $invoice_no, _("View the GL &Journal Entries for this Invoice")),1); - hyperlink_params("$path_to_root/sales/inquiry/sales_deliveries_view.php", _("Select Another Delivery For Invoicing"), "OutstandingOnly=1"); + hyperlink_params("$path_to_root/sales/inquiry/sales_deliveries_view.php", _("Select Another &Delivery For Invoicing"), "OutstandingOnly=1"); display_footer_exit(); } elseif (isset($_GET['UpdatedID'])) { $invoice_no = $_GET['UpdatedID']; - print_hidden_script(10); display_notification_centered(sprintf(_('Sales Invoice # %d has been updated.'),$invoice_no)); - display_note(get_trans_view_str(10, $invoice_no, _("View This Invoice"))); + display_note(get_trans_view_str(10, $invoice_no, _("&View This Invoice"))); echo '
'; - display_note(print_document_link($invoice_no, _("Print This Invoice"), true, 10)); + display_note(print_document_link($invoice_no, _("&Print This Invoice"), true, 10)); - hyperlink_no_params($path_to_root . "/sales/inquiry/customer_inquiry.php", _("Select A Different Invoice to Modify")); + hyperlink_no_params($path_to_root . "/sales/inquiry/customer_inquiry.php", _("Select A Different &Invoice to Modify")); display_footer_exit(); @@ -79,12 +88,16 @@ if (isset($_GET['AddedID'])) { } } unset($line); + + // Remove also src_doc delivery note + $sources = &$_SESSION['Items']->src_docs; + unset($sources[$_GET['RemoveDN']]); } //----------------------------------------------------------------------------- if ( (isset($_GET['DeliveryNumber']) && ($_GET['DeliveryNumber'] > 0) ) - || isset($_GET['BatchInvoice'])) { +|| isset($_GET['BatchInvoice'])) { processing_start(); @@ -147,6 +160,7 @@ if (isset($_POST['_InvoiceDate_changed'])) { $_POST['InvoiceDate']); $Ajax->activate('due_date'); } + //----------------------------------------------------------------------------- function check_quantities() { @@ -180,6 +194,24 @@ function check_quantities() return $ok; } +function set_delivery_shipping_sum($delivery_notes) +{ + + $shipping = 0; + + foreach($delivery_notes as $delivery_num) + { + $myrow = get_customer_trans($delivery_num, 13); + //$branch = get_branch($myrow["branch_code"]); + //$sales_order = get_sales_order_header($myrow["order_"]); + + //$shipping += $sales_order['freight_cost']; + $shipping += $myrow['ov_freight']; + } + $_POST['ChargeFreightCost'] = price_format($shipping); +} + + function copy_to_cart() { $cart = &$_SESSION['Items']; @@ -199,6 +231,7 @@ function copy_from_cart() $_POST['InvoiceDate']= $cart->document_date; $_POST['due_date'] = $cart->due_date; $_POST['Comments']= $cart->Comments; + $_POST['cart_id'] = $cart->cart_id; } //----------------------------------------------------------------------------- @@ -299,8 +332,10 @@ $dspans[] = $spanlen; //----------------------------------------------------------------------------- $is_batch_invoice = count($_SESSION['Items']->src_docs) > 1; + $is_edition = $_SESSION['Items']->trans_type == 10 && $_SESSION['Items']->trans_no != 0; start_form(false, true); +hidden('cart_id'); start_table("$table_style2 width=80%", 5); @@ -441,6 +476,10 @@ if (!isset($_POST['ChargeFreightCost']) || $_POST['ChargeFreightCost'] == "") { } } +$accumulate_shipping = get_company_pref('accumulate_shipping'); +if ($is_batch_invoice && $accumulate_shipping) + set_delivery_shipping_sum(array_keys($_SESSION['Items']->src_docs)); + start_row(); small_amount_cells(_("Shipping Cost"), 'ChargeFreightCost', null, "colspan=9 align=right"); diff --git a/sales/customer_payments.php b/sales/customer_payments.php index debd1f3a..5c871834 100644 --- a/sales/customer_payments.php +++ b/sales/customer_payments.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $path_to_root=".."; $page_security = 3; include_once($path_to_root . "/includes/session.inc"); @@ -24,8 +33,6 @@ check_db_has_customers(_("There are no customers defined in the system.")); check_db_has_bank_accounts(_("There are no bank accounts defined in the system.")); -check_db_has_bank_trans_types(_("There are no bank payment types defined in the system.")); - //---------------------------------------------------------------------------------------- if ($ret = context_restore()) { if(isset($ret['customer_id'])) @@ -36,7 +43,7 @@ if ($ret = context_restore()) { if (isset($_POST['_customer_id_editor'])) { context_call($path_to_root.'/sales/manage/customers.php?debtor_no='.$_POST['customer_id'], array( 'customer_id', 'BranchID', 'bank_account', 'DateBanked', - 'ReceiptType', 'ref', 'amount', 'discount', 'memo_') ); + 'ref', 'amount', 'discount', 'memo_') ); } if (isset($_GET['AddedID'])) { @@ -44,11 +51,11 @@ if (isset($_GET['AddedID'])) { display_notification_centered(_("The customer payment has been successfully entered.")); - display_note(get_gl_view_str(12, $payment_no, _("View the GL Journal Entries for this Customer Payment"))); + display_note(get_gl_view_str(12, $payment_no, _("&View the GL Journal Entries for this Customer Payment"))); - hyperlink_params($path_to_root . "/sales/allocations/customer_allocate.php", _("Allocate this Customer Payment"), "trans_no=$payment_no&trans_type=12"); + hyperlink_params($path_to_root . "/sales/allocations/customer_allocate.php", _("&Allocate this Customer Payment"), "trans_no=$payment_no&trans_type=12"); - hyperlink_no_params($path_to_root . "/sales/customer_payments.php", _("Enter Another Customer Payment")); + hyperlink_no_params($path_to_root . "/sales/customer_payments.php", _("Enter Another &Customer Payment")); br(1); end_page(); exit; @@ -142,9 +149,8 @@ if (isset($_POST['AddPaymentItem'])) { $rate = input_num('_ex_rate'); $payment_no = write_customer_payment(0, $_POST['customer_id'], $_POST['BranchID'], - $_POST['bank_account'], $_POST['DateBanked'], $_POST['ReceiptType'], $_POST['ref'], + $_POST['bank_account'], $_POST['DateBanked'], $_POST['ref'], input_num('amount'), input_num('discount'), $_POST['memo_'], $rate); - meta_forward($_SERVER['PHP_SELF'], "AddedID=$payment_no"); } @@ -172,10 +178,9 @@ function read_customer_data() function display_item_form() { global $table_style2; - start_table($table_style2, 5, 7); - echo ""; // outer table - echo ""; + start_outer_table($table_style2, 5); + table_section(1); if (!isset($_POST['customer_id'])) $_POST['customer_id'] = get_global_customer(false); @@ -196,8 +201,8 @@ function display_item_form() set_global_customer($_POST['customer_id']); if (isset($_POST['HoldAccount']) && $_POST['HoldAccount'] != 0) { - echo "
"; - display_note(_("This customer account is on hold."), 0, 0, "class='redfb'"); + end_outer_table(); + display_error(_("This customer account is on hold.")); } else { $display_discount_percent = percent_format($_POST['pymt_discount']*100) . "%"; @@ -209,9 +214,7 @@ function display_item_form() date_row(_("Date of Deposit:"), 'DateBanked','',null, 0, 0, 0, null, true); - echo ""; - echo ""; // outer table - echo ""; + table_section(2); bank_accounts_list_row(_("Into Bank Account:"), 'bank_account', null, true); @@ -222,16 +225,11 @@ function display_item_form() exchange_rate_display($bank_currency, $cust_currency, $_POST['DateBanked'], true); } - bank_trans_types_list_row(_("Type:"), 'ReceiptType', null); - text_row(_("Reference:"), 'ref', null, 20, 40); textarea_row(_("Memo:"), 'memo_', null, 22, 4); - echo "
"; - - echo ""; - end_table(); // outer table + end_outer_table(1); if ($cust_currency != $bank_currency) display_note(_("Amount and discount are in customer's currency.")); diff --git a/sales/includes/cart_class.inc b/sales/includes/cart_class.inc index f7540f45..286ada11 100644 --- a/sales/includes/cart_class.inc +++ b/sales/includes/cart_class.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ /* Definition of the cart class this class can hold all the information for: @@ -17,7 +26,7 @@ class cart var $trans_type; // invoice, order, delivery note ... var $trans_no = array();// array (num1=>ver1,..) or 0 for new var $so_type = 0; // for sales order: simple=0 template=1 - + var $cart_id; // used to detect multi-tab edition conflits var $line_items; //array of objects of class line_details var $src_docs = array(); // array of arrays(num1=>ver1,...) or 0 for no src @@ -55,6 +64,14 @@ class cart var $tax_group_name; var $tax_group_array = null; // saves db queries var $price_factor; // ditto for price calculations + + var $pos; // user assigned POS + var $cash; // cash transaction + var $cash_account; + var $account_name; + var $cash_discount; // not used as of FA 2.1 + var $dimension_id; + var $dimension2_id; //------------------------------------------------------------------------- // // $trans_no==0 => open new/direct document @@ -66,7 +83,10 @@ class cart $this->line_items = array(); $this->sales_type = ""; $this->trans_type = 30; + $this->dimension_id = 0; + $this->dimension2_id = 0; $this->read($type, $trans_no, $view ); + $this->cart_id = uniqid(''); } //------------------------------------------------------------------------- @@ -135,10 +155,44 @@ class cart if (!is_date_in_fiscalyear($this->document_date)) $this->document_date = end_fiscalyear(); $this->reference = references::get_next($this->trans_type); - if ($type == 10) + if ($type != 30) // Added 2.1 Joe Hunt 2008-11-12 + { + $dim = get_company_pref('use_dimension'); + if ($dim > 0) + { + if ($this->customer_id == '') + $this->dimension_id = 0; + else + { + $cust = get_customer($this->customer_id); + $this->dimension_id = $cust['dimension_id']; + } + if ($dim > 1) + { + if ($this->customer_id == '') + $this->dimension2_id = 0; + else + $this->dimension2_id = $cust['dimension2_id']; + } + } + } + if ($type == 10) { $this->due_date = get_invoice_duedate($this->customer_id, $this->document_date); - else + $this->pos = user_pos(); + $pos = get_sales_point($this->pos); + $this->cash = !$pos['credit_sale']; + if (!$pos['cash_sale'] || !$pos['credit_sale']) + $this->pos = -1; // mark not editable payment type + else + $this->cash = date_diff($this->due_date, Today(), 'd')<2; + if ($this->cash) { + $this->Location = $pos['pos_location']; + $this->location_name = $pos['location_name']; + $this->cash_account = $pos['pos_account']; + $this->account_name = $pos['bank_account_name']; + } + } else $this->due_date = add_days($this->document_date, sys_prefs::default_delivery_required_by()); } @@ -168,15 +222,11 @@ class cart $this->trans_no = 0; $this->order_no= $this->trans_type==13 ? key($src->trans_no) : $src->order_no; } -// if we want to save old or derivative document first decode html entities -// from text fields. For new documents this is not needed. - if ($this->trans_no || $this->trans_type != 30) { - $this->reference = @html_entity_decode($this->reference); - $this->Comments = @html_entity_decode($this->Comments); - foreach($this->line_items as $lineno => $line) { - $this->line_items[$lineno]->stock_id = @html_entity_decode($line->stock_id); - $this->line_items[$lineno]->description = @html_entity_decode($line->description); - } + $this->reference = @html_entity_decode($this->reference); + $this->Comments = @html_entity_decode($this->Comments); + foreach($this->line_items as $lineno => $line) { + $this->line_items[$lineno]->stock_id = @html_entity_decode($line->stock_id); + $this->line_items[$lineno]->item_description = @html_entity_decode($line->item_description); } switch($this->trans_type) { case 10: @@ -193,11 +243,12 @@ class cart } } - function set_customer($customer_id, $customer_name, $currency, $discount) + function set_customer($customer_id, $customer_name, $currency, $discount, $cdiscount=0) { $this->customer_name = $customer_name; $this->customer_id = $customer_id; $this->default_discount = $discount; + $this->cash_discount = $cdiscount; $this->customer_currency = $currency; } @@ -246,8 +297,10 @@ class cart return 0; } - function update_cart_item($line_no, $qty, $price, $disc) + function update_cart_item($line_no, $qty, $price, $disc, $description="") { + if ($description != "") + $this->line_items[$line_no]->item_description = $description; $this->line_items[$line_no]->quantity = $qty; $this->line_items[$line_no]->qty_dispatched = $qty; $this->line_items[$line_no]->price = $price; diff --git a/sales/includes/db/branches_db.inc b/sales/includes/db/branches_db.inc index 2c4eb522..72a96565 100644 --- a/sales/includes/db/branches_db.inc +++ b/sales/includes/db/branches_db.inc @@ -1,6 +1,14 @@ . +***********************************************************************/ function get_branch($branch_id) { $sql = "SELECT ".TB_PREF."cust_branch.*,".TB_PREF."salesman.salesman_name @@ -34,4 +42,11 @@ function get_branch_name($branch_id) return $myrow[0]; } +function get_cust_branches_from_group($group_no) +{ + $sql = "SELECT branch_code, debtor_no FROM ".TB_PREF."cust_branch + WHERE group_no = '$group_no'"; + + return db_query($sql,"could not retreive branches for group " . $group_no); +} ?> \ No newline at end of file diff --git a/sales/includes/db/credit_status_db.inc b/sales/includes/db/credit_status_db.inc index 0bcabe70..411cdfd5 100644 --- a/sales/includes/db/credit_status_db.inc +++ b/sales/includes/db/credit_status_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ function add_credit_status($description, $disallow_invoicing) { $sql = "INSERT INTO ".TB_PREF."credit_status (reason_description, dissallow_invoices) diff --git a/sales/includes/db/cust_trans_db.inc b/sales/includes/db/cust_trans_db.inc index 95e58897..7beb733c 100644 --- a/sales/includes/db/cust_trans_db.inc +++ b/sales/includes/db/cust_trans_db.inc @@ -1,4 +1,14 @@ . +***********************************************************************/ //------------------------------------------------------------------------------ // Retreive parent document number(s) for given transaction // @@ -79,7 +89,7 @@ function get_customer_trans_version($type, $trans_no) { function write_customer_trans($trans_type, $trans_no, $debtor_no, $BranchNo, $date_, $reference, $Total, $discount=0, $Tax=0, $Freight=0, $FreightTax=0, $sales_type=0, $order_no=0, $trans_link=0, $ship_via=0, $due_date="", - $AllocAmt=0, $rate=0) + $AllocAmt=0, $rate=0, $dimension_id=0, $dimension2_id=0) { $curr = get_customer_currency($debtor_no); @@ -102,13 +112,15 @@ function write_customer_trans($trans_type, $trans_no, $debtor_no, $BranchNo, reference, tpe, order_, ov_amount, ov_discount, ov_gst, ov_freight, ov_freight_tax, - rate, ship_via, alloc, trans_link + rate, ship_via, alloc, trans_link, + dimension_id, dimension2_id ) VALUES ($trans_no, $trans_type, ".db_escape($debtor_no).", ".db_escape($BranchNo).", '$SQLDate', '$SQLDueDate', ".db_escape($reference).", ".db_escape($sales_type).", $order_no, $Total, ".db_escape($discount).", $Tax, ".db_escape($Freight).", - $FreightTax, $rate, ".db_escape($ship_via).", $AllocAmt, ".db_escape($trans_link).")"; + $FreightTax, $rate, ".db_escape($ship_via).", $AllocAmt, ".db_escape($trans_link).", + $dimension_id, $dimension2_id)"; } else { // may be optional argument should stay unchanged ? $sql = "UPDATE ".TB_PREF."debtor_trans SET debtor_no=".db_escape($debtor_no)." , branch_code=".db_escape($BranchNo).", @@ -116,7 +128,8 @@ function write_customer_trans($trans_type, $trans_no, $debtor_no, $BranchNo, reference=".db_escape($reference).", tpe=".db_escape($sales_type).", order_=$order_no, ov_amount=$Total, ov_discount=".db_escape($discount).", ov_gst=$Tax, ov_freight=".db_escape($Freight).", ov_freight_tax=$FreightTax, rate=$rate, - ship_via=".db_escape($ship_via).", alloc=$AllocAmt, trans_link='$trans_link' + ship_via=".db_escape($ship_via).", alloc=$AllocAmt, trans_link=$trans_link, + dimension_id=$dimension_id, dimension2_id=$dimension2_id WHERE trans_no=$trans_no AND type=$trans_type"; } db_query($sql, "The debtor transaction record could not be inserted"); @@ -136,7 +149,7 @@ function get_customer_trans($trans_id, $trans_type) if ($trans_type == systypes::cust_payment()) { // it's a payment so also get the bank account $sql .= ", ".TB_PREF."bank_accounts.bank_name, ".TB_PREF."bank_accounts.bank_account_name, - ".TB_PREF."bank_trans_types.name AS BankTransType "; + ".TB_PREF."bank_accounts.account_type AS BankTransType "; } if ($trans_type == 10 OR $trans_type == 11 OR $trans_type == 13) { @@ -155,7 +168,7 @@ function get_customer_trans($trans_id, $trans_type) if ($trans_type == systypes::cust_payment()) { // it's a payment so also get the bank account - $sql .= ", ".TB_PREF."bank_trans, ".TB_PREF."bank_accounts, ".TB_PREF."bank_trans_types "; + $sql .= ", ".TB_PREF."bank_trans, ".TB_PREF."bank_accounts"; } if ($trans_type == 10 OR $trans_type == 11 OR $trans_type == 13) { @@ -171,8 +184,7 @@ function get_customer_trans($trans_id, $trans_type) // it's a payment so also get the bank account $sql .= " AND ".TB_PREF."bank_trans.trans_no =$trans_id AND ".TB_PREF."bank_trans.type=$trans_type - AND ".TB_PREF."bank_trans_types.id = ".TB_PREF."bank_trans.bank_trans_type_id - AND ".TB_PREF."bank_accounts.account_code=".TB_PREF."bank_trans.bank_act "; + AND ".TB_PREF."bank_accounts.id=".TB_PREF."bank_trans.bank_act "; } if ($trans_type == 10 OR $trans_type == 11 OR $trans_type == 13) { // it's an invoice so also get the shipper @@ -204,32 +216,6 @@ function get_customer_trans($trans_id, $trans_type) //---------------------------------------------------------------------------------------- -function get_customer_transactions($extra_fields=null, $extra_conditions=null, $extra_tables=null) -{ - $sql = "SELECT ".TB_PREF."debtor_trans.*, - ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount AS Total, - ".TB_PREF."debtors_master.name AS DebtorName, ".TB_PREF."debtors_master.address, - ".TB_PREF."debtors_master.curr_code, ".TB_PREF."debtor_trans.version "; - - if ($extra_fields) - $sql .= ", $extra_fields "; - - $sql .= " FROM ".TB_PREF."debtor_trans, ".TB_PREF."debtors_master "; - if ($extra_tables) - $sql .= ",$extra_tables "; - - $sql .= " WHERE ".TB_PREF."debtor_trans.debtor_no=".TB_PREF."debtors_master.debtor_no"; - - if ($extra_conditions) - $sql .= " AND $extra_conditions "; - - $sql .= " ORDER BY trans_no"; - - return db_query($sql, "Cannot retreive debtor transactions"); -} - -//---------------------------------------------------------------------------------------- - function exists_customer_trans($type, $type_no) { $sql = "SELECT trans_no FROM ".TB_PREF."debtor_trans WHERE type=$type diff --git a/sales/includes/db/cust_trans_details_db.inc b/sales/includes/db/cust_trans_details_db.inc index b44c1d5f..17c30c19 100644 --- a/sales/includes/db/cust_trans_details_db.inc +++ b/sales/includes/db/cust_trans_details_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ //---------------------------------------------------------------------------------------- function get_customer_trans_details($debtor_trans_type, $debtor_trans_no) @@ -43,42 +52,6 @@ function void_customer_trans_details($type, $type_no) } //---------------------------------------------------------------------------------------- -function add_customer_trans_tax_detail_item($debtor_trans_type, $debtor_trans_no, - $tax_type_id, $rate, $included_in_price, $amount) -{ - $sql = "INSERT INTO ".TB_PREF."debtor_trans_tax_details (debtor_trans_no, debtor_trans_type, tax_type_id, rate, included_in_price, amount) - VALUES ($debtor_trans_no, $debtor_trans_type, $tax_type_id, $rate, $included_in_price, $amount)"; - - db_query($sql, "The debtor transaction tax detail could not be added"); -} - -//---------------------------------------------------------------------------------------- - -function get_customer_trans_tax_details($debtor_trans_type, $debtor_trans_no) -{ - $sql = "SELECT ".TB_PREF."debtor_trans_tax_details.*, ".TB_PREF."tax_types.name AS tax_type_name - FROM ".TB_PREF."debtor_trans_tax_details,".TB_PREF."tax_types - WHERE debtor_trans_no=$debtor_trans_no - AND debtor_trans_type=$debtor_trans_type - AND amount != 0 - AND ".TB_PREF."tax_types.id = ".TB_PREF."debtor_trans_tax_details.tax_type_id"; - - return db_query($sql, "The debtor transaction tax details could not be queried"); -} - -//---------------------------------------------------------------------------------------- - -function void_customer_trans_tax_details($type, $type_no) -{ - $sql = "UPDATE ".TB_PREF."debtor_trans_tax_details SET amount=0 - WHERE debtor_trans_no=$type_no - AND debtor_trans_type=$type"; - - db_query($sql, "The debtor transaction tax details could not be voided"); -} - -//---------------------------------------------------------------------------------------- - function write_customer_trans_detail_item($debtor_trans_type, $debtor_trans_no, $stock_id, $description, $quantity, $unit_price, $unit_tax, $discount_percent, $std_cost, $line_id=0) { diff --git a/sales/includes/db/custalloc_db.inc b/sales/includes/db/custalloc_db.inc index 8062faf1..e9695bbc 100644 --- a/sales/includes/db/custalloc_db.inc +++ b/sales/includes/db/custalloc_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ //---------------------------------------------------------------------------------------- function add_cust_allocation($amount, $trans_type_from, $trans_no_from, @@ -82,10 +91,43 @@ function clear_cust_alloctions($type, $type_no, $date="") db_query($sql, "could not void debtor transactions for type=$type and trans_no=$type_no"); } +//---------------------------------------------------------------------------------------- + +function get_alloc_trans_sql($extra_fields=null, $extra_conditions=null, $extra_tables=null) +{ + $sql = "SELECT + trans.type, + trans.trans_no, + trans.reference, + trans.tran_date, + debtor.name AS DebtorName, + debtor.curr_code, + ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount AS Total, + trans.alloc, + trans.due_date, + debtor.address, + trans.version "; + + if ($extra_fields) + $sql .= ", $extra_fields "; + + $sql .= " FROM ".TB_PREF."debtor_trans as trans, " + .TB_PREF."debtors_master as debtor"; + if ($extra_tables) + $sql .= ",$extra_tables "; + + $sql .= " WHERE trans.debtor_no=debtor.debtor_no"; + + if ($extra_conditions) + $sql .= " AND $extra_conditions "; + + return $sql; +} + //------------------------------------------------------------------------------------------------------------- -function get_allocatable_from_cust_transactions($customer_id, $settled) +function get_allocatable_from_cust_sql($customer_id, $settled) { $settled_sql = ""; if (!$settled) @@ -94,10 +136,12 @@ function get_allocatable_from_cust_transactions($customer_id, $settled) } $cust_sql = ""; if ($customer_id != null) - $cust_sql = " AND ".TB_PREF."debtor_trans.debtor_no = $customer_id"; + $cust_sql = " AND trans.debtor_no = $customer_id"; - return get_customer_transactions("round(ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount-alloc,6) <= 0 AS settled", - "(type=12 OR type=11 OR type=2) AND (".TB_PREF."debtor_trans.ov_amount > 0) " . $settled_sql . $cust_sql); + $sql = get_alloc_trans_sql("round(ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount-alloc,6) <= 0 AS settled", + "(type=12 OR type=11 OR type=2) AND (trans.ov_amount > 0) " . $settled_sql . $cust_sql); + + return $sql; } //------------------------------------------------------------------------------------------------------------- @@ -106,22 +150,24 @@ function get_allocatable_to_cust_transactions($customer_id, $trans_no=null, $typ { if ($trans_no != null and $type != null) { - return get_customer_transactions("amt", "".TB_PREF."debtor_trans.trans_no = ".TB_PREF."cust_allocations.trans_no_to - AND ".TB_PREF."debtor_trans.type = ".TB_PREF."cust_allocations.trans_type_to - AND ".TB_PREF."cust_allocations.trans_no_from=$trans_no - AND ".TB_PREF."cust_allocations.trans_type_from=$type - AND ".TB_PREF."debtor_trans.debtor_no=$customer_id", - "".TB_PREF."cust_allocations"); + $sql = get_alloc_trans_sql("amt", "trans.trans_no = alloc.trans_no_to + AND trans.type = alloc.trans_type_to + AND alloc.trans_no_from=$trans_no + AND alloc.trans_type_from=$type + AND trans.debtor_no=$customer_id", + "".TB_PREF."cust_allocations as alloc"); } else { - return get_customer_transactions(null, "round(ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount-alloc,6) > 0 - AND ".TB_PREF."debtor_trans.type != " . systypes::cust_payment() . " - AND ".TB_PREF."debtor_trans.type != " . systypes::bank_deposit() . " - AND ".TB_PREF."debtor_trans.type != 11 - AND ".TB_PREF."debtor_trans.type != 13 - AND ".TB_PREF."debtor_trans.debtor_no=$customer_id"); + $sql = get_alloc_trans_sql(null, "round(ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount-alloc,6) > 0 + AND trans.type != " . systypes::cust_payment() . " + AND trans.type != " . systypes::bank_deposit() . " + AND trans.type != 11 + AND trans.type != 13 + AND trans.debtor_no=$customer_id"); } + + return db_query($sql." ORDER BY trans_no", "Cannot retreive alloc to transactions"); } diff --git a/sales/includes/db/customers_db.inc b/sales/includes/db/customers_db.inc index 30cf7b87..db0e47af 100644 --- a/sales/includes/db/customers_db.inc +++ b/sales/includes/db/customers_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ function get_customer_details($customer_id, $to=null) { diff --git a/sales/includes/db/payment_db.inc b/sales/includes/db/payment_db.inc index cda2d68a..12e7cc0f 100644 --- a/sales/includes/db/payment_db.inc +++ b/sales/includes/db/payment_db.inc @@ -1,9 +1,19 @@ . +***********************************************************************/ /* Write/update customer payment. */ function write_customer_payment($trans_no, $customer_id, $branch_id, $bank_account, - $date_, $receipt_type, $ref, $amount, $discount, $memo_, $rate=0) + $date_, $ref, $amount, $discount, $memo_, $rate=0) { begin_transaction(); @@ -12,6 +22,8 @@ function write_customer_payment($trans_no, $customer_id, $branch_id, $bank_accou $payment_no = write_customer_trans(12, $trans_no, $customer_id, $branch_id, $date_, $ref, $amount, $discount, 0, 0, 0, 0, 0, 0, 0, "", 0, $rate); + $bank_gl_account = get_bank_gl_account($bank_account); + if ($trans_no != 0) { delete_comments(12, $trans_no); void_bank_trans(12, $trans_no, true); @@ -21,7 +33,7 @@ function write_customer_payment($trans_no, $customer_id, $branch_id, $bank_accou $total = 0; /* Bank account entry first */ $total += add_gl_trans_customer(12, $payment_no, $date_, - $bank_account, 0, 0, $amount, $customer_id, + $bank_gl_account, 0, 0, $amount, $customer_id, "Cannot insert a GL transaction for the bank account debit", $rate); if ($branch_id != reserved_words::get_any_numeric()) { @@ -54,7 +66,7 @@ function write_customer_payment($trans_no, $customer_id, $branch_id, $bank_accou /*now enter the bank_trans entry */ add_bank_trans(12, $payment_no, $bank_account, $ref, - $date_, $receipt_type, $amount, payment_person_types::customer(), $customer_id, + $date_, $amount, payment_person_types::customer(), $customer_id, get_customer_currency($customer_id)); add_comments(12, $payment_no, $date_, $memo_); diff --git a/sales/includes/db/sales_credit_db.inc b/sales/includes/db/sales_credit_db.inc index dfb4c21b..9172bca5 100644 --- a/sales/includes/db/sales_credit_db.inc +++ b/sales/includes/db/sales_credit_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ //---------------------------------------------------------------------------------------- // if ($writeoff_acc==0) return goods into $cart->Location // if src_docs!=0 => credit invoice else credit note @@ -62,7 +71,8 @@ function write_credit_note($credit_note, $write_off_acc) $credit_note->freight_cost, $freight_added_tax, $credit_note->sales_type, $credit_note->order_no, $credit_invoice, $credit_note->ship_via, - null, $alloc); // 2008-06-14 extra $alloc + null, $alloc, 0, $credit_note->dimension_id, $credit_note->dimension2_id); + // 2008-06-14 extra $alloc, 2008-11-12 dimension_id Joe Hunt if ($trans_no==0) { $credit_note->trans_no = array($credit_no=>0); @@ -72,7 +82,7 @@ function write_credit_note($credit_note, $write_off_acc) void_cust_allocations(11, $credit_no, $credit_date); void_gl_trans(11, $credit_no, true); void_stock_move(11, $credit_no); - void_customer_trans_tax_details(11, $credit_no); + void_trans_tax_details(11, $credit_no); } if ($credit_invoice) { $invoice_alloc_balance = get_DebtorTrans_allocation_balance(10, $credit_invoice); @@ -142,10 +152,12 @@ function write_credit_note($credit_note, $write_off_acc) } foreach ($taxes as $taxitem) { - if ($taxitem['Value'] != 0) { + if ($taxitem['Net'] != 0) { - add_customer_trans_tax_detail_item(11, $credit_no, $taxitem['tax_type_id'], - $taxitem['rate'], $credit_note->tax_included, $taxitem['Value']); + $ex_rate = get_exchange_rate_from_home_currency(get_customer_currency($credit_note->customer_id), $credit_note->document_date); + add_trans_tax_details(11, $credit_no, $taxitem['tax_type_id'], + $taxitem['rate'], $credit_note->tax_included, $taxitem['Value'], + $taxitem['Net'], $credit_note->document_date, $credit_note->reference); $total += add_gl_trans_customer(11, $credit_no, $credit_date, $taxitem['sales_gl_code'], 0, 0, $taxitem['Value'], $credit_note->customer_id, @@ -211,8 +223,10 @@ function add_gl_trans_credit_costs($order, $order_line, $credit_no, $date_, $customer = get_customer($order->customer_id); // 2008-08-01. If there is a Customer Dimension, then override with this, // else take the Item Dimension (if any) - $dim = ($customer['dimension_id'] != 0 ? $customer["dimension_id"] : $stock_gl_codes["dimension_id"]); - $dim2 = ($customer['dimension2_id'] != 0 ? $customer["dimension2_id"] : $stock_gl_codes["dimension2_id"]); + $dim = ($order->dimension_id != $customer['dimension_id'] ? $order->dimension_id : + ($customer['dimension_id'] != 0 ? $customer["dimension_id"] : $stock_gl_codes["dimension_id"])); + $dim2 = ($order->dimension2_id != $customer['dimension2_id'] ? $order->dimension2_id : + ($customer['dimension2_id'] != 0 ? $customer["dimension2_id"] : $stock_gl_codes["dimension2_id"])); $total = 0; /* insert gl_trans to credit stock and debit cost of sales at standard cost*/ diff --git a/sales/includes/db/sales_delivery_db.inc b/sales/includes/db/sales_delivery_db.inc index abbf8bb9..9155c089 100644 --- a/sales/includes/db/sales_delivery_db.inc +++ b/sales/includes/db/sales_delivery_db.inc @@ -1,4 +1,14 @@ . +***********************************************************************/ //----------------------------------------------------------------------------- // insert/update sales delivery // @@ -32,14 +42,14 @@ function write_sales_delivery(&$delivery,$bo_policy) $delivery->freight_cost, $delivery->tax_included ? 0 : $freight_tax, $delivery->sales_type, $delivery->order_no, 0, - $delivery->ship_via, $delivery->due_date); + $delivery->ship_via, $delivery->due_date, 0, 0, $delivery->dimension_id, $delivery->dimension2_id); if ($trans_no == 0) { $delivery->trans_no = array($delivery_no=>0); } else { void_gl_trans(13, $delivery_no, true); void_stock_move(13, $delivery_no); - void_customer_trans_tax_details(13, $delivery_no); + void_trans_tax_details(13, $delivery_no); delete_comments(13, $delivery_no); } @@ -82,8 +92,10 @@ function write_sales_delivery(&$delivery,$bo_policy) /*first the cost of sales entry*/ // 2008-08-01. If there is a Customer Dimension, then override with this, // else take the Item Dimension (if any) - $dim = ($customer['dimension_id'] != 0 ? $customer["dimension_id"] : $stock_gl_code["dimension_id"]); - $dim2 = ($customer['dimension2_id'] != 0 ? $customer["dimension2_id"] : $stock_gl_code["dimension2_id"]); + $dim = ($delivery->dimension_id != $customer['dimension_id'] ? $delivery->dimension_id : + ($customer['dimension_id'] != 0 ? $customer["dimension_id"] : $stock_gl_code["dimension_id"])); + $dim2 = ($delivery->dimension2_id != $customer['dimension2_id'] ? $delivery->dimension2_id : + ($customer['dimension2_id'] != 0 ? $customer["dimension2_id"] : $stock_gl_code["dimension2_id"])); add_gl_trans_std_cost(13, $delivery_no, $delivery->document_date, $stock_gl_code["cogs_account"], $dim, $dim2, "", @@ -112,9 +124,11 @@ function write_sales_delivery(&$delivery,$bo_policy) // taxes - this is for printing purposes foreach ($taxes as $taxitem) { - if ($taxitem['Value'] != 0) { - add_customer_trans_tax_detail_item(13, $delivery_no, $taxitem['tax_type_id'], - $taxitem['rate'], $delivery->tax_included, $taxitem['Value']); + if ($taxitem['Net'] != 0) { + $ex_rate = get_exchange_rate_from_home_currency(get_customer_currency($delivery->customer_id), $delivery->document_date); + add_trans_tax_details(13, $delivery_no, $taxitem['tax_type_id'], + $taxitem['rate'], $delivery->tax_included, $taxitem['Value'], + $taxitem['Net'], $ex_rate, $delivery->document_date, $delivery->reference ); } } @@ -154,7 +168,7 @@ function void_sales_delivery($type, $type_no) // clear details after they've been reversed in the sales order void_customer_trans_details($type, $type_no); - void_customer_trans_tax_details($type, $type_no); + void_trans_tax_details($type, $type_no); void_cust_allocations($type, $type_no); diff --git a/sales/includes/db/sales_invoice_db.inc b/sales/includes/db/sales_invoice_db.inc index 87b9eb7e..de507e63 100644 --- a/sales/includes/db/sales_invoice_db.inc +++ b/sales/includes/db/sales_invoice_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ //----------------------------------------------------------------------------- // Add or update Sales Invoice // @@ -62,7 +71,8 @@ function write_sales_invoice(&$invoice) $invoice->Branch, $date_, $invoice->reference, $items_total, 0, $items_added_tax, $invoice->freight_cost, $freight_added_tax, $invoice->sales_type, $sales_order, $delivery_no, - $invoice->ship_via, $invoice->due_date, $alloc); // 2008-06-14 extra $alloc + $invoice->ship_via, $invoice->due_date, $alloc, 0, $invoice->dimension_id, $invoice->dimension2_id); + // 2008-06-14 extra $alloc, 2008-11-12 added dimension_id Joe Hunt if ($trans_no == 0) { $invoice->trans_no = array($invoice_no=>0); @@ -71,7 +81,7 @@ function write_sales_invoice(&$invoice) delete_comments(10, $invoice_no); void_gl_trans(10, $invoice_no, true); void_cust_allocations(10, $invoice_no); // ? - void_customer_trans_tax_details(10, $invoice_no); + void_trans_tax_details(10, $invoice_no); } $total = 0; foreach ($invoice->line_items as $invoice_line) { @@ -105,8 +115,10 @@ function write_sales_invoice(&$invoice) $sales_account = ($branch_data['sales_account'] != "" ? $branch_data['sales_account'] : $stock_gl_code['sales_account']); // 2008-08-01. If there is a Customer Dimension, then override with this, // else take the Item Dimension (if any) - $dim = ($customer['dimension_id'] != 0 ? $customer["dimension_id"] : $stock_gl_code["dimension_id"]); - $dim2 = ($customer['dimension2_id'] != 0 ? $customer["dimension2_id"] : $stock_gl_code["dimension2_id"]); + $dim = ($invoice->dimension_id != $customer['dimension_id'] ? $invoice->dimension_id : + ($customer['dimension_id'] != 0 ? $customer["dimension_id"] : $stock_gl_code["dimension_id"])); + $dim2 = ($invoice->dimension2_id != $customer['dimension2_id'] ? $invoice->dimension2_id : + ($customer['dimension2_id'] != 0 ? $customer["dimension2_id"] : $stock_gl_code["dimension2_id"])); $total += add_gl_trans_customer(10, $invoice_no, $date_, $sales_account, $dim, $dim2, (-$line_taxfree_price * $invoice_line->qty_dispatched), $invoice->customer_id, "The sales price GL posting could not be inserted"); @@ -135,9 +147,12 @@ function write_sales_invoice(&$invoice) } // post all taxes foreach ($taxes as $taxitem) { - if ($taxitem['Value'] != 0) { - add_customer_trans_tax_detail_item(10, $invoice_no, $taxitem['tax_type_id'], - $taxitem['rate'], $invoice->tax_included, $taxitem['Value']); + + if ($taxitem['Net'] != 0) { + $ex_rate = get_exchange_rate_from_home_currency(get_customer_currency($invoice->customer_id), $date_); + add_trans_tax_details(10, $invoice_no, $taxitem['tax_type_id'], + $taxitem['rate'], $invoice->tax_included, $taxitem['Value'], + $taxitem['Net'], $ex_rate, $date_, $invoice->reference); $total += add_gl_trans_customer(10, $invoice_no, $date_, $taxitem['sales_gl_code'], 0, 0, (-$taxitem['Value']), $invoice->customer_id, @@ -152,8 +167,24 @@ function write_sales_invoice(&$invoice) if ($trans_no == 0) { references::save_last($invoice->reference, 10); + if ($invoice->cash) { + $amount = $items_total + $items_added_tax + $invoice->freight_cost + + $freight_added_tax; + + // to use debtors.pmt_discount on cash sale: + // extend invoice entry page with final amount after discount + // and change line below. + $discount = 0; // $invoice->cash_discount*$amount; + $pmtno = write_customer_payment(0, $invoice->customer_id, + $invoice->Branch, $invoice->cash_account, $date_, + references::get_next(12), $amount-$discount, $discount, + _('Cash invoice').' '.$invoice->trans_no); + add_cust_allocation($amount, 12, $pmtno, 10, $invoice_no); + + update_debtor_trans_allocation(10, $invoice_no, $amount); + update_debtor_trans_allocation(12, $pmtno, $amount); + } } - commit_transaction(); return $invoice_no; @@ -183,7 +214,7 @@ function void_sales_invoice($type, $type_no) // clear details after they've been reversed in the sales order void_customer_trans_details($type, $type_no); - void_customer_trans_tax_details($type, $type_no); + void_trans_tax_details($type, $type_no); void_cust_allocations($type, $type_no); diff --git a/sales/includes/db/sales_order_db.inc b/sales/includes/db/sales_order_db.inc index 34e4ad9d..7d650280 100644 --- a/sales/includes/db/sales_order_db.inc +++ b/sales/includes/db/sales_order_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ //---------------------------------------------------------------------------------------- function get_demand_qty($stockid, $location) { @@ -60,7 +69,7 @@ function add_sales_order(&$order) db_escape($order->Comments) .",'" . date2sql($order->document_date) . "', " . db_escape($order->sales_type) . ", " . - $_POST['ship_via'] ."," . + db_escape($order->ship_via)."," . db_escape($order->deliver_to) . "," . db_escape($order->delivery_address) . ", " . db_escape($order->phone) . ", " . @@ -450,11 +459,14 @@ function get_customer_to_order($customer_id) { .TB_PREF."debtors_master.address, " .TB_PREF."credit_status.dissallow_invoices, " .TB_PREF."debtors_master.sales_type AS salestype, " + .TB_PREF."debtors_master.dimension_id, " + .TB_PREF."debtors_master.dimension2_id, " .TB_PREF."sales_types.sales_type, " .TB_PREF."sales_types.tax_included, " .TB_PREF."sales_types.factor, " .TB_PREF."debtors_master.curr_code, " - .TB_PREF."debtors_master.discount + .TB_PREF."debtors_master.discount," + .TB_PREF."debtors_master.pymt_discount FROM ".TB_PREF."debtors_master, " .TB_PREF."credit_status, " .TB_PREF."sales_types diff --git a/sales/includes/db/sales_types_db.inc b/sales/includes/db/sales_types_db.inc index 85c83420..f5237476 100644 --- a/sales/includes/db/sales_types_db.inc +++ b/sales/includes/db/sales_types_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ function add_sales_type($name, $tax_included, $factor) { $sql = "INSERT INTO ".TB_PREF."sales_types (sales_type,tax_included,factor) VALUES (".db_escape($name).",'$tax_included',$factor)"; diff --git a/sales/includes/sales_db.inc b/sales/includes/sales_db.inc index 579bbb9a..4a746940 100644 --- a/sales/includes/sales_db.inc +++ b/sales/includes/sales_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ include_once($path_to_root . "/includes/banking.inc"); include_once($path_to_root . "/includes/db/inventory_db.inc"); include_once($path_to_root . "/sales/includes/db/sales_order_db.inc"); @@ -7,6 +16,7 @@ include_once($path_to_root . "/sales/includes/db/sales_credit_db.inc"); include_once($path_to_root . "/sales/includes/db/sales_invoice_db.inc"); include_once($path_to_root . "/sales/includes/db/sales_delivery_db.inc"); include_once($path_to_root . "/sales/includes/db/sales_types_db.inc"); +include_once($path_to_root . "/sales/includes/db/sales_points_db.inc"); include_once($path_to_root . "/sales/includes/db/custalloc_db.inc"); include_once($path_to_root . "/sales/includes/db/cust_trans_db.inc"); include_once($path_to_root . "/sales/includes/db/cust_trans_details_db.inc"); @@ -58,11 +68,11 @@ function get_price ($stock_id, $currency, $sales_type_id, $factor=null, $date=nu $factor = $myrow['factor']; } - $sql = "SELECT ".TB_PREF."prices.price + $sql = "SELECT price FROM ".TB_PREF."prices - WHERE ".TB_PREF."prices.stock_id = '" . $stock_id . "' " - ." AND ".TB_PREF."prices.sales_type_id = " . $sales_type_id - ." AND ".TB_PREF."prices.curr_abrev = '$currency'"; + WHERE stock_id = '" . $stock_id . "' " + ." AND sales_type_id = " . $sales_type_id + ." AND curr_abrev = '$currency'"; $msg = "There was a problem retrieving the pricing information for the part $stock_id for customer"; $result = db_query($sql, $msg); @@ -72,7 +82,7 @@ function get_price ($stock_id, $currency, $sales_type_id, $factor=null, $date=nu $myrow = db_fetch_row($result); return $myrow[0]; } - if ($factor == 0) return 0; // auto price calculations off for current pricelist + if ($factor == 0) return false; // auto price calculations off $base_id = get_base_sales_type(); if ($base_id <= 0) return 0; // auto price calculations off @@ -81,14 +91,13 @@ function get_price ($stock_id, $currency, $sales_type_id, $factor=null, $date=nu // get all prices which we can use to guess the price. // alternative is make up to 2 additional sql queries - $sql = "SELECT ".TB_PREF."prices.price,".TB_PREF."prices.curr_abrev, - ".TB_PREF."prices.sales_type_id + $sql = "SELECT price, curr_abrev, sales_type_id FROM ".TB_PREF."prices - WHERE ".TB_PREF."prices.stock_id = '" . $stock_id . "' " - ." AND (".TB_PREF."prices.sales_type_id = " . $sales_type_id - ." OR ".TB_PREF."prices.sales_type_id = " . $base_id.")" - ." AND (".TB_PREF."prices.curr_abrev = '$currency'" - ." OR ".TB_PREF."prices.curr_abrev = '$home_curr')"; + WHERE stock_id = '" . $stock_id . "' " + ." AND (sales_type_id = " . $sales_type_id + ." OR sales_type_id = " . $base_id.")" + ." AND (curr_abrev = '$currency'" + ." OR curr_abrev = '$home_curr')"; $result = db_query($sql, $msg); @@ -100,7 +109,7 @@ function get_price ($stock_id, $currency, $sales_type_id, $factor=null, $date=nu $rate = round(get_exchange_rate_from_home_currency($currency, $date), user_exrate_dec()); - $price = 0.00; + $price = false; if (isset($prices[$sales_type_id][$home_curr])) { @@ -108,14 +117,49 @@ function get_price ($stock_id, $currency, $sales_type_id, $factor=null, $date=nu } elseif (isset($prices[$base_id][$currency])) { - $price =$prices[$base_id][$currency] * $factor; + $price = $prices[$base_id][$currency] * $factor; } elseif (isset($prices[$base_id][$home_curr])) { - $price =$prices[$base_id][$home_curr] * $factor / $rate; + $price = $prices[$base_id][$home_curr] * $factor / $rate; } - return round($price, user_price_dec()); + return $price === false ? false : round($price, user_price_dec()); +} +//---------------------------------------------------------------------------------------- +// +// Get price for given item or kit. +// When $std==true price is calculated as a sum of all included stock items, +// otherwise all prices set for kits and items are accepted. +// +function get_kit_price($item_code, $currency, $sales_type_id, $factor=null, + $date=null, $std = false) +{ + $kit_price = 0.00; + if (!$std) { + $kit_price = get_price( $item_code, $currency, $sales_type_id, + $factor, $date); + + if ($kit_price !== false) { + return $kit_price; + } + } + // no price for kit found, get total value of all items + $kit = get_item_kit($item_code); + + while($item = db_fetch($kit)) { + if ($item['item_code'] != $item['stock_id']) { + // foreign/kit code + $kit_price += $item['quantity'] * get_kit_price( $item['stock_id'], + $currency, $sales_type_id, $factor, $date, $std); + + } else { + // stock item + $kit_price += $item['quantity'] * get_price( $item['stock_id'], + $currency, $sales_type_id, $factor, $date); + } + } + return $kit_price; } //----------------------------------------------------------------------------- @@ -241,7 +285,8 @@ function read_sales_trans($doc_type, $trans_no, &$cart) $cart->trans_link = $myrow["trans_link"]; $cart->due_date = sql2date($myrow["due_date"]); $cart->document_date = sql2date($myrow["tran_date"]); - + $cart->dimension_id = $myrow['dimension_id']; // added 2.1 Joe Hunt 2008-11-12 + $cart->dimension2_id = $myrow['dimension2_id']; $cart->Comments = ''; foreach ( $trans_no as $trans ) { $coms = get_comments($doc_type,$trans); @@ -270,7 +315,8 @@ function read_sales_trans($doc_type, $trans_no, &$cart) $result = get_customer_trans_details($doc_type,$trans_no); if (db_num_rows($result) > 0) { for($line_no=0; $myrow = db_fetch($result); $line_no++) { - $cart->add_to_cart($line_no,$myrow["stock_id"],$myrow["quantity"], + $cart->line_items[$line_no] = new line_details( + $myrow["stock_id"],$myrow["quantity"], $myrow["unit_price"], $myrow["discount_percent"], $myrow["qty_done"], $myrow["standard_cost"], $myrow["StockDescription"],$myrow["id"], $myrow["debtor_trans_no"]); diff --git a/sales/includes/sales_ui.inc b/sales/includes/sales_ui.inc index 64045bb1..7e7f7afd 100644 --- a/sales/includes/sales_ui.inc +++ b/sales/includes/sales_ui.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ include_once($path_to_root . "/includes/date_functions.inc"); include_once($path_to_root . "/includes/ui.inc"); @@ -27,5 +36,19 @@ function processing_active() { return (isset($_SESSION['Processing']) && $_SESSION['Processing']==$_SERVER['PHP_SELF']); } +/* + Check if the cart was not destroyed during opening the edition page in + another browser tab. +*/ +function check_edit_conflicts($cartname='Items') +{ + global $Ajax; + + if (isset($_POST['cart_id']) && $_POST['cart_id'] != $_SESSION[$cartname]->cart_id) { + display_error(_('This edit session has been abandoned by opening sales document in another browser tab. You cannot edit more than one sales document at once.')); + $Ajax->activate('_page_body'); + display_footer_exit(); + } +} ?> \ No newline at end of file diff --git a/sales/includes/ui/sales_credit_ui.inc b/sales/includes/ui/sales_credit_ui.inc index 5af7227b..4594758c 100644 --- a/sales/includes/ui/sales_credit_ui.inc +++ b/sales/includes/ui/sales_credit_ui.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ include_once($path_to_root . "/includes/ui.inc"); // ------------------------------------------------------------------------------ @@ -7,9 +16,9 @@ include_once($path_to_root . "/includes/ui.inc"); function display_credit_header(&$order) { global $table_style, $Ajax; - start_table("width=80% $table_style"); - echo ""; // outer table - echo ""; + + start_outer_table("width=80% $table_style"); + table_section(1); $customer_error = ""; $change_prices = 0; @@ -58,36 +67,37 @@ function display_credit_header(&$order) $Ajax->activate('sales_type_id'); $change_prices = 1; } + if ($old_order->dimension_id != $order->dimension_id) { + $_POST['dimension_id'] = $order->dimension_id; + $Ajax->activate('dimension_id'); + } + if ($old_order->dimension2_id != $order->dimension2_id) { + $_POST['dimension2_id'] = $order->dimension2_id; + $Ajax->activate('dimension2_id'); + } unset($old_order); } set_global_customer($_POST['customer_id']); if (!isset($_POST['ref'])) $_POST['ref'] = references::get_next(11); - if ($_SESSION['Items']->trans_no==0) + if ($order->trans_no==0) ref_row(_("Reference").':', 'ref'); else label_row(_("Reference").':', $_POST['ref'] ); - - echo "
"; - - echo ""; // outer table - if (!is_company_currency($order->customer_currency)) { + table_section(2); + div_start('currency'); - echo ""; label_row(_("Customer Currency:"), $order->customer_currency); exchange_rate_display($order->customer_currency, get_company_currency(), $_POST['OrderDate']); - echo "
"; - echo ""; // outer table div_end(); } - - echo ""; + table_section(3); if (!isset($_POST['sales_type_id'])) $_POST['sales_type_id'] = $order->sales_type; @@ -101,12 +111,11 @@ function display_credit_header(&$order) $change_prices = 1; } - label_row(_("Customer Discount:"), ($order->default_discount * 100) . "%"); - echo "
"; + shippers_list_row(_("Shipping Company:"), 'ShipperID', $order->ship_via); - echo ""; // outer table + label_row(_("Customer Discount:"), ($order->default_discount * 100) . "%"); - echo ""; + table_section(4); if (!isset($_POST['OrderDate']) || $_POST['OrderDate'] == "") $_POST['OrderDate'] = $order->document_date; @@ -119,13 +128,20 @@ function display_credit_header(&$order) } $Ajax->activate('currency'); } - shippers_list_row(_("Shipping Company:"), 'ShipperID', $order->ship_via); - - echo "
"; - - echo ""; + // 2008-11-12 Joe Hunt added dimensions + $dim = get_company_pref('use_dimension'); + if ($dim > 0) + dimensions_list_row(_("Dimension").":", 'dimension_id', + null, true, ' ', false, 1, false); + else + hidden('dimension_id', 0); + if ($dim > 1) + dimensions_list_row(_("Dimension")." 2:", 'dimension2_id', + null, true, ' ', false, 2, false); + else + hidden('dimension2_id', 0); - end_table(1); // outer table + end_outer_table(1); // outer table if ($change_prices != 0) { foreach ($order->line_items as $line_no=>$item) { @@ -177,12 +193,12 @@ function display_credit_items($title, &$order) label_cell($line->units); amount_cell($line->price); - amount_cell($line->discount_percent * 100); + percent_cell($line->discount_percent * 100); amount_cell($line_total); edit_button_cell("Edit$line_no", _('Edit'), _('Edit document line')); - edit_button_cell("Delete$line_no", _('Delete'), + delete_button_cell("Delete$line_no", _('Delete'), _('Remove line from document')); end_row(); @@ -209,7 +225,7 @@ function display_credit_items($title, &$order) $taxes = $order->get_taxes($_POST['ChargeFreightCost']); - $tax_total = display_edit_tax_items($taxes, 6, $_SESSION['Items']->tax_included); + $tax_total = display_edit_tax_items($taxes, 6, $order->tax_included); $display_total = price_format(($subtotal + $_POST['ChargeFreightCost'] + $tax_total)); @@ -250,8 +266,9 @@ function credit_edit_item_controls(&$order, $rowcounter, $line_no=-1) } $item_info = get_item_edit_info($_POST['stock_id']); + $dec = $item_info['decimals']; + $_POST['qty'] = number_format2(0, $dec); $_POST['units'] = $item_info["units"]; - $_POST['qty'] = qty_format(0, $_POST['stock_id'], $dec); $_POST['price'] = price_format(get_price($_POST['stock_id'], $order->customer_currency, $order->sales_type, $order->price_factor, $order->document_date)); @@ -269,10 +286,10 @@ function credit_edit_item_controls(&$order, $rowcounter, $line_no=-1) if ($id!=-1) { - edit_button_cell('UpdateItem', _("Update"), - _('Confirm changes')); - edit_button_cell('CancelItemChanges', _("Cancel"), - _('Cancel changes')); + button_cell('UpdateItem', _("Update"), + _('Confirm changes'), ICON_UPDATE); + button_cell('CancelItemChanges', _("Cancel"), + _('Cancel changes'), ICON_CANCEL); hidden('line_no', $line_no); set_focus('qty'); } @@ -288,7 +305,7 @@ function credit_edit_item_controls(&$order, $rowcounter, $line_no=-1) //--------------------------------------------------------------------------------- -function credit_options_controls() +function credit_options_controls($credit) { global $table_style2, $Ajax; echo "
"; @@ -306,7 +323,7 @@ if (isset($_POST['_CreditType_update'])) /*if the credit note is a return of goods then need to know which location to receive them into */ if (!isset($_POST['Location'])) - $_POST['Location'] = $_SESSION['Items']->Location; + $_POST['Location'] = $credit->Location; locations_list_row(_("Items Returned to Location"), 'Location', $_POST['Location']); } else diff --git a/sales/includes/ui/sales_order_ui.inc b/sales/includes/ui/sales_order_ui.inc index 29459dc8..28b079cd 100644 --- a/sales/includes/ui/sales_order_ui.inc +++ b/sales/includes/ui/sales_order_ui.inc @@ -1,24 +1,72 @@ . +***********************************************************************/ include_once($path_to_root . "/sales/includes/cart_class.inc"); include_once($path_to_root . "/includes/manufacturing.inc"); //-------------------------------------------------------------------------------- function add_to_order(&$order, $new_item, $new_item_qty, $price, $discount) { + // calculate item price to sum of kit element prices factor for + // value distribution over all exploded kit items + $std_price = get_kit_price($new_item, $order->customer_currency, + $order->sales_type, $order->price_factor, get_post('OrderDate'), true); - foreach ($order->line_items AS $order_item) - { - if (strcasecmp($order_item->stock_id, $new_item) == 0) + if ($std_price == 0) + $price_factor = 0; + else + $price_factor = $price/$std_price; + + $kit = get_item_kit($new_item); + $item_num = db_num_rows($kit); + + while($item = db_fetch($kit)) { + $std_price = get_kit_price($item['stock_id'], $order->customer_currency, + $order->sales_type, $order->price_factor, get_post('OrderDate'), true); + + // rounding differences are included in last price item in kit + $item_num--; + if ($item_num) { + $price -= $item['quantity']*$std_price*$price_factor; + $item_price = $std_price*$price_factor; + } else { + if ($item['quantity']) + $price = $price/$item['quantity']; + $item_price = $price; + } + $item_price = round($item_price, user_price_dec()); + + if (!$item['is_foreign'] && $item['item_code'] != $item['stock_id']) + { // this is sales kit - recurse + add_to_order($order, $item['stock_id'], $new_item_qty*$item['quantity'], + $item_price, $discount, $std_price); + } + else + { // stock item record eventually with foreign code + + // check duplicate stock item + foreach ($order->line_items as $order_item) { - display_notification(_("For Part :") . $new_item . " " . _("This item is already on this order. You have been warned.")); - break; + if (strcasecmp($order_item->stock_id, $item['stock_id']) == 0) + { + display_warning(_("For Part :").$item['stock_id']. " " + . _("This item is already on this order. You have been warned.")); + break; + } } + $order->add_to_cart (count($order->line_items), $item['stock_id'], + $new_item_qty*$item['quantity'], $item_price, $discount); + } } - - $order->add_to_cart (count($order->line_items),$new_item, $new_item_qty, $price, $discount); } - //--------------------------------------------------------------------------------- function get_customer_details_to_order(&$order, $customer_id, $branch_id) @@ -32,40 +80,50 @@ function get_customer_details_to_order(&$order, $customer_id, $branch_id) if ($myrow['dissallow_invoices'] == 1) $ret_error = _("The selected customer account is currently on hold. Please contact the credit control personnel to discuss."); - $deliver = $myrow['address']; // in case no delivery address. + $deliver = $myrow['address']; // in case no branch address use company address - $order->set_customer($customer_id, $name, $myrow['curr_code'], $myrow['discount']); + $order->set_customer($customer_id, $name, $myrow['curr_code'], + $myrow['discount'], $myrow['pymt_discount']); // the sales type determines the price list to be used by default $order->set_sales_type($myrow['salestype'], $myrow['sales_type'], $myrow['tax_included'], $myrow['factor']); -// if ($order->Branch != 0) + if ($order->trans_type != 30) { - $result = get_branch_to_order($customer_id, $branch_id); + $order->dimension_id = $myrow['dimension_id']; + $order->dimension2_id = $myrow['dimension2_id']; + } + $result = get_branch_to_order($customer_id, $branch_id); - if (db_num_rows($result) == 0) - { + if (db_num_rows($result) == 0) + { return _("The selected customer and branch are not valid, or the customer does not have any branches."); - } - - $myrow = db_fetch($result); + } - $order->set_branch($branch_id, $myrow["tax_group_id"], - $myrow["tax_group_name"], $myrow["phone"], $myrow["email"]); + $myrow = db_fetch($result); - $address = $myrow["br_post_address"]; + $order->set_branch($branch_id, $myrow["tax_group_id"], + $myrow["tax_group_name"], $myrow["phone"], $myrow["email"]); - if (strlen($address) <= 1) // if branch has no address - $address = $deliver; // set sales order address + $address = trim($myrow["br_post_address"]) != '' ? $myrow["br_post_address"] + : (trim($myrow["br_address"]) != '' ? $myrow["br_address"]:$deliver); - $order->set_location($myrow["default_location"], $myrow["location_name"]); - $order->set_delivery($myrow["default_ship_via"], $myrow["br_name"], + $order->set_delivery($myrow["default_ship_via"], $myrow["br_name"], $address); - if ($order->trans_type == 10) - $order->due_date = get_invoice_duedate($customer_id, $order->document_date); + if ($order->trans_type == 10) { + $order->due_date = get_invoice_duedate($customer_id, $order->document_date); + if ($order->pos != -1) + $order->cash = date_diff($order->due_date, Today(), 'd')<2; } - + if($order->cash ) { + if($order->pos != -1) { + $paym = get_sales_point($order->pos); + $order->set_location($paym["pos_location"], $paym["location_name"]); + } + } else + $order->set_location($myrow["default_location"], $myrow["location_name"]); + return $ret_error; } @@ -73,7 +131,7 @@ function get_customer_details_to_order(&$order, $customer_id, $branch_id) function display_order_summary($title, &$order, $editable_items=false) { - global $table_style, $path_to_root, $Ajax; + global $table_style, $path_to_root; display_heading($title); @@ -109,7 +167,8 @@ function display_order_summary($title, &$order, $editable_items=false) view_stock_status_cell($stock_item->stock_id); - label_cell($stock_item->item_description, "nowrap" ); + //label_cell($stock_item->item_description, "nowrap" ); + label_cell($stock_item->item_description ); qty_cell($stock_item->qty_dispatched, false, get_qty_dec($stock_item->stock_id)); if ($order->trans_no!=0) @@ -125,7 +184,7 @@ function display_order_summary($title, &$order, $editable_items=false) { edit_button_cell("Edit$line_no", _("Edit"), _('Edit document line')); - edit_button_cell("Delete$line_no", _("Delete"), + delete_button_cell("Delete$line_no", _("Delete"), _('Remove line from document')); } end_row(); @@ -155,10 +214,10 @@ function display_order_header(&$order, $editable, $date_text, $display_tax_group { global $table_style, $Ajax; - start_table("width=80% $table_style"); - echo ""; // outer table - echo ""; + start_outer_table("width=80% $table_style"); + table_section(1); + $customer_error = ""; $change_prices = 0; @@ -169,6 +228,10 @@ function display_order_header(&$order, $editable, $date_text, $display_tax_group hidden('customer_id', $order->customer_id); hidden('branch_id', $order->Branch); hidden('sales_type', $order->sales_type); + if ($order->trans_type != 30) { + hidden('dimension_id', $order->dimension_id); // 2008-11-12 Joe Hunt + hidden('dimension2_id', $order->dimension2_id); + } } else { @@ -207,15 +270,21 @@ function display_order_header(&$order, $editable, $date_text, $display_tax_group $_POST['deliver_to'] = $order->deliver_to; $_POST['delivery_address'] = $order->delivery_address; $_POST['phone'] = $order->phone; - if ($order->trans_type == 10) - { - $_POST['delivery_date'] = $order->due_date; - $Ajax->activate('delivery_date'); + if (get_post('cash') !== $order->cash) { + $_POST['cash'] = $order->cash; + $Ajax->activate('delivery'); + $Ajax->activate('cash'); + } else { + if ($order->trans_type == 10) + { + $_POST['delivery_date'] = $order->due_date; + $Ajax->activate('delivery_date'); + } + $Ajax->activate('Location'); + $Ajax->activate('deliver_to'); + $Ajax->activate('phone'); + $Ajax->activate('delivery_address'); } - $Ajax->activate('Location'); - $Ajax->activate('deliver_to'); - $Ajax->activate('phone'); - $Ajax->activate('delivery_address'); // change prices if necessary // what about discount in template case? if ($old_order->customer_currency != $order->customer_currency) { @@ -227,6 +296,14 @@ function display_order_header(&$order, $editable, $date_text, $display_tax_group $Ajax->activate('sales_type'); $change_prices = 1; } + if ($old_order->dimension_id != $order->dimension_id) { + $_POST['dimension_id'] = $order->dimension_id; + $Ajax->activate('dimension_id'); + } + if ($old_order->dimension2_id != $order->dimension2_id) { + $_POST['dimension2_id'] = $order->dimension2_id; + $Ajax->activate('dimension2_id'); + } unset($old_order); } set_global_customer($_POST['customer_id']); @@ -240,28 +317,42 @@ function display_order_header(&$order, $editable, $date_text, $display_tax_group } } - if ($_SESSION['Items']->trans_type!=30) { + if ($order->trans_type != 30) { ref_cells(_("Reference").':', 'ref', _('Reference number unique for this document type'), null, ''); } - echo "
"; - - echo ""; // outer table - if (!is_company_currency($order->customer_currency)) { + table_section(2); + div_start('currency'); - echo ""; label_row(_("Customer Currency:"), $order->customer_currency); exchange_rate_display($order->customer_currency, get_company_currency(), ($editable ? $_POST['OrderDate'] : $order->document_date)); - echo "
"; div_end(); - echo ""; // outer table } + table_section(3); + + if ($order->trans_type == 10 && $order->pos != -1) { + sale_payment_list_cells(_('Payment:'), 'cash', null, true); + $cash_payment = get_post('cash', 0); + // current user can issue both credit and cash invoices + if ($order->cash != $cash_payment) { + $order->cash = $cash_payment; + if ($cash_payment) { + $paym = get_sales_point(user_pos()); + $order->cash_account = $paym['pos_account']; + $order->account_name = $paym['bank_account_name']; + $_POST['Location'] = $order->Location = $paym['pos_location']; + $order->location_name = $paym['location_name']; + } + check_qoh($order); + $Ajax->activate('delivery'); + set_focus($order->pos == -1 ? 'delivery_date' : 'account'); + } + } else + hidden('cash', $order->cash); - - echo ""; if($editable) { $str = sales_types_list_row(_("Price List"), 'sales_type', null, true); } else { @@ -276,11 +367,8 @@ function display_order_header(&$order, $editable, $date_text, $display_tax_group } label_row(_("Customer Discount:"), ($order->default_discount * 100) . "%"); - echo "
"; - - echo ""; // outer table - - echo ""; + + table_section(4); if ($editable) { @@ -301,6 +389,20 @@ function display_order_header(&$order, $editable, $date_text, $display_tax_group $_POST['delivery_date'] = add_days(get_post('OrderDate'), sys_prefs::default_delivery_required_by()); $Ajax->activate('delivery_date'); } + if ($order->trans_type != 30) + { // 2008-11-12 Joe Hunt added dimensions + $dim = get_company_pref('use_dimension'); + if ($dim > 0) + dimensions_list_row(_("Dimension").":", 'dimension_id', + null, true, ' ', false, 1, false); + else + hidden('dimension_id', 0); + if ($dim > 1) + dimensions_list_row(_("Dimension")." 2:", 'dimension2_id', + null, true, ' ', false, 2, false); + else + hidden('dimension2_id', 0); + } } else { @@ -311,18 +413,15 @@ function display_order_header(&$order, $editable, $date_text, $display_tax_group if ($display_tax_group) { label_row(_("Tax Group:"), $order->tax_group_name); - hidden('tax_group_id', $_SESSION['Items']->tax_group_id); + hidden('tax_group_id', $order->tax_group_id); } - echo "
"; - - echo ""; - end_table(1); // outer table + end_outer_table(1); // outer table if ($change_prices != 0) { foreach ($order->line_items as $line_no=>$item) { $line = &$order->line_items[$line_no]; - $line->price = get_price($line->stock_id, $order->customer_currency, + $line->price = get_kit_price($line->stock_id, $order->customer_currency, $order->sales_type, $order->price_factor, get_post('OrderDate')); // $line->discount_percent = $order->default_discount; } @@ -341,22 +440,24 @@ function sales_order_item_controls(&$order, &$rowcounter, $line_no=-1) alt_table_row_color($rowcounter); $id = find_submit('Edit'); - if ($line_no!=-1 && $line_no == $id) + if ($line_no!=-1 && $line_no == $id) // edit old line { $_POST['stock_id'] = $order->line_items[$id]->stock_id; $dec = get_qty_dec($_POST['stock_id']); $_POST['qty'] = number_format2($order->line_items[$id]->qty_dispatched, $dec); $_POST['price'] = price_format($order->line_items[$id]->price); $_POST['Disc'] = percent_format($order->line_items[$id]->discount_percent*100); + $_POST['item_description'] = $order->line_items[$id]->item_description; $units = $order->line_items[$id]->units; hidden('stock_id', $_POST['stock_id']); label_cell($_POST['stock_id']); - label_cell($order->line_items[$line_no]->item_description, "nowrap"); + text_cells(null,'item_description', null, 45, 150); + //label_cell($order->line_items[$line_no]->item_description, "nowrap"); $Ajax->activate('items_table'); } - else + else // prepare new line { - stock_items_list_cells(null,'stock_id', null, false, true); + sales_items_list_cells(null,'stock_id', null, false, true); if (list_updated('stock_id')) { $Ajax->activate('price'); $Ajax->activate('units'); @@ -366,15 +467,14 @@ function sales_order_item_controls(&$order, &$rowcounter, $line_no=-1) $item_info = get_item_edit_info($_POST['stock_id']); $units = $item_info["units"]; - $dec = get_qty_dec($_POST['stock_id']); + $dec = $item_info['decimals']; $_POST['qty'] = number_format2(1, $dec); - - $_POST['price'] = price_format(get_price ($_POST['stock_id'], + $price = get_kit_price($_POST['stock_id'], $order->customer_currency, $order->sales_type, - $order->price_factor, get_post('OrderDate'))); + $order->price_factor, get_post('OrderDate')); + $_POST['price'] = price_format($price); // default to the customer's discount % $_POST['Disc'] = percent_format($order->default_discount * 100); - } qty_cells(null, 'qty', $_POST['qty'], null, null, $dec); @@ -395,10 +495,10 @@ function sales_order_item_controls(&$order, &$rowcounter, $line_no=-1) if ($id!=-1) { - edit_button_cell('UpdateItem', _("Update"), - _('Confirm changes')); - edit_button_cell('CancelItemChanges', _("Cancel"), - _('Cancel changes')); + button_cell('UpdateItem', _("Update"), + _('Confirm changes'), ICON_UPDATE); + button_cell('CancelItemChanges', _("Cancel"), + _('Cancel changes'), ICON_CANCEL); hidden('LineNo', $line_no); set_focus('qty'); } @@ -415,61 +515,89 @@ function sales_order_item_controls(&$order, &$rowcounter, $line_no=-1) function display_delivery_details(&$order) { - global $table_style2; - if ($order->trans_type==10) - { - $title = _("Delivery Details"); - $delname = _("Due Date").':'; - } - elseif ($order->trans_type==13) - { - $title = _("Invoice Delivery Details"); - $delname = _("Invoice before").':'; - } - else - { - $title = _("Order Delivery Details"); - $delname = _("Required Delivery Date").':'; - } - display_heading($title); - echo "
"; - start_table("$table_style2 width=90%"); - echo ""; // outer table - - echo ""; + global $table_style2, $Ajax; - locations_list_row(_("Deliver from Location:"), 'Location', $order->Location); + div_start('delivery'); - date_row($delname, 'delivery_date', - _('Enter requested day of delivery'), $order->due_date, 0, 0, 0); + if (get_post('cash', 0)) { // Direct payment sale + display_heading(_('Cash payment')); + start_table("$table_style2 width=60%"); + label_row(_("Deliver from Location:"), $order->location_name); - text_row(_("Deliver To:"), 'deliver_to', $order->deliver_to, 40, 40, - _('Additional identifier for delivery e.g. name of receiving person')); + hidden('Location', $order->Location); + label_row(_("Cash account:"), $order->account_name); + textarea_row(_("Comments:"), "Comments", $order->Comments, 31, 5); + end_table(); + } else { - textarea_row(_("Address:"), 'delivery_address', $order->delivery_address, 35, 5, - _('Delivery address. Default is address of customer branch')); - text_row(_("Contact Phone Number:"), 'phone', $order->phone, 25, 25, - _('Phone number of ordering person. Defaults to branch phone number')); + if ($order->trans_type==10) + { + $title = _("Delivery Details"); + $delname = _("Due Date").':'; + } + elseif ($order->trans_type==13) + { + $title = _("Invoice Delivery Details"); + $delname = _("Invoice before").':'; + } + else + { + $title = _("Order Delivery Details"); + $delname = _("Required Delivery Date").':'; + } + display_heading($title); + start_outer_table("$table_style2 width=90%"); + table_section(1); - echo "
"; + locations_list_row(_("Deliver from Location:"), 'Location', null, + false, true); + if (list_updated('Location')) + check_qoh($order); - echo ""; // outer table + date_row($delname, 'delivery_date', + $order->trans_type==30 ? _('Enter requested day of delivery') : '', + $order->due_date, 0, 0, 0); + text_row(_("Deliver To:"), 'deliver_to', $order->deliver_to, 40, 40, + _('Additional identifier for delivery e.g. name of receiving person')); - echo ""; + textarea_row(_("Address:"), 'delivery_address', $order->delivery_address, 35, 5, + _('Delivery address. Default is address of customer branch')); + text_row(_("Contact Phone Number:"), 'phone', $order->phone, 25, 25, + _('Phone number of ordering person. Defaults to branch phone number')); - text_row(_("Customer Reference:"), 'cust_ref', $order->cust_ref, 25, 25, - _('Customer reference number for this order (if any)')); - textarea_row(_("Comments:"), "Comments", $order->Comments, 31, 5); + table_section(2); - small_amount_row(_("Shipping Charge:"), 'freight_cost', - price_format(get_post('freight_cost',0))); + text_row(_("Customer Reference:"), 'cust_ref', $order->cust_ref, 25, 25, + _('Customer reference number for this order (if any)')); + textarea_row(_("Comments:"), "Comments", $order->Comments, 31, 5); - shippers_list_row(_("Shipping Company:"), 'ship_via', $order->ship_via); + small_amount_row(_("Shipping Charge:"), 'freight_cost', + price_format(get_post('freight_cost',0))); - echo "
"; + shippers_list_row(_("Shipping Company:"), 'ship_via', $order->ship_via); - echo ""; - end_table(1); // outer table + end_outer_table(1); + } + div_end(); } +function check_qoh($order) +{ + $msg = ''; + foreach($order->line_items as $line_no => $line) { + if (!is_inventory_item($line['stock_id'])) continue; + $qoh = get_qoh_on_date($line->stock_id, $_POST['Location'], $_POST['OrderDate']); + if ($line->qty_dispatched > $qoh) { + $msg .= $line->stock_id . " - " . $line->item_description . ": " . + _("Quantity On Hand") . " = " + . number_format2($qoh, get_qty_dec($line->stock_id)) . '
'; + } + } + if (strlen($msg)) { + display_error(_("The delivery cannot be processed because there is an insufficient quantity for item:") + . '
'. $msg); + return false; + } + return true; +} ?> \ No newline at end of file diff --git a/sales/inquiry/customer_allocation_inquiry.php b/sales/inquiry/customer_allocation_inquiry.php index 423ed6b4..325d848f 100644 --- a/sales/inquiry/customer_allocation_inquiry.php +++ b/sales/inquiry/customer_allocation_inquiry.php @@ -1,7 +1,17 @@ . +***********************************************************************/ $page_security = 1; $path_to_root="../.."; +include($path_to_root . "/includes/db_pager.inc"); include_once($path_to_root . "/includes/session.inc"); include_once($path_to_root . "/sales/includes/sales_ui.inc"); @@ -45,185 +55,182 @@ set_global_customer($_POST['customer_id']); end_row(); end_table(); end_form(); - //------------------------------------------------------------------------------------------------ +function check_overdue($row) +{ + return ($row['OverDue'] == 1 + && (abs($row["TotalAmount"]) - $row["Allocated"] != 0)); +} + +function order_link($row) +{ + return $row['order_']>0 ? + get_customer_trans_view_str(systypes::sales_order(), $row['order_']) + : ""; +} + +function systype_name($dummy, $type) +{ + return systypes::name($type); +} + +function view_link($trans) +{ + return get_trans_view_str($trans["type"], $trans["trans_no"]); +} + +function due_date($row) +{ + return $row["type"] == 10 ? $row["due_date"] : ''; +} + +function fmt_balance($row) +{ + return $row["TotalAmount"] - $row["Allocated"]; +} + +function alloc_link($row) +{ + $link = + pager_link(_("Allocation"), + "/sales/allocations/customer_allocate.php?trans_no=" . $row["trans_no"] + ."&trans_type=" . $row["type"], ICON_MONEY); -function get_transactions() + if ($row["type"] == 11 && $row['TotalAmount'] > 0) + { + /*its a credit note which could have an allocation */ + return $link; + } + elseif (($row["type"] == systypes::cust_payment() || $row["type"] == systypes::bank_deposit()) && + ($row['TotalAmount'] - $row['Allocated']) > 0) + { + /*its a receipt which could have an allocation*/ + return $link; + } + elseif ($row["type"] == systypes::cust_payment() && $row['TotalAmount'] < 0) + { + /*its a negative receipt */ + return ''; + } +} + +function fmt_debit($row) { - $data_after = date2sql($_POST['TransAfterDate']); - $date_to = date2sql($_POST['TransToDate']); - - $sql = "SELECT ".TB_PREF."debtor_trans.*, - ".TB_PREF."debtors_master.name AS CustName, ".TB_PREF."debtors_master.curr_code AS CustCurrCode, - (".TB_PREF."debtor_trans.ov_amount + ".TB_PREF."debtor_trans.ov_gst + " - .TB_PREF."debtor_trans.ov_freight + ".TB_PREF."debtor_trans.ov_freight_tax + ".TB_PREF."debtor_trans.ov_discount) - AS TotalAmount, - ".TB_PREF."debtor_trans.alloc AS Allocated, - ((".TB_PREF."debtor_trans.type = 10) - AND ".TB_PREF."debtor_trans.due_date < '" . date2sql(Today()) . "') AS OverDue - FROM ".TB_PREF."debtor_trans, ".TB_PREF."debtors_master - WHERE ".TB_PREF."debtors_master.debtor_no = ".TB_PREF."debtor_trans.debtor_no - AND (".TB_PREF."debtor_trans.ov_amount + ".TB_PREF."debtor_trans.ov_gst + " - .TB_PREF."debtor_trans.ov_freight + ".TB_PREF."debtor_trans.ov_freight_tax + ".TB_PREF."debtor_trans.ov_discount != 0) - AND ".TB_PREF."debtor_trans.tran_date >= '$data_after' - AND ".TB_PREF."debtor_trans.tran_date <= '$date_to'"; + $value = + $row['type']==11 || $row['type']==12 || $row['type']==2 ? + -$row["TotalAmount"] : $row["TotalAmount"]; + return $value>=0 ? price_format($value) : ''; + +} + +function fmt_credit($row) +{ + $value = + !($row['type']==11 || $row['type']==12 || $row['type']==2) ? + -$row["TotalAmount"] : $row["TotalAmount"]; + return $value>0 ? price_format($value) : ''; +} +//------------------------------------------------------------------------------------------------ + + $data_after = date2sql($_POST['TransAfterDate']); + $date_to = date2sql($_POST['TransToDate']); + + $sql = "SELECT + trans.type, + trans.order_, + trans.trans_no, + trans.reference, + trans.tran_date, + trans.due_date, + debtor.name, + debtor.curr_code, + (trans.ov_amount + trans.ov_gst + trans.ov_freight + + trans.ov_freight_tax + trans.ov_discount) AS TotalAmount, + trans.alloc AS Allocated, + ((trans.type = 10) + AND trans.due_date < '" . date2sql(Today()) . "') AS OverDue + FROM " + .TB_PREF."debtor_trans as trans, " + .TB_PREF."debtors_master as debtor + WHERE debtor.debtor_no = trans.debtor_no + AND (trans.ov_amount + trans.ov_gst + trans.ov_freight + + trans.ov_freight_tax + trans.ov_discount != 0) + AND trans.tran_date >= '$data_after' + AND trans.tran_date <= '$date_to'"; if ($_POST['customer_id'] != reserved_words::get_all()) - $sql .= " AND ".TB_PREF."debtor_trans.debtor_no = '" . $_POST['customer_id'] . "'"; + $sql .= " AND trans.debtor_no = '" . $_POST['customer_id'] . "'"; if (isset($_POST['filterType']) && $_POST['filterType'] != reserved_words::get_all()) { if ($_POST['filterType'] == '1' || $_POST['filterType'] == '2') { - $sql .= " AND ".TB_PREF."debtor_trans.type = 10 "; + $sql .= " AND trans.type = 10 "; } elseif ($_POST['filterType'] == '3') { - $sql .= " AND ".TB_PREF."debtor_trans.type = " . systypes::cust_payment(); + $sql .= " AND trans.type = " . systypes::cust_payment(); } elseif ($_POST['filterType'] == '4') { - $sql .= " AND ".TB_PREF."debtor_trans.type = 11 "; + $sql .= " AND trans.type = 11 "; } if ($_POST['filterType'] == '2') { $today = date2sql(Today()); - $sql .= " AND ".TB_PREF."debtor_trans.due_date < '$today' - AND (round(abs(".TB_PREF."debtor_trans.ov_amount + " - .TB_PREF."debtor_trans.ov_gst + ".TB_PREF."debtor_trans.ov_freight + " - .TB_PREF."debtor_trans.ov_freight_tax + ".TB_PREF."debtor_trans.ov_discount) - ".TB_PREF."debtor_trans.alloc,6) > 0) "; + $sql .= " AND trans.due_date < '$today' + AND (round(abs(trans.ov_amount + " + ."trans.ov_gst + trans.ov_freight + " + ."trans.ov_freight_tax + trans.ov_discount) - trans.alloc,6) > 0) "; } }else { - $sql .= " AND ".TB_PREF."debtor_trans.type != 13 "; + $sql .= " AND trans.type != 13 "; } if (!check_value('showSettled')) { - $sql .= " AND (round(abs(".TB_PREF."debtor_trans.ov_amount + ".TB_PREF."debtor_trans.ov_gst + " - .TB_PREF."debtor_trans.ov_freight + ".TB_PREF."debtor_trans.ov_freight_tax + " - .TB_PREF."debtor_trans.ov_discount) - ".TB_PREF."debtor_trans.alloc,6) != 0) "; + $sql .= " AND (round(abs(trans.ov_amount + trans.ov_gst + " + ."trans.ov_freight + trans.ov_freight_tax + " + ."trans.ov_discount) - trans.alloc,6) != 0) "; } - - $sql .= " ORDER BY ".TB_PREF."debtor_trans.tran_date"; - - return db_query($sql,"No transactions were returned"); -} - //------------------------------------------------------------------------------------------------ -$result = get_transactions(); - -//------------------------------------------------------------------------------------------------ -if(get_post('RefreshInquiry')) -{ - $Ajax->activate('doc_tbl'); +$cols = array( + _("Type") => array('fun'=>'systype_name'), + _("#") => array('fun'=>'view_link'), + _("Reference"), + _("Order") => array('fun'=>'order_link'), + _("Date") => array('name'=>'tran_date', 'type'=>'date', 'ord'=>'asc'), + _("Due Date") => array('type'=>'date', 'fun'=>'due_date'), + _("Customer"), + _("Currency") => array('align'=>'center'), + _("Debit") => array('align'=>'right','fun'=>'fmt_debit'), + _("Credit") => array('align'=>'right','insert'=>true, 'fun'=>'fmt_credit'), + _("Allocated") => 'amount', + _("Balance") => array('type'=>'amount', 'insert'=>true, 'fun'=>'fmt_balance'), + array('insert'=>true, 'fun'=>'alloc_link') + ); + +if ($_POST['customer_id'] != reserved_words::get_all()) { + $cols[_("Customer")] = 'skip'; + $cols[_("Currency")] = 'skip'; } -//------------------------------------------------------------------------------------------------ -div_start('doc_tbl'); -if (db_num_rows($result) == 0) -{ - display_note(_("The selected customer has no transactions for the given dates."), 1, 1); -} else { - start_table("$table_style width='80%'"); - -if ($_POST['customer_id'] == reserved_words::get_all()) - $th = array(_("Type"), _("Number"), _("Reference"), _("Order"), _("Date"), _("Due Date"), - _("Customer"), _("Currency"), _("Debit"), _("Credit"), _("Allocated"), _("Balance"), ""); -else - $th = array(_("Type"), _("Number"), _("Reference"), _("Order"), _("Date"), _("Due Date"), - _("Debit"), _("Credit"), _("Allocated"), _("Balance"), ""); - -table_header($th); - - -$j = 1; -$k = 0; //row colour counter -$over_due = false; -while ($myrow = db_fetch($result)) -{ - - if ($myrow['OverDue'] == 1 && (abs($myrow["TotalAmount"]) - $myrow["Allocated"] != 0)) - { - start_row("class='overduebg'"); - $over_due = true; - } - else - alt_table_row_color($k); - - $date = sql2date($myrow["tran_date"]); - - if ($myrow["order_"] > 0) - $preview_order_str = get_customer_trans_view_str(systypes::sales_order(), $myrow["order_"]); - else - $preview_order_str = ""; - - $allocations_str = ""; - - $allocations = "" . _("Allocation") . ""; - - $due_date_str = ""; - - if ($myrow["type"] == 10) - $due_date_str = sql2date($myrow["due_date"]); - elseif ($myrow["type"] == 11 && $myrow['TotalAmount'] > 0) - { - /*its a credit note which could have an allocation */ - $allocations_str = $allocations; - - } - elseif (($myrow["type"] == systypes::cust_payment() || $myrow["type"] == systypes::bank_deposit()) && - ($myrow['TotalAmount'] - $myrow['Allocated']) > 0) - { - /*its a receipt which could have an allocation*/ - $allocations_str = $allocations; - - } - elseif ($myrow["type"] == systypes::cust_payment() && $myrow['TotalAmount'] < 0) - { - /*its a negative receipt */ - } - - label_cell(systypes::name($myrow["type"])); - label_cell(get_trans_view_str($myrow["type"], $myrow["trans_no"])); - label_cell($myrow["reference"]); - label_cell($preview_order_str); - label_cell(sql2date($myrow["tran_date"]), "nowrap"); - label_cell($due_date_str, "nowrap"); - if ($_POST['customer_id'] == reserved_words::get_all()) - { - label_cell($myrow["CustName"]); - label_cell($myrow["CustCurrCode"]); - } - $myrow["TotalAmount"] = round2($myrow["TotalAmount"], user_price_dec()); - $myrow["Allocated"] = round2($myrow["Allocated"], user_price_dec()); - display_debit_or_credit_cells( - $myrow['type']==11 || $myrow['type']==12 || $myrow['type']==2 ? - -$myrow["TotalAmount"] : $myrow["TotalAmount"]); - amount_cell(abs($myrow["Allocated"])); - amount_cell(abs($myrow["TotalAmount"]) - $myrow["Allocated"]); - label_cell($allocations_str); +$table =& new_db_pager('doc_tbl', $sql, $cols); +$table->set_marker('check_overdue', _("Marked items are overdue.")); +if (get_post('RefreshInquiry')) { + $table->set_sql($sql); + $table->set_columns($cols); +} +$table->width = "80%"; +start_form(); - end_row(); +display_db_pager($table); - $j++; - If ($j == 12) - { - $j = 1; - table_header($th); - } -//end of page full new headings if -} -//end of while loop -end_table(1); -if ($over_due) - display_note(_("Marked items are overdue."), 0, 1, "class='overduefg'"); -} -div_end(); +end_form(); end_page(); - ?> diff --git a/sales/inquiry/customer_inquiry.php b/sales/inquiry/customer_inquiry.php index 89d77353..90ac0da6 100644 --- a/sales/inquiry/customer_inquiry.php +++ b/sales/inquiry/customer_inquiry.php @@ -1,7 +1,17 @@ . +***********************************************************************/ $page_security = 1; $path_to_root="../.."; +include($path_to_root . "/includes/db_pager.inc"); include_once($path_to_root . "/includes/session.inc"); include_once($path_to_root . "/sales/includes/sales_ui.inc"); @@ -44,9 +54,7 @@ cust_allocations_list_cells(null, 'filterType', $_POST['filterType'], true); submit_cells('RefreshInquiry', _("Search"),'',_('Refresh Inquiry'), true); end_row(); end_table(); - end_form(); - set_global_customer($_POST['customer_id']); //------------------------------------------------------------------------------------------------ @@ -81,75 +89,8 @@ function display_customer_summary($customer_record) amount_cell($customer_record["Balance"]); end_row(); - end_table();; -} - -//------------------------------------------------------------------------------------------------ - -function get_transactions() -{ - $date_after = date2sql($_POST['TransAfterDate']); - $date_to = date2sql($_POST['TransToDate']); - $dec = user_price_dec(); - - $sql = "SELECT ".TB_PREF."debtor_trans.*, - ".TB_PREF."debtors_master.name AS CustName, ".TB_PREF."debtors_master.curr_code AS CustCurrCode, - (".TB_PREF."debtor_trans.ov_amount + ".TB_PREF."debtor_trans.ov_gst + " - .TB_PREF."debtor_trans.ov_freight + ".TB_PREF."debtor_trans.ov_freight_tax + ".TB_PREF."debtor_trans.ov_discount) - AS TotalAmount, ".TB_PREF."debtor_trans.alloc AS Allocated, - ((".TB_PREF."debtor_trans.type = 10) - AND (".TB_PREF."debtor_trans.due_date < '" . date2sql(Today()) . "') - AND ((".TB_PREF."debtor_trans.ov_amount + - ROUND(".TB_PREF."debtor_trans.ov_gst,$dec) + " - .TB_PREF."debtor_trans.ov_freight + ".TB_PREF."debtor_trans.ov_freight_tax)>".TB_PREF."debtor_trans.alloc - )) AS OverDue - FROM ".TB_PREF."debtor_trans, ".TB_PREF."debtors_master - WHERE ".TB_PREF."debtors_master.debtor_no = ".TB_PREF."debtor_trans.debtor_no - AND ".TB_PREF."debtor_trans.tran_date >= '$date_after' - AND ".TB_PREF."debtor_trans.tran_date <= '$date_to'"; - - if ($_POST['customer_id'] != reserved_words::get_all()) - $sql .= " AND ".TB_PREF."debtor_trans.debtor_no = '" . $_POST['customer_id'] . "'"; - - if ($_POST['filterType'] != reserved_words::get_all()) - { - if ($_POST['filterType'] == '1') - { - $sql .= " AND (".TB_PREF."debtor_trans.type = 10 OR ".TB_PREF."debtor_trans.type = 1) "; - } - elseif ($_POST['filterType'] == '2') - { - $sql .= " AND (".TB_PREF."debtor_trans.type = 10) "; - } - elseif ($_POST['filterType'] == '3') - { - $sql .= " AND (".TB_PREF."debtor_trans.type = " . systypes::cust_payment() . " OR ".TB_PREF."debtor_trans.type = 2) "; - } - elseif ($_POST['filterType'] == '4') - { - $sql .= " AND ".TB_PREF."debtor_trans.type = 11 "; - } - elseif ($_POST['filterType'] == '5') - { - $sql .= " AND ".TB_PREF."debtor_trans.type = 13 "; - } - - if ($_POST['filterType'] == '2') - { - $today = date2sql(Today()); - $sql .= " AND ".TB_PREF."debtor_trans.due_date < '$today' - AND (".TB_PREF."debtor_trans.ov_amount + ".TB_PREF."debtor_trans.ov_gst + " - .TB_PREF."debtor_trans.ov_freight_tax + ".TB_PREF."debtor_trans.ov_freight + " - .TB_PREF."debtor_trans.ov_discount - ".TB_PREF."debtor_trans.alloc > 0) "; - } - } - - $sql .= " ORDER BY ".TB_PREF."debtor_trans.tran_date DESC, - ".TB_PREF."debtor_trans.type,".TB_PREF."debtor_trans.trans_no "; - - return db_query($sql,"No transactions were returned"); + end_table(); } - //------------------------------------------------------------------------------------------------ div_start('totals_tbl'); @@ -160,147 +101,208 @@ if ($_POST['customer_id'] != "" && $_POST['customer_id'] != reserved_words::get_ echo "
"; } div_end(); -//------------------------------------------------------------------------------------------------ - -$result = get_transactions(); -//------------------------------------------------------------------------------------------------ if(get_post('RefreshInquiry')) { - $Ajax->activate('trans_tbl'); $Ajax->activate('totals_tbl'); } //------------------------------------------------------------------------------------------------ -print_hidden_script(10); -div_start('trans_tbl'); -if (db_num_rows($result) == 0) +function systype_name($dummy, $type) { - display_note(_("The selected customer has no transactions for the given dates."), 0, 2); -} else { + return systypes::name($type); +} - start_table("$table_style width='80%'"); +function order_view($row) +{ + return $row['order_']>0 ? + get_customer_trans_view_str(systypes::sales_order(), $row['order_']) + : ""; +} - $th = array(_("Type"), _("#"), _("Order"), _("Reference"), _("Date"), _("Due Date"), - _("Customer"), _("Branch"), _("Currency"), _("Debit"), _("Credit"), "", "","",""); +function trans_view($trans) +{ + return get_trans_view_str($trans["type"], $trans["trans_no"]); +} - if ($_POST['customer_id'] != reserved_words::get_all()) { - unset($th[6], $th[8]); - } +function due_date($row) +{ + return $row["type"] == 10 ? $row["due_date"] : ''; +} + +function gl_view($row) +{ + return get_gl_view_str($row["type"], $row["trans_no"]); +} + +function fmt_debit($row) +{ + $value = + $row['type']==11 || $row['type']==12 || $row['type']==2 ? + -$row["TotalAmount"] : $row["TotalAmount"]; + return $value>=0 ? price_format($value) : ''; - table_header($th); +} +function fmt_credit($row) +{ + $value = + !($row['type']==11 || $row['type']==12 || $row['type']==2) ? + -$row["TotalAmount"] : $row["TotalAmount"]; + return $value>0 ? price_format($value) : ''; +} - $j = 1; - $k = 0; //row colour counter - $over_due = false; - while ($myrow = db_fetch($result)) - { +function credit_link($row) +{ + return $row['type'] == 10 && $row["TotalAmount"] - $row["Allocated"] > 0 ? + pager_link(_("Credit This"), + "/sales/customer_credit_invoice.php?InvoiceNumber=". + $row['trans_no'], ICON_CREDIT) + : ''; +} - if ($myrow['OverDue'] == 1) - { - start_row("class='overduebg'"); - $over_due = true; - } - else - alt_table_row_color($k); - - $edit_page=''; - $due_date_str = ''; - $credit_me_str = ''; - - switch($myrow['type']) { - case 10: - $due_date_str = sql2date($myrow["due_date"]); - /*Show a link to allow an invoice to be credited */ - // only allow crediting if it's not been totally allocated - if ($myrow["TotalAmount"] - $myrow["Allocated"] > 0) - $credit_me_str = "" . _("Credit This") . ""; - if (get_voided_entry(10, $myrow["trans_no"]) === false && $myrow['Allocated'] == 0) // 2008-11-19 Joe Hunt - $edit_page= $path_to_root.'/sales/customer_invoice.php?ModifyInvoice=' - . $myrow['trans_no']; - break; +function edit_link($row) +{ + $str = ''; - case 11: - if (get_voided_entry(11, $myrow["trans_no"]) === false && $myrow['Allocated'] == 0) // 2008-11-19 Joe Hunt + switch($row['type']) { + case 10: + if (get_voided_entry(10, $row["trans_no"]) === false && $row['Allocated'] == 0) + $str = "/sales/customer_invoice.php?ModifyInvoice=".$row['trans_no']; + break; + case 11: + if (get_voided_entry(11, $row["trans_no"]) === false && $row['Allocated'] == 0) // 2008-11-19 Joe Hunt { - if ($myrow['order_']==0) // free-hand credit note - $edit_page= $path_to_root.'/sales/credit_note_entry.php?ModifyCredit=' - . $myrow['trans_no']; + if ($row['order_']==0) // free-hand credit note + $str = "/sales/credit_note_entry.php?ModifyCredit=".$row['trans_no']; else // credit invoice - $edit_page= $path_to_root.'/sales/customer_credit_invoice.php?ModifyCredit=' - . $myrow['trans_no']; - } + $str = "/sales/customer_credit_invoice.php?ModifyCredit=".$row['trans_no']; + } break; - case 13: - if (get_voided_entry(13, $myrow["trans_no"]) === false) - $edit_page= $path_to_root.'/sales/customer_delivery.php?ModifyDelivery=' - . $myrow['trans_no']; + if (get_voided_entry(13, $row["trans_no"]) === false) + $str = "/sales/customer_delivery.php?ModifyDelivery=".$row['trans_no']; break; } + if ($str != "") + return pager_link(_('Edit'), $str, ICON_EDIT); + return ''; +} - $date = sql2date($myrow["tran_date"]); +function prt_link($row) +{ + if ($row['type'] != 12 && $row['type'] != 2) // customer payment or bank deposit printout not defined yet. + return print_document_link($row['trans_no'], _("Print"), true, $row['type'], ICON_PRINT); +} - if ($myrow["order_"] > 0) - $preview_order_str = get_customer_trans_view_str(systypes::sales_order(), $myrow["order_"]); - else - $preview_order_str = ""; +function check_overdue($row) +{ + return $row['OverDue'] == 1 + && (abs($row["TotalAmount"]) - $row["Allocated"] != 0); +} +//------------------------------------------------------------------------------------------------ + $date_after = date2sql($_POST['TransAfterDate']); + $date_to = date2sql($_POST['TransToDate']); - $gl_trans_str = get_gl_view_str_cell($myrow["type"], $myrow["trans_no"]); + $sql = "SELECT + trans.type, + trans.trans_no, + trans.order_, + trans.reference, + trans.tran_date, + trans.due_date, + debtor.name, + branch.br_name, + debtor.curr_code, + (trans.ov_amount + trans.ov_gst + trans.ov_freight + + trans.ov_freight_tax + trans.ov_discount) AS TotalAmount, + trans.alloc AS Allocated, + ((trans.type = 10) + AND trans.due_date < '" . date2sql(Today()) . "') AS OverDue + FROM " + .TB_PREF."debtor_trans as trans, " + .TB_PREF."debtors_master as debtor, " + .TB_PREF."cust_branch as branch + WHERE debtor.debtor_no = trans.debtor_no + AND trans.tran_date >= '$date_after' + AND trans.tran_date <= '$date_to' + AND trans.branch_code = branch.branch_code"; - $branch_name = ""; - if ($myrow["branch_code"] > 0) - { - $branch_name = get_branch_name($myrow["branch_code"]); - } + if ($_POST['customer_id'] != reserved_words::get_all()) + $sql .= " AND trans.debtor_no = '" . $_POST['customer_id'] . "'"; - $preview_trans_str = get_trans_view_str($myrow["type"], $myrow["trans_no"]); - - label_cell(systypes::name($myrow["type"])); - - label_cell($preview_trans_str); - label_cell($preview_order_str); - label_cell($myrow["reference"]); - label_cell($date, "nowrap"); - label_cell($due_date_str, "nowrap"); - if ($_POST['customer_id'] == reserved_words::get_all()) - label_cell($myrow["CustName"]); - label_cell($branch_name); - if ($_POST['customer_id'] == reserved_words::get_all()) - label_cell($myrow["CustCurrCode"]); - display_debit_or_credit_cells( - $myrow['type']==11 || $myrow['type']==12 || $myrow['type']==2 ? - -$myrow["TotalAmount"] : $myrow["TotalAmount"]); - - echo $gl_trans_str; - - label_cell($edit_page=='' ? '' : "" . _('Edit') . ''); - if ($myrow['type'] == 10 || $myrow['type'] == 11) - label_cell(print_document_link($myrow['trans_no'], _("Print"), true, $myrow['type'])); - else - label_cell(""); - - if ($credit_me_str != "") - label_cell($credit_me_str, "nowrap"); - else - label_cell(''); - end_row(); + if ($_POST['filterType'] != reserved_words::get_all()) + { + if ($_POST['filterType'] == '1') + { + $sql .= " AND (trans.type = 10 OR trans.type = 1) "; + } + elseif ($_POST['filterType'] == '2') + { + $sql .= " AND (trans.type = 10) "; + } + elseif ($_POST['filterType'] == '3') + { + $sql .= " AND (trans.type = " . systypes::cust_payment() + ." OR trans.type = 2) "; + } + elseif ($_POST['filterType'] == '4') + { + $sql .= " AND trans.type = 11 "; + } + elseif ($_POST['filterType'] == '5') + { + $sql .= " AND trans.type = 13 "; + } - $j++; - if ($j == 12) - { - $j = 1; - table_header($th); - } //end of page full new headings if - } //end of transaction while loop + if ($_POST['filterType'] == '2') + { + $today = date2sql(Today()); + $sql .= " AND trans.due_date < '$today' + AND (trans.ov_amount + trans.ov_gst + trans.ov_freight_tax + + trans.ov_freight + trans.ov_discount - trans.alloc > 0) "; + } + } - end_table(1); +//------------------------------------------------------------------------------------------------ - if ($over_due) - display_note(_("Marked items are overdue."), 0, 1, "class='overduefg'"); +$cols = array( + _("Type") => array('fun'=>'systype_name', 'ord'=>''), + _("#") => array('fun'=>'trans_view', 'ord'=>''), + _("Order") => array('fun'=>'order_view'), + _("Reference"), + _("Date") => array('name'=>'tran_date', 'type'=>'date', 'ord'=>'desc'), + _("Due Date") => array('type'=>'date', 'fun'=>'due_date'), + _("Customer") => array('ord'=>''), + _("Branch") => array('ord'=>''), + _("Currency") => array('align'=>'center'), + _("Debit") => array('align'=>'right', 'fun'=>'fmt_debit'), + _("Credit") => array('align'=>'right','insert'=>true, 'fun'=>'fmt_credit'), + array('insert'=>true, 'fun'=>'gl_view'), + array('insert'=>true, 'fun'=>'credit_link'), + array('insert'=>true, 'fun'=>'edit_link'), + array('insert'=>true, 'fun'=>'prt_link') + ); + +if ($_POST['customer_id'] != reserved_words::get_all()) { + $cols[_("Customer")] = 'skip'; + $cols[_("Currency")] = 'skip'; } -div_end(); + + +$table =& new_db_pager('trans_tbl', $sql, $cols); +$table->set_marker('check_overdue', _("Marked items are overdue.")); + +if (get_post('RefreshInquiry')) { + $table->set_sql($sql); + $table->set_columns($cols); +} +$table->width = "85%"; + +start_form(); +display_db_pager($table); + +end_form(); end_page(); ?> diff --git a/sales/inquiry/sales_deliveries_view.php b/sales/inquiry/sales_deliveries_view.php index 0bae13e7..4ea1a824 100644 --- a/sales/inquiry/sales_deliveries_view.php +++ b/sales/inquiry/sales_deliveries_view.php @@ -1,7 +1,17 @@ . +***********************************************************************/ $page_security = 2; $path_to_root="../.."; +include($path_to_root . "/includes/db_pager.inc"); include($path_to_root . "/includes/session.inc"); include($path_to_root . "/sales/includes/sales_ui.inc"); @@ -37,50 +47,37 @@ else if (isset($_POST['BatchInvoice'])) { - // checking batch integrity $del_count = 0; - foreach($_SESSION['Batch'] as $delivery) - { - $checkbox = 'Sel_'.$delivery['trans']; - if (check_value($checkbox)) - { - if (!$del_count) - { - $del_customer = $delivery['cust']; - $del_branch = $delivery['branch']; + foreach($_POST['Sel_'] as $delivery => $branch) { + $checkbox = 'Sel_'.$delivery; + if (check_value($checkbox)) { + if (!$del_count) { + $del_branch = $branch; } - else - { - if ($del_customer!=$delivery['cust'] || $del_branch != $delivery['branch']) - { + else { + if ($del_branch != $branch) { $del_count=0; break; } } - $selected[] = $delivery['trans']; + $selected[] = $delivery; $del_count++; } } - if (!$del_count) - { + if (!$del_count) { display_error(_('For batch invoicing you should select at least one delivery. All items must be dispatched to the same customer branch.')); - } - else - { + } else { $_SESSION['DeliveryBatch'] = $selected; meta_forward($path_to_root . '/sales/customer_invoice.php','BatchInvoice=Yes'); } } //----------------------------------------------------------------------------------- -if (get_post('SearchOrders')) -{ - $Ajax->activate('deliveries_tbl'); -} elseif (get_post('_DeliveryNumber_changed')) +if (get_post('_DeliveryNumber_changed')) { $disable = get_post('DeliveryNumber') !== ''; @@ -98,7 +95,6 @@ if (get_post('SearchOrders')) } //----------------------------------------------------------------------------------- -print_hidden_script(13); start_form(false, false, $_SERVER['PHP_SELF'] ."?OutstandingOnly=" . $_POST['OutstandingOnly'] .SID); @@ -119,7 +115,7 @@ hidden('OutstandingOnly', $_POST['OutstandingOnly']); end_row(); end_table(); - +end_form(); //--------------------------------------------------------------------------------------------- if (isset($_POST['SelectStockFromList']) && ($_POST['SelectStockFromList'] != "") && @@ -133,71 +129,120 @@ else } //--------------------------------------------------------------------------------------------- -$sql = "SELECT ".TB_PREF."debtor_trans.trans_no, " - .TB_PREF."debtors_master.curr_code, " - .TB_PREF."debtors_master.name, " - .TB_PREF."cust_branch.br_name, " - .TB_PREF."debtor_trans.reference, " - .TB_PREF."debtor_trans.tran_date, " - .TB_PREF."debtor_trans.due_date, " - .TB_PREF."sales_orders.customer_ref, " - .TB_PREF."sales_orders.deliver_to, "; - -$sql .= " Sum(".TB_PREF."debtor_trans_details.quantity-" - .TB_PREF."debtor_trans_details.qty_done) AS Outstanding, "; - -$sql .= " Sum(".TB_PREF."debtor_trans_details.qty_done) AS Done, "; - -$sql .= "(ov_amount+ov_gst+ov_freight+ov_freight_tax) AS DeliveryValue"; -$sql .=" FROM " - .TB_PREF."sales_orders, " - .TB_PREF."debtor_trans, " - .TB_PREF."debtor_trans_details, " - .TB_PREF."debtors_master, " - .TB_PREF."cust_branch - WHERE " - .TB_PREF."sales_orders.order_no = ".TB_PREF."debtor_trans.order_ AND " - .TB_PREF."debtor_trans.debtor_no = ".TB_PREF."debtors_master.debtor_no - AND ".TB_PREF."debtor_trans.type = 13 - AND ".TB_PREF."debtor_trans_details.debtor_trans_no = ".TB_PREF."debtor_trans.trans_no - AND ".TB_PREF."debtor_trans_details.debtor_trans_type = ".TB_PREF."debtor_trans.type - AND ".TB_PREF."debtor_trans.branch_code = ".TB_PREF."cust_branch.branch_code - AND ".TB_PREF."debtor_trans.debtor_no = ".TB_PREF."cust_branch.debtor_no "; - - if ($_POST['OutstandingOnly'] == true) { - $sql .= " AND ".TB_PREF."debtor_trans_details.qty_done < ".TB_PREF."debtor_trans_details.quantity "; - } +function trans_view($trans, $trans_no) +{ + return get_customer_trans_view_str(13, $trans['trans_no']); +} + +function batch_checkbox($row) +{ + $name = "Sel_" .$row['trans_no']; + return $row['Done'] ? '' : + "" +// add also trans_no => branch code for checking after 'Batch' submit + ."\n"; +} + +function edit_link($row) +{ + return $row["Outstanding"]==0 ? '' : + pager_link(_('Edit'), "/sales/customer_delivery.php?ModifyDelivery=" + .$row['trans_no'], ICON_EDIT); +} + +function prt_link($row) +{ + return print_document_link($row['trans_no'], _("Print"), true, 13, ICON_PRINT); +} + +function invoice_link($row) +{ + return $row["Outstanding"]==0 ? '' : + pager_link(_('Invoice'), "/sales/customer_invoice.php?DeliveryNumber=" + .$row['trans_no'], ICON_DOC); +} + +function check_overdue($row) +{ + return date1_greater_date2(Today(), sql2date($row["due_date"])) && + $row["Outstanding"]!=0; +} +//------------------------------------------------------------------------------------------------ +$sql = "SELECT trans.trans_no, + debtor.name, + branch.branch_code, + branch.br_name, + sorder.deliver_to, + trans.reference, + sorder.customer_ref, + trans.tran_date, + trans.due_date, + (ov_amount+ov_gst+ov_freight+ov_freight_tax) AS DeliveryValue, + debtor.curr_code, + Sum(line.quantity-line.qty_done) AS Outstanding, + Sum(line.qty_done) AS Done + FROM " + .TB_PREF."sales_orders as sorder, " + .TB_PREF."debtor_trans as trans, " + .TB_PREF."debtor_trans_details as line, " + .TB_PREF."debtors_master as debtor, " + .TB_PREF."cust_branch as branch + WHERE + sorder.order_no = trans.order_ AND + trans.debtor_no = debtor.debtor_no + AND trans.type = 13 + AND line.debtor_trans_no = trans.trans_no + AND line.debtor_trans_type = trans.type + AND trans.branch_code = branch.branch_code + AND trans.debtor_no = branch.debtor_no "; + +if ($_POST['OutstandingOnly'] == true) { + $sql .= " AND line.qty_done < line.quantity "; +} //figure out the sql required from the inputs available if (isset($_POST['DeliveryNumber']) && $_POST['DeliveryNumber'] != "") { -// if ($_POST['DeliveryNumber'] != '*') // TODO paged table - $sql .= " AND ".TB_PREF."debtor_trans.trans_no LIKE '%". $_POST['DeliveryNumber'] ."'"; - $sql .= " GROUP BY ".TB_PREF."debtor_trans.trans_no"; + $sql .= " AND trans.trans_no LIKE '%". $_POST['DeliveryNumber'] ."'"; + $sql .= " GROUP BY trans.trans_no"; } else { - - $date_after = date2sql($_POST['DeliveryAfterDate']); - $date_before = date2sql($_POST['DeliveryToDate']); - - $sql .= " AND ".TB_PREF."debtor_trans.tran_date >= '$date_after'"; - $sql .= " AND ".TB_PREF."debtor_trans.tran_date <= '$date_before'"; + $sql .= " AND trans.tran_date >= '".date2sql($_POST['DeliveryAfterDate'])."'"; + $sql .= " AND trans.tran_date <= '".date2sql($_POST['DeliveryToDate'])."'"; if ($selected_customer != -1) - $sql .= " AND ".TB_PREF."debtor_trans.debtor_no='" . $selected_customer . "' "; + $sql .= " AND trans.debtor_no='" . $selected_customer . "' "; if (isset($selected_stock_item)) - $sql .= " AND ".TB_PREF."debtor_trans_details.stock_id='". $selected_stock_item ."' "; + $sql .= " AND line.stock_id='". $selected_stock_item ."' "; if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != reserved_words::get_all()) - $sql .= " AND ".TB_PREF."sales_orders.from_stk_loc = '". $_POST['StockLocation'] . "' "; + $sql .= " AND sorder.from_stk_loc = '". $_POST['StockLocation'] . "' "; - $sql .= " GROUP BY ".TB_PREF."debtor_trans.trans_no "; + $sql .= " GROUP BY trans.trans_no "; } //end no delivery number selected -$result = db_query($sql,"No deliveries were returned"); +$cols = array( + _("Delivery #") => array('fun'=>'trans_view'), + _("Customer"), + 'branch_code' => 'skip', + _("Branch") => array('ord'=>''), + _("Contact"), + _("Reference"), + _("Cust Ref"), + _("Delivery Date") => array('type'=>'date', 'ord'=>''), + _("Due By") => 'date', + _("Delivery Total") => array('type'=>'amount', 'ord'=>''), + _("Currency") => array('align'=>'center'), + submit('BatchInvoice',_("Batch"), false, _("Batch Invoicing")) + => array('insert'=>true, 'fun'=>'batch_checkbox', 'align'=>'center'), + array('insert'=>true, 'fun'=>'edit_link'), + array('insert'=>true, 'fun'=>'invoice_link'), + array('insert'=>true, 'fun'=>'prt_link') +); //----------------------------------------------------------------------------------- if (isset($_SESSION['Batch'])) @@ -206,96 +251,22 @@ if (isset($_SESSION['Batch'])) unset($_SESSION['Batch'][$trans]); unset($_SESSION['Batch']); } -if ($result) -{ - /*show a table of the deliveries returned by the sql */ - - div_start('deliveries_tbl'); - - start_table("$table_style colspan=7 width=95%"); - $th = array(_("Delivery #"), _("Customer"), _("Branch"), _("Reference"), _("Delivery Date"), - _("Due By"), _("Delivery Total"), _("Currency"), submit('BatchInvoice','Batch Inv', false), - "", "", ""); - table_header($th); - - $j = 1; - $k = 0; //row colour counter - $overdue_items = false; - while ($myrow = db_fetch($result)) - { - $_SESSION['Batch'][] = array('trans'=>$myrow["trans_no"], - 'cust'=>$myrow["name"],'branch'=>$myrow["br_name"] ); - - $view_page = get_customer_trans_view_str(13, $myrow["trans_no"]); - $formated_del_date = sql2date($myrow["tran_date"]); - $formated_due_date = sql2date($myrow["due_date"]); - $not_closed = $myrow["Outstanding"]!=0; - - // if overdue orders, then highlight as so - - if (date1_greater_date2(Today(), $formated_due_date) && $not_closed ) - { - start_row("class='overduebg'"); - $overdue_items = true; - } - else - { - alt_table_row_color($k); - } - - label_cell($view_page); - label_cell($myrow["name"]); - label_cell($myrow["br_name"]); - label_cell($myrow["reference"]); - label_cell($formated_del_date); - label_cell($formated_due_date); - amount_cell($myrow["DeliveryValue"]); - label_cell($myrow["curr_code"]); - if (!$myrow['Done']) - check_cells(null,'Sel_'. $myrow['trans_no'],0,false); - else - label_cell(""); - if ($_POST['OutstandingOnly'] == true || $not_closed) - { - $modify_page = $path_to_root . "/sales/customer_delivery.php?" . SID . "ModifyDelivery=" . $myrow["trans_no"]; - $invoice_page = $path_to_root . "/sales/customer_invoice.php?" . SID . "DeliveryNumber=" .$myrow["trans_no"]; - if (get_voided_entry(13, $myrow["trans_no"]) === false) - label_cell("" . _("Edit") . ""); - else - label_cell(""); - label_cell(print_document_link($myrow['trans_no'], _("Print"))); - - label_cell($not_closed ? "" . _("Invoice") . "" : ''); - - } - else - { - label_cell(""); - label_cell(""); - label_cell(""); - } - end_row();; - - $j++; - If ($j == 12) - { - $j = 1; - table_header($th); - } - //end of page full new headings if - } - //end of while loop - - end_table(); - - if ($overdue_items) - display_note(_("Marked items are overdue."), 0, 1, "class='overduefg'"); -div_end(); + +$table =& new_db_pager('deliveries_tbl', $sql, $cols); +$table->set_marker('check_overdue', _("Marked items are overdue.")); + +if (get_post('SearchOrders')) { + $table->set_sql($sql); + $table->set_columns($cols); } +//$table->width = "92%"; -echo "
"; -end_form(); +start_form(); + +display_db_pager($table); +end_form(); end_page(); + ?> diff --git a/sales/inquiry/sales_orders_view.php b/sales/inquiry/sales_orders_view.php index 129bb673..125cae8c 100644 --- a/sales/inquiry/sales_orders_view.php +++ b/sales/inquiry/sales_orders_view.php @@ -1,9 +1,19 @@ . +***********************************************************************/ $page_security = 2; $path_to_root="../.."; -include($path_to_root . "/includes/session.inc"); +include($path_to_root . "/includes/db_pager.inc"); +include($path_to_root . "/includes/session.inc"); include($path_to_root . "/sales/includes/sales_ui.inc"); include_once($path_to_root . "/reporting/includes/reporting.inc"); @@ -47,13 +57,99 @@ elseif (isset($_POST['selected_customer'])) else $selected_customer = -1; -//----------------------------------------------------------------------------------- -// Ajax updates +//--------------------------------------------------------------------------------------------- + +if (isset($_POST['SelectStockFromList']) && ($_POST['SelectStockFromList'] != "") && + ($_POST['SelectStockFromList'] != reserved_words::get_all())) +{ + $selected_stock_item = $_POST['SelectStockFromList']; +} +else +{ + unset($selected_stock_item); +} +//--------------------------------------------------------------------------------------------- +// Query format functions // -if (get_post('SearchOrders')) +function check_overdue($row) +{ + return ($row['type'] == 0 + && date1_greater_date2(Today(), sql2date($row['ord_date'])) + && ($row['TotDelivered'] < $row['TotQuantity'])); +} + +function view_link($dummy, $order_no) +{ + return get_customer_trans_view_str(systypes::sales_order(), $order_no); +} + +function prt_link($row) +{ + return print_document_link($row['order_no'], _("Print"), true, 30, ICON_PRINT); +} + +function edit_link($row) { + return pager_link( _("Edit"), + "/sales/sales_order_entry.php?" . SID . "ModifyOrderNumber=" . $row['order_no'], ICON_EDIT); +} + +function dispatch_link($row) +{ + return pager_link( _("Dispatch"), + "/sales/customer_delivery.php?" . SID . "OrderNumber=" .$row['order_no'], ICON_DOC); +} + +function invoice_link($row) +{ + return pager_link( _("Invoice"), + "/sales/sales_order_entry.php?" . SID . "NewInvoice=" .$row["order_no"], ICON_DOC); +} + +function delivery_link($row) +{ + return pager_link( _("Delivery"), + "/sales/sales_order_entry.php?" . SID . "NewDelivery=" .$row['order_no'], ICON_DOC); +} + +function tmpl_checkbox($row) +{ + $name = "chgtpl" .$row['order_no']; + $value = $row['type'] ? 1:0; + +// save also in hidden field for testing during 'Update' + + return checkbox(null, $name, $value, true, + _('Set this order as a template for direct deliveries/invoices')) + . hidden('last['.$row['order_no'].']', $value, false); +} +//--------------------------------------------------------------------------------------------- +// Update db record if respective checkbox value has changed. +// +function change_tpl_flag($id) +{ + global $Ajax; + + $sql = "UPDATE ".TB_PREF."sales_orders SET type = !type WHERE order_no=$id"; + + db_query($sql, "Can't change sales order type"); $Ajax->activate('orders_tbl'); -} elseif (get_post('_OrderNumber_changed')) +} + +$id = find_submit('_chgtpl'); +if ($id != -1) + change_tpl_flag($id); + +if (isset($_POST['Update']) && isset($_POST['last'])) { + foreach($_POST['last'] as $id => $value) + if ($value != check_value('chgtpl'.$id)) + change_tpl_flag($id); +} + +//--------------------------------------------------------------------------------------------- +// Order range form +// +if (get_post('_OrderNumber_changed')) // enable/disable selection controls { $disable = get_post('OrderNumber') !== ''; @@ -94,198 +190,121 @@ hidden('order_view_mode', $_POST['order_view_mode']); end_row(); -end_table(); +end_table(1); end_form(); - -//--------------------------------------------------------------------------------------------- - -if (isset($_POST['SelectStockFromList']) && ($_POST['SelectStockFromList'] != "") && - ($_POST['SelectStockFromList'] != reserved_words::get_all())) -{ - $selected_stock_item = $_POST['SelectStockFromList']; -} -else -{ - unset($selected_stock_item); -} - -function change_tpl_flag($id) -{ - global $Ajax; - - $sql = "UPDATE ".TB_PREF."sales_orders SET type = !type WHERE order_no=$id"; - - db_query($sql, "Can't change sales order type"); - $Ajax->activate('orders_tbl'); -} -//--------------------------------------------------------------------------------------------- -$id = find_submit('_chgtpl'); -if ($id != -1) - change_tpl_flag($id); - //--------------------------------------------------------------------------------------------- +// Orders inquiry table +// +$sql = "SELECT + sorder.order_no, + debtor.name, + branch.br_name," + .($_POST['order_view_mode']=='InvoiceTemplates' + || $_POST['order_view_mode']=='DeliveryTemplates' ? + "sorder.comments, " : "sorder.customer_ref, ") + ."sorder.ord_date, + sorder.delivery_date, + sorder.deliver_to, + Sum(line.unit_price*line.quantity*(1-line.discount_percent)) AS OrderValue, + sorder.type, + debtor.curr_code, + Sum(line.qty_sent) AS TotDelivered, + Sum(line.quantity) AS TotQuantity + FROM ".TB_PREF."sales_orders as sorder, " + .TB_PREF."sales_order_details as line, " + .TB_PREF."debtors_master as debtor, " + .TB_PREF."cust_branch as branch + WHERE sorder.order_no = line.order_no + AND sorder.debtor_no = debtor.debtor_no + AND sorder.branch_code = branch.branch_code + AND debtor.debtor_no = branch.debtor_no"; -$sql = "SELECT ".TB_PREF."sales_orders.order_no, ".TB_PREF."debtors_master.curr_code, ".TB_PREF."debtors_master.name, ".TB_PREF."cust_branch.br_name, - ".TB_PREF."sales_orders.ord_date, ".TB_PREF."sales_orders.deliver_to, ".TB_PREF."sales_orders.delivery_date, - ".TB_PREF."sales_orders.type, "; -$sql .= " Sum(".TB_PREF."sales_order_details.qty_sent) AS TotDelivered, "; -$sql .= " Sum(".TB_PREF."sales_order_details.quantity) AS TotQuantity, "; -$sql .= " Sum(".TB_PREF."sales_order_details.unit_price*".TB_PREF."sales_order_details.quantity*(1-".TB_PREF."sales_order_details.discount_percent)) AS OrderValue, "; - -//if ($_POST['order_view_mode']=='InvoiceTemplates' || $_POST['order_view_mode']=='DeliveryTemplates') - $sql .= TB_PREF."sales_orders.comments, "; -//else - $sql .= TB_PREF."sales_orders.customer_ref"; - -$sql .= " FROM ".TB_PREF."sales_orders, ".TB_PREF."sales_order_details, ".TB_PREF."debtors_master, ".TB_PREF."cust_branch - WHERE ".TB_PREF."sales_orders.order_no = ".TB_PREF."sales_order_details.order_no - AND ".TB_PREF."sales_orders.debtor_no = ".TB_PREF."debtors_master.debtor_no - AND ".TB_PREF."sales_orders.branch_code = ".TB_PREF."cust_branch.branch_code - AND ".TB_PREF."debtors_master.debtor_no = ".TB_PREF."cust_branch.debtor_no "; - -//figure out the sql required from the inputs available if (isset($_POST['OrderNumber']) && $_POST['OrderNumber'] != "") { -// if ($_POST['OrderNumber'] != '*') // TODO paged table - $sql .= " AND ".TB_PREF."sales_orders.order_no LIKE '%". $_POST['OrderNumber'] ."'"; - $sql .= " GROUP BY ".TB_PREF."sales_orders.order_no"; + // search orders with number like ... + $sql .= " AND sorder.order_no LIKE '%". $_POST['OrderNumber'] ."'" + ." GROUP BY sorder.order_no"; } -else +else // ... or select inquiry constraints { if ($_POST['order_view_mode']!='DeliveryTemplates' && $_POST['order_view_mode']!='InvoiceTemplates') { $date_after = date2sql($_POST['OrdersAfterDate']); $date_before = date2sql($_POST['OrdersToDate']); - $sql .= " AND ".TB_PREF."sales_orders.ord_date >= '$date_after'"; - $sql .= " AND ".TB_PREF."sales_orders.ord_date <= '$date_before'"; + $sql .= " AND sorder.ord_date >= '$date_after'" + ." AND sorder.ord_date <= '$date_before'"; } if ($selected_customer != -1) - $sql .= " AND ".TB_PREF."sales_orders.debtor_no='" . $selected_customer . "'"; + $sql .= " AND sorder.debtor_no='" . $selected_customer . "'"; if (isset($selected_stock_item)) - $sql .= " AND ".TB_PREF."sales_order_details.stk_code='". $selected_stock_item ."'"; + $sql .= " AND line.stk_code='". $selected_stock_item ."'"; if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != reserved_words::get_all()) - $sql .= " AND ".TB_PREF."sales_orders.from_stk_loc = '". $_POST['StockLocation'] . "' "; + $sql .= " AND sorder.from_stk_loc = '". $_POST['StockLocation'] . "' "; if ($_POST['order_view_mode']=='OutstandingOnly') - $sql .= " AND ".TB_PREF."sales_order_details.qty_sent < ".TB_PREF."sales_order_details.quantity"; + $sql .= " AND line.qty_sent < line.quantity"; elseif ($_POST['order_view_mode']=='InvoiceTemplates' || $_POST['order_view_mode']=='DeliveryTemplates') - $sql .= " AND ".TB_PREF."sales_orders.type=1"; - - $sql .= " GROUP BY ".TB_PREF."sales_orders.order_no, ".TB_PREF."sales_orders.debtor_no, ".TB_PREF."sales_orders.branch_code, - ".TB_PREF."sales_orders.customer_ref, ".TB_PREF."sales_orders.ord_date, ".TB_PREF."sales_orders.deliver_to"; + $sql .= " AND sorder.type=1"; + + $sql .= " GROUP BY sorder.order_no, + sorder.debtor_no, + sorder.branch_code, + sorder.customer_ref, + sorder.ord_date, + sorder.deliver_to"; +} -} //end not order number selected -$result = db_query($sql,"No orders were returned"); -//----------------------------------------------------------------------------------- -if ($result) -{ - print_hidden_script(30); - - start_form(); - /*show a table of the orders returned by the sql */ - div_start('orders_tbl'); - - start_table("$table_style colspan=6 width=95%"); - $th = array(_("Order #"), _("Customer"), _("Branch"), _("Cust Order #"), _("Order Date"), - _("Required By"), _("Delivery To"), _("Order Total"), _("Currency"), ""); - - if($_POST['order_view_mode']=='InvoiceTemplates' || $_POST['order_view_mode']=='DeliveryTemplates') - { - $th[3] = _('Description'); - } elseif ($_POST['order_view_mode'] != 'OutstandingOnly') { - $th[9] = _('Tmpl'); - $th[] =''; $th[] =''; - } - - table_header($th); - - $j = 1; - $k = 0; //row colour counter - $overdue_items = false; - while ($myrow = db_fetch($result)) - { - $view_page = get_customer_trans_view_str(systypes::sales_order(), $myrow["order_no"]); - $formated_del_date = sql2date($myrow["delivery_date"]); - $formated_order_date = sql2date($myrow["ord_date"]); - if (isset($_POST['Update']) && - check_value( "chgtpl".$myrow["order_no"]) != $myrow["type"]) { - change_tpl_flag($myrow["order_no"]); - $myrow['type'] = !$myrow['type']; - } -// $not_closed = $myrow['type'] && ($myrow["TotDelivered"] < $myrow["TotQuantity"]); - - // if overdue orders, then highlight as so. 2008-10-15 added totdelivered < totquantity as well for qualifying overdue - if ($myrow['type'] == 0 && date1_greater_date2(Today(), $formated_del_date) && ($myrow["TotDelivered"] < $myrow["TotQuantity"])) - { - start_row("class='overduebg'"); - $overdue_items = true; - } - else - { - alt_table_row_color($k); - } - - label_cell($view_page); - label_cell($myrow["name"]); - label_cell($myrow["br_name"]); - if($_POST['order_view_mode']=='InvoiceTemplates' || $_POST['order_view_mode']=='DeliveryTemplates') - label_cell($myrow["comments"]); - else - label_cell($myrow["customer_ref"]); - label_cell($formated_order_date); - label_cell($formated_del_date); - label_cell($myrow["deliver_to"]); - amount_cell($myrow["OrderValue"]); - label_cell($myrow["curr_code"]); - if ($_POST['order_view_mode']=='OutstandingOnly'/* || $not_closed*/) - { - $delivery_note = $path_to_root . "/sales/customer_delivery.php?" . SID . "OrderNumber=" .$myrow["order_no"]; - label_cell("" . _("Dispatch") . ""); - } - elseif ($_POST['order_view_mode']=='InvoiceTemplates') - { - $select_order= $path_to_root . "/sales/sales_order_entry.php?" . SID . "NewInvoice=" .$myrow["order_no"]; - label_cell("" . _("Invoice") . ""); - } - elseif ($_POST['order_view_mode']=='DeliveryTemplates') - { - $select_order= $path_to_root . "/sales/sales_order_entry.php?" . SID . "NewDelivery=" .$myrow["order_no"]; - label_cell("" . _("Delivery") . ""); - } - else - { - check_cells( null, "chgtpl" .$myrow["order_no"], $myrow["type"], true, - _('Set this order as a template for direct deliveries/invoices')); - - $modify_page = $path_to_root . "/sales/sales_order_entry.php?" . SID . "ModifyOrderNumber=" . $myrow["order_no"]; - label_cell("" . _("Edit") . ""); - label_cell(print_document_link($myrow['order_no'], _("Print"))); - } - end_row();; - - $j++; - if ($j == 12) - { - $j = 1; - table_header($th); - } - //end of page full new headings if - } - //end of while loop - end_table(); - - if ($overdue_items) - display_note(_("Marked items are overdue."), 0, 1, "class='overduefg'"); - else - echo '
'; - div_end(); - submit_center('Update', _("Update"), true, '', null); - end_form(); +$cols = array( + _("Order #") => array('fun'=>'view_link'), + _("Customer"), + _("Branch"), + _("Comments"), + _("Order Date") => 'date', + _("Required By") =>array('type'=>'date', 'ord'=>''), + _("Delivery To"), + _("Order Total") => array('type'=>'amount', 'ord'=>''), + 'Type' => 'skip', + _("Currency") => array('align'=>'center') +); + +if ($_POST['order_view_mode'] == 'OutstandingOnly') { + array_replace($cols, 3, 1, _("Cust Order Ref")); + array_append($cols, array(array('insert'=>true, 'fun'=>'dispatch_link'))); + +} elseif ($_POST['order_view_mode'] == 'InvoiceTemplates') { + array_replace($cols, 3, 1, _("Description")); + array_append($cols, array( array('insert'=>true, 'fun'=>'invoice_link'))); + +} else if ($_POST['order_view_mode'] == 'DeliveryTemplates') { + array_replace($cols, 3, 1, _("Description")); + array_append($cols, array( + array('insert'=>true, 'fun'=>'delivery_link')) + ); + +} else { + array_append($cols,array( + _("Tmpl") => array('insert'=>true, 'fun'=>'tmpl_checkbox'), + array('insert'=>true, 'fun'=>'edit_link'), + array('insert'=>true, 'fun'=>'prt_link'))); +}; + + +$table =& new_db_pager('orders_tbl', $sql, $cols); +$table->set_marker('check_overdue', _("Marked items are overdue.")); + +if (get_post('SearchOrders')) { + $table->set_sql($sql); + $table->set_columns($cols); } +$table->width = "80%"; +start_form(); -echo "
"; +display_db_pager($table); +submit_center('Update', _("Update"), true, '', null); + +end_form(); end_page(); ?> \ No newline at end of file diff --git a/sales/manage/credit_status.php b/sales/manage/credit_status.php index 6b0ee02d..8d9400cc 100644 --- a/sales/manage/credit_status.php +++ b/sales/manage/credit_status.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 3; $path_to_root="../.."; include($path_to_root . "/includes/session.inc"); @@ -108,7 +117,7 @@ while ($myrow = db_fetch($result)) label_cell($myrow["reason_description"]); label_cell($disallow_text); edit_button_cell("Edit".$myrow['id'], _("Edit")); - edit_button_cell("Delete".$myrow['id'], _("Delete")); + delete_button_cell("Delete".$myrow['id'], _("Delete")); end_row(); } @@ -120,7 +129,7 @@ echo '
'; start_form(); -start_table("$table_style2 width=40%"); +start_table($table_style2); if ($selected_id != -1) { diff --git a/sales/manage/customer_branches.php b/sales/manage/customer_branches.php index c4460d69..3dced4db 100644 --- a/sales/manage/customer_branches.php +++ b/sales/manage/customer_branches.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 3; $path_to_root="../.."; include($path_to_root . "/includes/session.inc"); @@ -82,6 +91,7 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') default_location=".db_escape($_POST['default_location']) . ", br_post_address =".db_escape($_POST['br_post_address']) . ", disable_trans=".db_escape($_POST['disable_trans']) . ", + group_no=".db_escape($_POST['group_no']) . ", default_ship_via=".db_escape($_POST['default_ship_via']) . " WHERE branch_code =".db_escape($_POST['branch_code']) . " AND debtor_no=".db_escape($_POST['customer_id']); @@ -94,7 +104,7 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') $sql = "INSERT INTO ".TB_PREF."cust_branch (debtor_no, br_name, br_address, salesman, phone, fax, contact_name, area, email, tax_group_id, sales_account, receivables_account, payment_discount_account, sales_discount_account, default_location, - br_post_address, disable_trans, default_ship_via) + br_post_address, disable_trans, group_no, default_ship_via) VALUES (".db_escape($_POST['customer_id']). ",".db_escape($_POST['br_name']) . ", " .db_escape($_POST['br_address']) . ", ".db_escape($_POST['salesman']) . ", " .db_escape($_POST['phone']) . ", ".db_escape($_POST['fax']) . "," @@ -107,6 +117,7 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') .db_escape($_POST['default_location']) . ", " .db_escape($_POST['br_post_address']) . "," .db_escape($_POST['disable_trans']) . ", " + .db_escape($_POST['group_no']) . ", " .db_escape($_POST['default_ship_via']) . ")"; $note = _('New customer branch has been added'); @@ -198,12 +209,12 @@ if ($num_branches) label_cell($myrow["description"]); label_cell($myrow["phone"]); label_cell($myrow["fax"]); - label_cell("" . $myrow["email"]. ""); + email_cell($myrow["email"]); label_cell($myrow["tax_group_name"]); if (count($_SESSION['Context'])) edit_button_cell("Select".$myrow["branch_code"], _("Select")); edit_button_cell("Edit".$myrow["branch_code"], _("Edit")); - edit_button_cell("Delete".$myrow["branch_code"], _("Delete")); + delete_button_cell("Delete".$myrow["branch_code"], _("Delete")); end_row(); } end_table(); @@ -212,13 +223,11 @@ if ($num_branches) else display_note(_("The selected customer does not have any branches. Please create at least one branch.")); -echo "
"; -start_table("$table_style2 width=60%", 5); -echo ""; // outer table - -echo ""; +start_outer_table($table_style2, 5); +table_section(1); +$_POST['email'] = ""; if ($selected_id != -1) { if ($Mode == 'Edit') { @@ -248,6 +257,7 @@ if ($selected_id != -1) $_POST['sales_discount_account'] = $myrow['sales_discount_account']; $_POST['receivables_account'] = $myrow['receivables_account']; $_POST['payment_discount_account'] = $myrow['payment_discount_account']; + $_POST['group_no'] = $myrow["group_no"]; } } elseif ($Mode != 'ADD_ITEM') @@ -288,7 +298,7 @@ text_row(_("Contact Person:"), 'contact_name', null, 35, 40); text_row(_("Phone Number:"), 'phone', null, 20, 20); text_row(_("Fax Number:"), 'fax', null, 20, 20); -text_row("" . _("E-mail:") . "", 'email', null, 35, 55); +email_row(_("E-mail:"), 'email', null, 35, 55); table_section_title(_("Sales")); @@ -296,24 +306,22 @@ sales_persons_list_row( _("Sales Person:"), 'salesman', null); sales_areas_list_row( _("Sales Area:"), 'area', null); +sales_groups_list_row(_("Sales Group:"), 'group_no', null, true); + locations_list_row(_("Default Inventory Location:"), 'default_location', null); shippers_list_row(_("Default Shipping Company:"), 'default_ship_via', null); -tax_groups_list_row(_("Tax Group:"), 'tax_group_id', null, 31, 30); +tax_groups_list_row(_("Tax Group:"), 'tax_group_id', null); yesno_list_row(_("Disable this Branch:"), 'disable_trans', null); -echo "
"; - -echo ""; // outer table - -echo""; +table_section(2); table_section_title(_("GL Accounts")); // 2006-06-14. Changed gl_al_accounts_list to have an optional all_option 'Use Item Sales Accounts' -gl_all_accounts_list_row(_("Sales Account:"), 'sales_account', null, false, false, false, true); +gl_all_accounts_list_row(_("Sales Account:"), 'sales_account', null, false, false, true); gl_all_accounts_list_row(_("Sales Discount Account:"), 'sales_discount_account'); @@ -327,9 +335,7 @@ textarea_row(_("Mailing Address:"), 'br_post_address', null, 35, 5); textarea_row(_("Billing Address:"), 'br_address', null, 35, 5); -end_table(); - -end_table(1); // outer table +end_outer_table(1); submit_add_or_update_center($selected_id == -1, '', true); diff --git a/sales/manage/customers.php b/sales/manage/customers.php index 2605cae4..ba754756 100644 --- a/sales/manage/customers.php +++ b/sales/manage/customers.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 3; $path_to_root="../.."; @@ -86,7 +95,7 @@ function handle_submit() begin_transaction(); $sql = "INSERT INTO ".TB_PREF."debtors_master (name, address, tax_id, email, dimension_id, dimension2_id, - curr_code, credit_status, payment_terms, discount, pymt_discount,credit_limit, + curr_code, credit_status, payment_terms, discount, pymt_discount,credit_limit, sales_type) VALUES (".db_escape($_POST['CustName']) .", " .db_escape($_POST['address']) . ", " . db_escape($_POST['tax_id']) . "," .db_escape($_POST['email']) . ", ".db_escape($_POST['dimension_id']) . ", " @@ -189,11 +198,9 @@ else hidden('customer_id'); } -start_table($table_style2, 7, 6); -echo "'; - hyperlink_params_td($path_to_root . "/sales/manage/customer_branches.php",''. (count($_SESSION['Context']) ? _("Select or Add") : _("Add or Edit")).'', "debtor_no=".$_POST['customer_id']); + hyperlink_params_td($path_to_root . "/sales/manage/customer_branches.php", + ''. (count($_SESSION['Context']) ? _("Select or &Add") : _("&Add or Edit ")).'', + "debtor_no=".$_POST['customer_id']); end_row(); } -end_table(); -end_table(1); // outer table +end_outer_table(1); + div_start('controls'); if ($new_customer) { diff --git a/sales/manage/sales_areas.php b/sales/manage/sales_areas.php index 2f350ab8..c7baeee5 100644 --- a/sales/manage/sales_areas.php +++ b/sales/manage/sales_areas.php @@ -1,6 +1,14 @@ . +***********************************************************************/ $page_security = 3; $path_to_root="../.."; include($path_to_root . "/includes/session.inc"); @@ -78,7 +86,7 @@ $sql = "SELECT * FROM ".TB_PREF."areas"; $result = db_query($sql,"could not get areas"); start_form(); -start_table("$table_style width=40%"); +start_table("$table_style width=30%"); $th = array(_("Area Name"), "", ""); table_header($th); $k = 0; @@ -90,7 +98,7 @@ while ($myrow = db_fetch($result)) label_cell($myrow["description"]); edit_button_cell("Edit".$myrow["area_code"], _("Edit")); - edit_button_cell("Delete".$myrow["area_code"], _("Delete")); + delete_button_cell("Delete".$myrow["area_code"], _("Delete")); end_row(); } @@ -103,7 +111,7 @@ echo '
'; start_form(); -start_table("$table_style2 width=40%"); +start_table($table_style2); if ($selected_id != -1) { diff --git a/sales/manage/sales_people.php b/sales/manage/sales_people.php index a6072ff8..04e1948d 100644 --- a/sales/manage/sales_people.php +++ b/sales/manage/sales_people.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 3; $path_to_root="../.."; include($path_to_root . "/includes/session.inc"); @@ -118,12 +127,12 @@ while ($myrow = db_fetch($result)) label_cell($myrow["salesman_name"]); label_cell($myrow["salesman_phone"]); label_cell($myrow["salesman_fax"]); - label_cell($myrow["salesman_email"]); + email_cell($myrow["salesman_email"]); label_cell(percent_format($myrow["provision"])." %", "nowrap align=right"); amount_cell($myrow["break_pt"]); label_cell(percent_format($myrow["provision2"])." %", "nowrap align=right"); edit_button_cell("Edit".$myrow["salesman_code"], _("Edit")); - edit_button_cell("Delete".$myrow["salesman_code"], _("Delete")); + delete_button_cell("Delete".$myrow["salesman_code"], _("Delete")); end_row(); } //END WHILE LIST LOOP @@ -136,6 +145,8 @@ echo '
'; start_form(); + +$_POST['salesman_email'] = ""; if ($selected_id != -1) { if ($Mode == 'Edit') { @@ -160,12 +171,12 @@ if ($selected_id != -1) $_POST['provision2'] = percent_format(0); } -start_table("$table_style2 width=60%"); +start_table($table_style2); text_row_ex(_("Sales person name:"), 'salesman_name', 30); text_row_ex(_("Telephone number:"), 'salesman_phone', 20); text_row_ex(_("Fax number:"), 'salesman_fax', 20); -text_row_ex(_("Email:"), 'salesman_email', 40); +email_row_ex(_("E-mail:"), 'salesman_email', 40); percent_row(_("Provision").':', 'provision'); amount_row(_("Break Pt.:"), 'break_pt'); percent_row(_("Provision")." 2:", 'provision2'); diff --git a/sales/manage/sales_types.php b/sales/manage/sales_types.php index a99c322b..1c4071bf 100644 --- a/sales/manage/sales_types.php +++ b/sales/manage/sales_types.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 14; $path_to_root="../.."; include_once($path_to_root . "/includes/session.inc"); @@ -117,7 +126,7 @@ while ($myrow = db_fetch($result)) label_cell($f); label_cell($myrow["tax_included"] ? _('Yes'):_('No'), 'align=center'); edit_button_cell("Edit".$myrow['id'], _("Edit")); - edit_button_cell("Delete".$myrow['id'], _("Delete")); + delete_button_cell("Delete".$myrow['id'], _("Delete")); end_row(); } @@ -133,7 +142,7 @@ start_form(); if (!isset($_POST['base'])) $_POST['base'] = 0; -start_table("$table_style2 width=30%"); +start_table($table_style2); if ($selected_id != -1) { diff --git a/sales/sales_order_entry.php b/sales/sales_order_entry.php index 9891d0c5..40c99ccf 100644 --- a/sales/sales_order_entry.php +++ b/sales/sales_order_entry.php @@ -1,4 +1,14 @@ . +***********************************************************************/ //----------------------------------------------------------------------------- // // Entry/Modify Sales Order @@ -18,18 +28,14 @@ include_once($path_to_root . "/sales/includes/db/sales_types_db.inc"); include_once($path_to_root . "/reporting/includes/reporting.inc"); $js = ''; -if ($ret = context_restore()) { - // return from new customer add - copy_from_cart(); - if(isset($ret['customer_id'])) - $_POST['customer_id'] = $ret['customer_id']; - if(isset($ret['branch_id'])) - $_POST['branch_id'] = $ret['branch_id']; -} -if (isset($_POST['_customer_id_editor'])) { - copy_to_cart(); //store context - context_call($path_to_root.'/sales/manage/customers.php?debtor_no='.$_POST['customer_id'], 'Items'); -} +editor_redirect( array( + 'customer_id' => $path_to_root.'/sales/manage/customers.php?debtor_no='.get_post('customer_id'), + 'branch_id' => $path_to_root.'/sales/manage/customer_branches.php?branch_id='.get_post('branch_id'), + )); + +editor_return( array( + 'customer_id'=>'customer_id', + 'branch_id'=>'branch_id')); if ($use_popup_windows) { $js .= get_js_open_window(900, 500); @@ -66,78 +72,75 @@ page($_SESSION['page_title'], false, false, "", $js); if (isset($_GET['AddedID'])) { $order_no = $_GET['AddedID']; - print_hidden_script(30); display_notification_centered(sprintf( _("Order # %d has been entered."),$order_no)); - display_note(get_trans_view_str(30, $order_no, _("View This Order"))); + display_note(get_trans_view_str(30, $order_no, _("&View This Order"))); echo '
'; - display_note(print_document_link($order_no, _("Print This Order"), true, 30)); + display_note(print_document_link($order_no, _("&Print This Order"), true, 30)); hyperlink_params($path_to_root . "/sales/customer_delivery.php", - _("Make Delivery Against This Order"), "OrderNumber=$order_no"); + _("Make &Delivery Against This Order"), "OrderNumber=$order_no"); - hyperlink_params($_SERVER['PHP_SELF'], _("Enter a New Order"), "NewOrder=0"); + hyperlink_params($_SERVER['PHP_SELF'], _("Enter a &New Order"), "NewOrder=0"); display_footer_exit(); } elseif (isset($_GET['UpdatedID'])) { $order_no = $_GET['UpdatedID']; - print_hidden_script(30); display_notification_centered(sprintf( _("Order # %d has been updated."),$order_no)); - display_note(get_trans_view_str(30, $order_no, _("View This Order"))); + display_note(get_trans_view_str(30, $order_no, _("&View This Order"))); echo '
'; - display_note(print_document_link($order_no, _("Print This Order"), true, 30)); + display_note(print_document_link($order_no, _("&Print This Order"), true, 30)); hyperlink_params($path_to_root . "/sales/customer_delivery.php", - _("Confirm Order Quantities and Make Delivery"), "OrderNumber=$order_no"); + _("Confirm Order Quantities and Make &Delivery"), "OrderNumber=$order_no"); hyperlink_params($path_to_root . "/sales/inquiry/sales_orders_view.php", - _("Select A Different Order"), "OutstandingOnly=1"); + _("Select A Different &Order"), "OutstandingOnly=1"); display_footer_exit(); } elseif (isset($_GET['AddedDN'])) { $delivery = $_GET['AddedDN']; - print_hidden_script(13); display_notification_centered(sprintf(_("Delivery # %d has been entered."),$delivery)); - display_note(get_trans_view_str(13, $delivery, _("View This Delivery"))); + display_note(get_trans_view_str(13, $delivery, _("&View This Delivery"))); echo '
'; - display_note(print_document_link($delivery, _("Print Delivery Note"), true, 13)); + display_note(print_document_link($delivery, _("&Print Delivery Note"), true, 13)); hyperlink_params($path_to_root . "/sales/customer_invoice.php", - _("Make Invoice Against This Delivery"), "DeliveryNumber=$delivery"); + _("Make &Invoice Against This Delivery"), "DeliveryNumber=$delivery"); if ((isset($_GET['Type']) && $_GET['Type'] == 1)) hyperlink_params("inquiry/sales_orders_view.php", - _("Enter a New Template Delivery"), "DeliveryTemplates=Yes"); + _("Enter a New Template &Delivery"), "DeliveryTemplates=Yes"); else - hyperlink_params($_SERVER['PHP_SELF'], _("Enter a New Delivery"), "NewDelivery=0"); + hyperlink_params($_SERVER['PHP_SELF'], _("Enter a &New Delivery"), "NewDelivery=0"); display_footer_exit(); } elseif (isset($_GET['AddedDI'])) { $invoice = $_GET['AddedDI']; - print_hidden_script(10); display_notification_centered(sprintf(_("Invoice # %d has been entered."),$invoice)); - display_note(get_trans_view_str(10, $invoice, _("View This Invoice"))); + display_note(get_trans_view_str(10, $invoice, _("&View This Invoice"))); echo '
'; - display_note(print_document_link($invoice, _("Print Sales Invoice"), true, 10)); + display_note(print_document_link($invoice, _("&Print Sales Invoice"), true, 10)); if ((isset($_GET['Type']) && $_GET['Type'] == 1)) hyperlink_params("inquiry/sales_orders_view.php", - _("Enter a New Template Invoice"), "InvoiceTemplates=Yes"); + _("Enter a &New Template Invoice"), "InvoiceTemplates=Yes"); else - hyperlink_params($_SERVER['PHP_SELF'], _("Enter a New Direct Invoice"), "NewInvoice=0"); + hyperlink_params($_SERVER['PHP_SELF'], _("Enter a &New Direct Invoice"), "NewInvoice=0"); display_footer_exit(); -} +} else + check_edit_conflicts(); //----------------------------------------------------------------------------- @@ -147,19 +150,28 @@ function copy_to_cart() if ($cart->trans_type!=30) { $cart->reference = $_POST['ref']; - } + } $cart->Comments = $_POST['Comments']; $cart->document_date = $_POST['OrderDate']; - $cart->due_date = $_POST['delivery_date']; - $cart->cust_ref = $_POST['cust_ref']; - $cart->freight_cost = input_num('freight_cost'); - $cart->deliver_to = $_POST['deliver_to']; - $cart->delivery_address = $_POST['delivery_address']; - $cart->phone = $_POST['phone']; - $cart->Location = $_POST['Location']; - $cart->ship_via = $_POST['ship_via']; - + if ($cart->trans_type == 10) + $cart->cash = $_POST['cash']; + if ($cart->cash) { + $cart->due_date = $cart->document_date; + $cart->phone = $cart->cust_ref = $cart->delivery_address = ''; + $cart->freight_cost = 0; + $cart->ship_via = 1; + $cart->deliver_to = '';//$_POST['deliver_to']; + } else { + $cart->due_date = $_POST['delivery_date']; + $cart->cust_ref = $_POST['cust_ref']; + $cart->freight_cost = input_num('freight_cost'); + $cart->deliver_to = $_POST['deliver_to']; + $cart->delivery_address = $_POST['delivery_address']; + $cart->phone = $_POST['phone']; + $cart->Location = $_POST['Location']; + $cart->ship_via = $_POST['ship_via']; + } if (isset($_POST['email'])) $cart->email =$_POST['email']; else @@ -167,6 +179,11 @@ function copy_to_cart() $cart->customer_id = $_POST['customer_id']; $cart->Branch = $_POST['branch_id']; $cart->sales_type = $_POST['sales_type']; + // POS + if ($cart->trans_type!=30) { // 2008-11-12 Joe Hunt + $cart->dimension_id = $_POST['dimension_id']; + $cart->dimension2_id = $_POST['dimension2_id']; + } } //----------------------------------------------------------------------------- @@ -194,6 +211,15 @@ function copy_from_cart() $_POST['branch_id'] = $cart->Branch; $_POST['sales_type'] = $cart->sales_type; + // POS + if ($cart->trans_type == 10) + $_POST['cash'] = $cart->cash; + if ($cart->trans_type!=30) { // 2008-11-12 Joe Hunt + $_POST['dimension_id'] = $cart->dimension_id; + $_POST['dimension2_id'] = $cart->dimension2_id; + } + $_POST['cart_id'] = $cart->cart_id; + } //-------------------------------------------------------------------------------- @@ -221,35 +247,38 @@ function can_process() { set_focus('AddItem'); return false; } + if ($_SESSION['Items']->cash == 0) { if (strlen($_POST['deliver_to']) <= 1) { display_error(_("You must enter the person or company to whom delivery should be made to.")); set_focus('deliver_to'); return false; } - if (strlen($_POST['delivery_address']) <= 1) { - display_error( _("You should enter the street address in the box provided. Orders cannot be accepted without a valid street address.")); - set_focus('delivery_address'); - return false; - } - if ($_POST['freight_cost'] == "") - $_POST['freight_cost'] = price_format(0); + if (strlen($_POST['delivery_address']) <= 1) { + display_error( _("You should enter the street address in the box provided. Orders cannot be accepted without a valid street address.")); + set_focus('delivery_address'); + return false; + } - if (!check_num('freight_cost',0)) { - display_error(_("The shipping cost entered is expected to be numeric.")); - set_focus('freight_cost'); - return false; - } - if (!is_date($_POST['delivery_date'])) { - display_error(_("The delivery date is invalid.")); - set_focus('delivery_date'); - return false; - } - //if (date1_greater_date2($_SESSION['Items']->document_date, $_POST['delivery_date'])) { - if (date1_greater_date2($_POST['OrderDate'], $_POST['delivery_date'])) { - display_error(_("The requested delivery date is before the date of the order.")); - set_focus('delivery_date'); - return false; + if ($_POST['freight_cost'] == "") + $_POST['freight_cost'] = price_format(0); + + if (!check_num('freight_cost',0)) { + display_error(_("The shipping cost entered is expected to be numeric.")); + set_focus('freight_cost'); + return false; + } + if (!is_date($_POST['delivery_date'])) { + display_error(_("The delivery date is invalid.")); + set_focus('delivery_date'); + return false; + } + //if (date1_greater_date2($_SESSION['Items']->document_date, $_POST['delivery_date'])) { + if (date1_greater_date2($_POST['OrderDate'], $_POST['delivery_date'])) { + display_error(_("The requested delivery date is before the date of the order.")); + set_focus('delivery_date'); + return false; + } } if ($_SESSION['Items']->trans_type != 30 && !references::is_valid($_POST['ref'])) { display_error(_("You must enter a reference.")); @@ -266,7 +295,6 @@ if (isset($_POST['ProcessOrder']) && can_process()) { $modified = ($_SESSION['Items']->trans_no != 0); $so_type = $_SESSION['Items']->so_type; - $_SESSION['Items']->write(1); if (count($messages)) { // abort on failure or error messages are lost $Ajax->activate('_page_body'); @@ -328,9 +356,11 @@ function check_item_data() function handle_update_item() { if ($_POST['UpdateItem'] != '' && check_item_data()) { + //alert("description=".$_POST['item_description']); + //$_SESSION['items']->line_items[$_POST['LineNo']]->item_description = $_POST['item_description']; $_SESSION['Items']->update_cart_item($_POST['LineNo'], input_num('qty'), input_num('price'), - input_num('Disc') / 100 ); + input_num('Disc') / 100, $_POST['item_description'] ); } line_start_focus(); } @@ -365,9 +395,8 @@ function handle_new_item() function handle_cancel_order() { - global $path_to_root; + global $path_to_root, $Ajax; - if ($_POST['CancelOrder'] != "") { if ($_SESSION['Items']->trans_type == 13) { display_note(_("Direct delivery entry has been cancelled as requested."), 1); @@ -381,19 +410,23 @@ function handle_cancel_order() if ($_SESSION['Items']->trans_no != 0) { if (sales_order_has_deliveries(key($_SESSION['Items']->trans_no))) display_error(_("This order cannot be cancelled because some of it has already been invoiced or dispatched. However, the line item quantities may be modified.")); - else + else { delete_sales_order(key($_SESSION['Items']->trans_no)); - } display_note(_("This sales order has been cancelled as requested."), 1); hyperlink_params($path_to_root . "/sales/sales_order_entry.php", _("Enter a New Sales Order"), SID . "&NewOrder=Yes"); + } + } else { + processing_end(); + meta_forward($path_to_root.'/index.php?application=orders'); } - processing_end(); - br(1); - end_page(); - exit; } + $Ajax->activate('_page_body'); + processing_end(); + br(1); + end_page(); + exit; } //-------------------------------------------------------------------------------- @@ -410,9 +443,16 @@ function create_cart($type, $trans_no) $doc->trans_type = $type; $doc->trans_no = 0; $doc->document_date = Today(); // 2006-06-15. Added so Invoices and Deliveries get current day - if ($type == 10) + if ($type == 10) { $doc->due_date = get_invoice_duedate($doc->customer_id, $doc->document_date); - else + $doc->pos = user_pos(); + $pos = get_sales_point($doc->pos); + $doc->cash = $pos['cash_sale']; + if (!$pos['cash_sale'] || !$pos['credit_sale']) + $doc->pos = -1; // mark not editable payment type + else + $doc->cash = date_diff($doc->due_date, Today(), 'd')<2; + } else $doc->due_date = $doc->document_date; $doc->reference = references::get_next($doc->trans_type); $doc->Comments=''; @@ -470,6 +510,7 @@ if ($_SESSION['Items']->trans_type == 10) { $corder = _("Commit Order Changes"); } start_form(false, true); +hidden('cart_id'); $customer_error = display_order_header($_SESSION['Items'], ($_SESSION['Items']->any_already_delivered() == 0), $idate); @@ -494,7 +535,8 @@ if ($customer_error == "") { } submit_center_last('CancelOrder', $cancelorder, - _('Cancels document entry or removes sales order when editing an old document')); + _('Cancels document entry or removes sales order when editing an old document'), + true); } else { display_error($customer_error); } diff --git a/sales/view/view_credit.php b/sales/view/view_credit.php index 8a31c0cc..f800c3a7 100644 --- a/sales/view/view_credit.php +++ b/sales/view/view_credit.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 1; $path_to_root="../.."; include_once($path_to_root . "/includes/session.inc"); @@ -128,7 +137,7 @@ if ($sub_total != 0) "nowrap align=right width=15%"); label_row(_("Shipping"), $display_freight, "colspan=6 align=right", "nowrap align=right"); -$tax_items = get_customer_trans_tax_details(11, $trans_id); +$tax_items = get_trans_tax_details(11, $trans_id); display_customer_trans_tax_details($tax_items, 6); label_row("" . _("TOTAL CREDIT") . ". +***********************************************************************/ $page_security = 1; $path_to_root="../.."; include_once($path_to_root . "/includes/session.inc"); @@ -146,7 +155,7 @@ label_row(_("Sub-total"), $display_sub_tot, "colspan=6 align=right", "nowrap align=right width=15%"); label_row(_("Shipping"), $display_freight, "colspan=6 align=right", "nowrap align=right"); -$tax_items = get_customer_trans_tax_details(13, $trans_id); +$tax_items = get_trans_tax_details(13, $trans_id); display_customer_trans_tax_details($tax_items, 6); $display_total = price_format($myrow["ov_freight"]+$myrow["ov_amount"]+$myrow["ov_freight_tax"]+$myrow["ov_gst"]); diff --git a/sales/view/view_invoice.php b/sales/view/view_invoice.php index 1d90396b..6669ca5e 100644 --- a/sales/view/view_invoice.php +++ b/sales/view/view_invoice.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 1; $path_to_root="../.."; include_once($path_to_root . "/includes/session.inc"); @@ -86,6 +95,8 @@ end_row(); start_row(); label_cells(_("Invoice Date"), sql2date($myrow["tran_date"]), "class='tableheader2'", "nowrap"); label_cells(_("Due Date"), sql2date($myrow["due_date"]), "class='tableheader2'", "nowrap"); +label_cells(_("Deliveries"), get_customer_trans_view_str(systypes::cust_dispatch(), + get_parent_trans(10,$trans_id)), "class='tableheader2'"); end_row(); comments_display_row(10, $trans_id); end_table(); @@ -146,7 +157,7 @@ label_row(_("Sub-total"), $display_sub_tot, "colspan=6 align=right", "nowrap align=right width=15%"); label_row(_("Shipping"), $display_freight, "colspan=6 align=right", "nowrap align=right"); -$tax_items = get_customer_trans_tax_details(10, $trans_id); +$tax_items = get_trans_tax_details(10, $trans_id); display_customer_trans_tax_details($tax_items, 6); $display_total = price_format($myrow["ov_freight"]+$myrow["ov_gst"]+$myrow["ov_amount"]+$myrow["ov_freight_tax"]); diff --git a/sales/view/view_receipt.php b/sales/view/view_receipt.php index 71210945..10dfd0c8 100644 --- a/sales/view/view_receipt.php +++ b/sales/view/view_receipt.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 1; $path_to_root="../.."; include_once($path_to_root . "/includes/session.inc"); @@ -36,7 +45,8 @@ label_cells(_("Amount"), price_format($receipt['ov_amount']), "class='tableheade label_cells(_("Discount"), price_format($receipt['ov_discount']), "class='tableheader2'"); end_row(); start_row(); -label_cells(_("Payment Type"), $receipt['BankTransType'], "class='tableheader2'"); +label_cells(_("Payment Type"), + bank_account_types::transfer_type($receipt['BankTransType']), "class='tableheader2'"); label_cells(_("Reference"), $receipt['reference'], "class='tableheader2'", "colspan=4"); end_row(); comments_display_row(systypes::cust_payment(), $trans_id); diff --git a/sales/view/view_sales_order.php b/sales/view/view_sales_order.php index 782c951d..77d41175 100644 --- a/sales/view/view_sales_order.php +++ b/sales/view/view_sales_order.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 2; $path_to_root="../.."; include_once($path_to_root . "/sales/includes/cart_class.inc"); @@ -18,12 +27,12 @@ page(_("View Sales Order"), true, false, "", $js); display_heading(sprintf(_("Sales Order #%d"),$_GET['trans_no'])); -if (isset($_SESSION['Items'])) +if (isset($_SESSION['View'])) { - unset ($_SESSION['Items']); + unset ($_SESSION['View']); } -$_SESSION['Items'] = new Cart(30, $_GET['trans_no'], true); +$_SESSION['View'] = new Cart(30, $_GET['trans_no'], true); start_table("$table_style2 width=95%", 5); echo ""; echo "";*/ edit_button_cell("Edit".$myrow["id"], _("Edit")); - edit_button_cell("Delete".$myrow["id"], _("Delete")); + delete_button_cell("Delete".$myrow["id"], _("Delete")); end_row();; } diff --git a/taxes/tax_types.php b/taxes/tax_types.php index adfa7b9d..6639e05a 100644 --- a/taxes/tax_types.php +++ b/taxes/tax_types.php @@ -1,4 +1,14 @@ . +***********************************************************************/ $page_security = 3; $path_to_root=".."; @@ -110,7 +120,7 @@ while ($myrow = db_fetch($result)) label_cell($myrow["purchasing_gl_code"] . " " . $myrow["PurchasingAccountName"]); edit_button_cell("Edit".$myrow["id"], _("Edit")); - edit_button_cell("Delete".$myrow["id"], _("Delete")); + delete_button_cell("Delete".$myrow["id"], _("Delete")); end_row(); } diff --git a/themes/aqua/default.css b/themes/aqua/default.css index e7323a8a..1377e208 100644 --- a/themes/aqua/default.css +++ b/themes/aqua/default.css @@ -42,6 +42,10 @@ input, select { padding: 1px; } +select { + max-width: 200px; +} + input.big { width: 100px; } @@ -57,7 +61,7 @@ a { } a:link { - color: #00000bb; + color: #0000bb; text-decoration: none; } @@ -71,6 +75,17 @@ a:hover { text-decoration: underline; } +button { + font-size: 11px; + border: 1px #0066cc solid; + padding: 1px 0px; +} + +button img, span { + padding: 0px 2px ; + vertical-align: middle; +} + .login { background-color: #ffffff; border: none; @@ -360,27 +375,34 @@ input.amount { cursor: pointer; } -.navibutton[disabled] { +.navibutton[disabled], .navibutton[disabled] span { color:#808080; - cursor: auto; + cursor: inherit; } -.navibutton { - color:#0000FF; - padding: 3px; + +button.navibutton { + font-family: Verdana, Arial, Helvetica; + font-size: 11px; + font-weight: bold; + color:#000; + padding: 0 3px; background-color:transparent; border-style:none; - text-decoration:underline; cursor: pointer; } +.navibutton span { + text-decoration: underline; +} + .navibar { - padding: 3px; - border: 1px solid #cccccc; + padding: 0 3px; + color: #000; + border: 1px solid #8cacbb; border-collapse: collapse; - background-color: #dee7ec; + background-color: #d5cea7; } - .listsubmit { display: none; } @@ -435,11 +457,104 @@ ul.ajaxtabs li input.current, ul.ajaxtabs li input.current:hover{ color:#FFFFFF; } #hints { - font-size: 13px; - padding: 5px; - border-bottom: 1px solid #8cacbb; - margin: -4px -2px -2px; - border: 1px solid #8cacbb; - background-color: #FFFFE0; - white-space: nowrap; + font-size: 13px; + padding: 5px; + border-bottom: 1px solid #8cacbb; + margin: -4px -2px -2px; + border: 1px solid #8cacbb; + background-color: #FFFFE0; + white-space: nowrap; +} +/* + Calendar style +*/ +#CCIframe { + display: none; + left: 0px; + position: absolute; + top: 0px; + height: 250px; + width: 270px; + z-index: 99; +} +#CC { + position:absolute; + background-color:#FFF; + margin:0; padding:0; + display:none; + z-index: 100; +} +#CC table { + font-family: arial, verdana, helvetica, sans-serif; + font-size: 8pt; + border-left: 1px solid #336; + border-right: 1px solid #336; +} +#CC th { + font-weight: normal; + text-align: center; +} +#CC th a { + font-weight: normal; + text-decoration: none; + color: #FFF; + padding: 1px; +} +#CC td { + text-align: center; +} +#CC .header { + background-color: #518fad; +} +#CC .weekday { + background-color: #eee; + color: #000; +} +#CC .weekend { + background-color: #FFC; + color: #000; +} +#CC .weekno { + background-color: #d5cea7; + color: #555; +} +#CC .current { + border: 1px solid #339; + background-color: #518fad; + color: #FFF; +} +#CC .weekday, #CC .weekend, #CC .current { + display: block; + text-decoration: none; + border: 1px solid #FFF; + width: 2em; +} +#CC .weekday:hover, #CC .weekend:hover, #CC .current:hover { + color: #FFF; + background-color: #518fad; + border: 1px solid #999; +} +#CC .previous { + text-align: left; +} +#CC .next { + text-align: right; +} +#CC .previous, #CC .next { + padding: 1px 3px 1px 3px; + font-size: 1.4em; +} +#CC .previous a, #CC .next a { + color: #FFF; + text-decoration: none; + font-weight: bold; +} +#CC .title { + text-align: center; + font-weight: bold; + color: #FFF; +} +#CC .empty { + background-color: #ddd; + border: 1px solid #FFF; } diff --git a/themes/aqua/renderer.php b/themes/aqua/renderer.php index ad4cd21e..c671e8e6 100644 --- a/themes/aqua/renderer.php +++ b/themes/aqua/renderer.php @@ -1,5 +1,14 @@ . +***********************************************************************/ class renderer { function wa_header() @@ -14,7 +23,7 @@ function menu_header($title, $no_menu, $is_index) { - global $path_to_root, $applications, $help_base_url, $db_connections; + global $path_to_root, $help_base_url, $db_connections; // you can owerride the table styles from config.php here, if you want. //global $table_style, $table_style2; //$table_style = "cellpadding=3 border=1 bordercolor='#8cacbb' style='border-collapse: collapse'"; @@ -31,15 +40,19 @@ echo ""; if (sizeof($module->rappfunctions) > 0) @@ -138,8 +163,16 @@ echo ""; } diff --git a/themes/cool/default.css b/themes/cool/default.css index fc84e8b9..a6439fa3 100644 --- a/themes/cool/default.css +++ b/themes/cool/default.css @@ -42,6 +42,10 @@ input, select { padding: 1px; } +select { + max-width: 200px; +} + input.big { width: 100px; } @@ -71,6 +75,16 @@ a:hover { text-decoration: underline; } +button { + font-size: 11px; + border: 1px #0066cc solid; + padding: 1px 0px; +} + +button img, span { + padding: 0px 2px ; + vertical-align: middle; +} .login { background-color: #ffffff; @@ -366,24 +380,32 @@ input.amount { cursor: pointer; } -.navibutton[disabled] { - color:#808080; +.navibutton[disabled], .navibutton[disabled] span { + color:#ddd; + text-decoration: none; cursor: auto; } -.navibutton { - color:#0000FF; - padding: 3px; +button.navibutton { + font-family: Verdana, Arial, Helvetica; + font-size: 11px; + font-weight: bold; + color:#fff; + padding: 0 3px; background-color:transparent; border-style:none; - text-decoration:underline; cursor: pointer; } +.navibutton span { + text-decoration: underline; +} + .navibar { - padding: 3px; + padding: 0 3px; + color: #fff; border: 1px solid #cccccc; border-collapse: collapse; - background-color: #dee7ec; + background-color: #788da1; } @@ -441,11 +463,104 @@ ul.ajaxtabs li input.current, ul.ajaxtabs li input.current:hover{ color:#FFFFFF; } #hints { - font-size: 13px; - padding: 5px; - border-bottom: 1px solid #8cacbb; - margin: -4px -2px -2px; - border: 1px solid #8cacbb; - background-color: #FFFFE0; - white-space: nowrap; + font-size: 13px; + padding: 5px; + border-bottom: 1px solid #8cacbb; + margin: -4px -2px -2px; + border: 1px solid #8cacbb; + background-color: #FFFFE0; + white-space: nowrap; +} +/* + Calendar style +*/ +#CCIframe { + display: none; + left: 0px; + position: absolute; + top: 0px; + height: 250px; + width: 270px; + z-index: 99; +} +#CC { + position:absolute; + background-color:#FFF; + margin:0; padding:0; + display:none; + z-index: 100; +} +#CC table { + font-family: arial, verdana, helvetica, sans-serif; + font-size: 8pt; + border-left: 1px solid #336; + border-right: 1px solid #336; +} +#CC th { + font-weight: normal; + text-align: center; +} +#CC th a { + font-weight: normal; + text-decoration: none; + color: #FFF; + padding: 1px; +} +#CC td { + text-align: center; +} +#CC .header { + background-color: #60687b; +} +#CC .weekday { + background-color: #eee; + color: #000; +} +#CC .weekend { + background-color: #FFC; + color: #000; +} +#CC .weekno { + background-color: #e4ecec; + color: #555; +} +#CC .current { + border: 1px solid #339; + background-color: #60687b; + color: #FFF; +} +#CC .weekday, #CC .weekend, #CC .current { + display: block; + text-decoration: none; + border: 1px solid #FFF; + width: 2em; +} +#CC .weekday:hover, #CC .weekend:hover, #CC .current:hover { + color: #FFF; + background-color: #60687b; + border: 1px solid #999; +} +#CC .previous { + text-align: left; +} +#CC .next { + text-align: right; +} +#CC .previous, #CC .next { + padding: 1px 3px 1px 3px; + font-size: 1.4em; +} +#CC .previous a, #CC .next a { + color: #FFF; + text-decoration: none; + font-weight: bold; +} +#CC .title { + text-align: center; + font-weight: bold; + color: #FFF; +} +#CC .empty { + background-color: #ddd; + border: 1px solid #FFF; } diff --git a/themes/cool/renderer.php b/themes/cool/renderer.php index ad4cd21e..34f1f355 100644 --- a/themes/cool/renderer.php +++ b/themes/cool/renderer.php @@ -1,5 +1,14 @@ . +***********************************************************************/ class renderer { function wa_header() @@ -14,7 +23,7 @@ function menu_header($title, $no_menu, $is_index) { - global $path_to_root, $applications, $help_base_url, $db_connections; + global $path_to_root, $help_base_url, $db_connections; // you can owerride the table styles from config.php here, if you want. //global $table_style, $table_style2; //$table_style = "cellpadding=3 border=1 bordercolor='#8cacbb' style='border-collapse: collapse'"; @@ -31,15 +40,19 @@ echo ""; if (sizeof($module->rappfunctions) > 0) @@ -138,8 +162,16 @@ echo ""; } diff --git a/themes/default/default.css b/themes/default/default.css index a32fa4e9..febd2427 100644 --- a/themes/default/default.css +++ b/themes/default/default.css @@ -42,6 +42,10 @@ input, select { padding: 1px; } +select { + max-width: 200px; +} + input.big { width: 100px; } @@ -71,6 +75,17 @@ a:hover { text-decoration: underline; } +button { + font-size: 11px; + border: 1px #0066cc solid; + padding: 1px 0px; +} + +button img, span { + padding: 0px 2px ; + vertical-align: middle; +} + .login { background-color: #ffffff; border: none; @@ -360,27 +375,35 @@ input.amount { cursor: pointer; } -.navibutton[disabled] { +.navibutton[disabled], .navibutton[disabled] span { color:#808080; + text-decoration: none; cursor: auto; } -.navibutton { - color:#0000FF; - padding: 3px; + +button.navibutton { + font-family: Verdana, Arial, Helvetica; + font-size: 11px; + font-weight: bold; + color:#000; + padding: 0 3px; background-color:transparent; border-style:none; - text-decoration:underline; cursor: pointer; } +.navibutton span { + text-decoration: underline; +} + .navibar { - padding: 3px; - border: 1px solid #cccccc; + padding: 0 3px; + color: #000; + border: 1px solid #8cacbb; border-collapse: collapse; background-color: #dee7ec; } - .listsubmit { display: none; } @@ -435,11 +458,104 @@ ul.ajaxtabs li input.current, ul.ajaxtabs li input.current:hover{ color:#FFFFFF; } #hints { - font-size: 13px; - padding: 5px; - border-bottom: 1px solid #8cacbb; - margin: -4px -2px -2px; - border: 1px solid #8cacbb; - background-color: #FFFFE0; - white-space: nowrap; + font-size: 13px; + padding: 5px; + border-bottom: 1px solid #8cacbb; + margin: -4px -2px -2px; + border: 1px solid #8cacbb; + background-color: #FFFFE0; + white-space: nowrap; +} +/* + Calendar style +*/ +#CCIframe { + display: none; + left: 0px; + position: absolute; + top: 0px; + height: 250px; + width: 270px; + z-index: 99; +} +#CC { + position:absolute; + background-color:#FFF; + margin:0; padding:0; + display:none; + z-index: 100; +} +#CC table { + font-family: arial, verdana, helvetica, sans-serif; + font-size: 8pt; + border-left: 1px solid #336; + border-right: 1px solid #336; +} +#CC th { + font-weight: normal; + text-align: center; +} +#CC th a { + font-weight: normal; + text-decoration: none; + color: #FFF; + padding: 1px; +} +#CC td { + text-align: center; +} +#CC .header { + background-color: #285b86; +} +#CC .weekday { + background-color: #eee; + color: #000; +} +#CC .weekend { + background-color: #FFC; + color: #000; +} +#CC .weekno { + background-color: #c0daf8; + color: #555; +} +#CC .current { + border: 1px solid #339; + background-color: #285b86; + color: #FFF; +} +#CC .weekday, #CC .weekend, #CC .current { + display: block; + text-decoration: none; + border: 1px solid #FFF; + width: 2em; +} +#CC .weekday:hover, #CC .weekend:hover, #CC .current:hover { + color: #FFF; + background-color: #285b86; + border: 1px solid #999; +} +#CC .previous { + text-align: left; +} +#CC .next { + text-align: right; +} +#CC .previous, #CC .next { + padding: 1px 3px 1px 3px; + font-size: 1.4em; +} +#CC .previous a, #CC .next a { + color: #FFF; + text-decoration: none; + font-weight: bold; +} +#CC .title { + text-align: center; + font-weight: bold; + color: #FFF; +} +#CC .empty { + background-color: #ddd; + border: 1px solid #FFF; } diff --git a/themes/default/login.css b/themes/default/login.css index 1864b5dc..f4cd1e94 100644 --- a/themes/default/login.css +++ b/themes/default/login.css @@ -2,12 +2,12 @@ | | | login.css | |---------------------------------------------------| | For use with: | -| OpenAccounting | -| http://open-accounting.sourceforge.net/ | -| by KylieTech Consulting | +| FrontAccounting | +| http://frontaccounting.net/ | +| by FrontAccount, LLC | |---------------------------------------------------| | Developer: | -| Shane Barnaby | +| Joe Hunt | | | |---------------------------------------------------| | Note: | @@ -41,5 +41,6 @@ input.small { } td.login { - background: #dddddd; + border: 1px solid #ccc; + background-color: #eee; } \ No newline at end of file diff --git a/themes/default/renderer.php b/themes/default/renderer.php index 51cbc8e4..473cf82f 100644 --- a/themes/default/renderer.php +++ b/themes/default/renderer.php @@ -1,5 +1,14 @@ . +***********************************************************************/ class renderer { function wa_header() @@ -14,7 +23,8 @@ function menu_header($title, $no_menu, $is_index) { - global $path_to_root, $applications, $help_base_url, $db_connections; + global $path_to_root, $help_base_url, $db_connections; + // you can owerride the table styles from config.php here, if you want. //global $table_style, $table_style2; //$table_style = "cellpadding=3 border=1 bordercolor='#8cacbb' style='border-collapse: collapse'"; @@ -31,30 +41,35 @@ echo "
"; // outer table - +start_outer_table($table_style2, 5); -start_table("class='tablestyle_noborder'"); +table_section(1); if ($new_customer) { @@ -231,14 +238,15 @@ else $_POST['credit_limit'] = price_format($myrow["credit_limit"]); } +table_section_title(_("Name and Address")); + text_row(_("Customer Name:"), 'CustName', $_POST['CustName'], 40, 40); textarea_row(_("Address:"), 'address', $_POST['address'], 35, 5); -text_row(_("Email:"), 'email', null, 40, 40); +email_row(_("E-mail:"), 'email', null, 40, 40); text_row(_("GSTNo:"), 'tax_id', null, 40, 40); -// Sherifoz 23.09.03 currency can't be changed if editing if ($new_customer) { currencies_list_row(_("Customer's Currency:"), 'curr_code', $_POST['curr_code']); @@ -248,13 +256,18 @@ else label_row(_("Customer's Currency:"), $_POST['curr_code']); hidden('curr_code', $_POST['curr_code']); } -end_table(); -echo ""; // outer table +table_section(2); -start_table("class='tablestyle_noborder'"); +table_section_title(_("Sales")); sales_types_list_row(_("Sales Type/Price List:"), 'sales_type', $_POST['sales_type']); +percent_row(_("Discount Percent:"), 'discount', $_POST['discount']); +percent_row(_("Prompt Payment Discount Percent:"), 'pymt_discount', $_POST['pymt_discount']); +amount_row(_("Credit Limit:"), 'credit_limit', $_POST['credit_limit']); + +payment_terms_list_row(_("Payment Terms:"), 'payment_terms', $_POST['payment_terms']); +credit_status_list_row(_("Credit Status:"), 'credit_status', $_POST['credit_status']); $dim = get_company_pref('use_dimension'); if ($dim >= 1) dimensions_list_row(_("Dimension")." 1:", 'dimension_id', $_POST['dimension_id'], true, " ", false, 1); @@ -265,21 +278,17 @@ if ($dim < 1) if ($dim < 2) hidden('dimension2_id', 0); -percent_row(_("Discount Percent:"), 'discount', $_POST['discount']); -percent_row(_("Prompt Payment Discount Percent:"), 'pymt_discount', $_POST['pymt_discount']); -amount_row(_("Credit Limit:"), 'credit_limit', $_POST['credit_limit']); - -payment_terms_list_row(_("Payment Terms:"), 'payment_terms', $_POST['payment_terms']); -credit_status_list_row(_("Credit Status:"), 'credit_status', $_POST['credit_status']); if (!$new_customer) { start_row(); echo ''._('Customer branches').':
"; @@ -37,27 +46,27 @@ echo "
"; start_table("$table_style width=95%"); -label_row(_("Customer Name"), $_SESSION['Items']->customer_name, "class='tableheader2'", +label_row(_("Customer Name"), $_SESSION['View']->customer_name, "class='tableheader2'", "colspan=3"); start_row(); -label_cells(_("Customer Order Ref."), $_SESSION['Items']->cust_ref, "class='tableheader2'"); -label_cells(_("Deliver To Branch"), $_SESSION['Items']->deliver_to, "class='tableheader2'"); +label_cells(_("Customer Order Ref."), $_SESSION['View']->cust_ref, "class='tableheader2'"); +label_cells(_("Deliver To Branch"), $_SESSION['View']->deliver_to, "class='tableheader2'"); end_row(); start_row(); -label_cells(_("Ordered On"), $_SESSION['Items']->document_date, "class='tableheader2'"); -label_cells(_("Requested Delivery"), $_SESSION['Items']->due_date, "class='tableheader2'"); +label_cells(_("Ordered On"), $_SESSION['View']->document_date, "class='tableheader2'"); +label_cells(_("Requested Delivery"), $_SESSION['View']->due_date, "class='tableheader2'"); end_row(); start_row(); -label_cells(_("Order Currency"), $_SESSION['Items']->customer_currency, "class='tableheader2'"); -label_cells(_("Deliver From Location"), $_SESSION['Items']->location_name, "class='tableheader2'"); +label_cells(_("Order Currency"), $_SESSION['View']->customer_currency, "class='tableheader2'"); +label_cells(_("Deliver From Location"), $_SESSION['View']->location_name, "class='tableheader2'"); end_row(); -label_row(_("Delivery Address"), nl2br($_SESSION['Items']->delivery_address), +label_row(_("Delivery Address"), nl2br($_SESSION['View']->delivery_address), "class='tableheader2'", "colspan=3"); -label_row(_("Telephone"), $_SESSION['Items']->phone, "class='tableheader2'", "colspan=3"); -label_row(_("E-mail"), "email . "'>" . $_SESSION['Items']->email . "", +label_row(_("Telephone"), $_SESSION['View']->phone, "class='tableheader2'", "colspan=3"); +label_row(_("E-mail"), "email . "'>" . $_SESSION['View']->email . "", "class='tableheader2'", "colspan=3"); -label_row(_("Comments"), $_SESSION['Items']->Comments, "class='tableheader2'", "colspan=3"); +label_row(_("Comments"), $_SESSION['View']->Comments, "class='tableheader2'", "colspan=3"); end_table(); echo ""; @@ -175,7 +184,7 @@ table_header($th); $k = 0; //row colour counter -foreach ($_SESSION['Items']->line_items as $stock_item) { +foreach ($_SESSION['View']->line_items as $stock_item) { $line_total = round2($stock_item->quantity * $stock_item->price * (1 - $stock_item->discount_percent), user_price_dec()); @@ -195,11 +204,11 @@ foreach ($_SESSION['Items']->line_items as $stock_item) { end_row(); } -$items_total = $_SESSION['Items']->get_items_total(); +$items_total = $_SESSION['View']->get_items_total(); -$display_total = price_format($items_total + $_SESSION['Items']->freight_cost); +$display_total = price_format($items_total + $_SESSION['View']->freight_cost); -label_row(_("Shipping"), price_format($_SESSION['Items']->freight_cost), +label_row(_("Shipping"), price_format($_SESSION['View']->freight_cost), "align=right colspan=6", "nowrap align=right"); label_row(_("Total Order Value"), $display_total, "align=right colspan=6", "nowrap align=right"); diff --git a/sql/en_US-demo.sql b/sql/en_US-demo.sql index 4e74b51a..8b80ee29 100644 --- a/sql/en_US-demo.sql +++ b/sql/en_US-demo.sql @@ -1,9 +1,11 @@ # MySQL dump of database 'fa' on host 'localhost' -# Backup Date and Time: 2008-04-01 09:43 -# Built by FrontAccounting 2.0 Beta +# Backup Date and Time: 2009-01-30 10:42 +# Built by FrontAccounting 2.1.0 CVS # http://frontaccounting.net -# Company: Drill Company Inc. +# Company: Training Co. # User: Administrator +# Database: en_US-demo.sql + ### Structure of table `0_areas` ### @@ -13,9 +15,42 @@ DROP TABLE IF EXISTS `0_areas`; CREATE TABLE `0_areas` ( `area_code` int(11) NOT NULL auto_increment, `description` varchar(60) NOT NULL default '', + `inactive` tinyint(1) NOT NULL default '0', PRIMARY KEY (`area_code`), UNIQUE KEY `description` (`description`) -) TYPE=MyISAM AUTO_INCREMENT=5 ; +) TYPE=MyISAM AUTO_INCREMENT=5 AUTO_INCREMENT=5 ; + + +### Data of table `0_areas` ### + +INSERT INTO `0_areas` VALUES ('1', 'USA', '0'); +INSERT INTO `0_areas` VALUES ('2', 'Far East', '0'); +INSERT INTO `0_areas` VALUES ('3', 'Africa', '0'); +INSERT INTO `0_areas` VALUES ('4', 'Europe', '0'); + + +### Structure of table `0_attachments` ### + +DROP TABLE IF EXISTS `0_attachments`; + +CREATE TABLE `0_attachments` ( + `id` int(11) unsigned NOT NULL auto_increment, + `description` varchar(60) NOT NULL default '', + `type_no` int(11) NOT NULL default '0', + `trans_no` int(11) NOT NULL default '0', + `unique_name` varchar(60) NOT NULL default '', + `tran_date` date NOT NULL default '0000-00-00', + `filename` varchar(60) NOT NULL default '', + `filesize` int(11) NOT NULL default '0', + `filetype` varchar(60) NOT NULL default '', + PRIMARY KEY (`id`), + KEY `type_no` (`type_no`,`trans_no`) +) TYPE=MyISAM AUTO_INCREMENT=1 ; + + +### Data of table `0_attachments` ### + + ### Structure of table `0_bank_accounts` ### @@ -29,10 +64,22 @@ CREATE TABLE `0_bank_accounts` ( `bank_name` varchar(60) NOT NULL default '', `bank_address` tinytext, `bank_curr_code` char(3) NOT NULL default '', - PRIMARY KEY (`account_code`), + `id` smallint(6) NOT NULL auto_increment, + `last_reconciled_date` timestamp NOT NULL default '0000-00-00 00:00:00', + `ending_reconcile_balance` double NOT NULL default '0', + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`id`), KEY `bank_account_name` (`bank_account_name`), KEY `bank_account_number` (`bank_account_number`) -) TYPE=MyISAM ; +) TYPE=MyISAM AUTO_INCREMENT=4 AUTO_INCREMENT=4 ; + + +### Data of table `0_bank_accounts` ### + +INSERT INTO `0_bank_accounts` VALUES ('1700', '1', 'Current account', 'N/A', 'N/A', '', 'USD', '1', '0000-00-00 00:00:00', '0', '0'); +INSERT INTO `0_bank_accounts` VALUES ('1705', '3', 'Petty Cash account', 'N/A', 'N/A', '', 'USD', '2', '0000-00-00 00:00:00', '0', '0'); +INSERT INTO `0_bank_accounts` VALUES ('1710', '0', 'Saving account', '10001000', 'Saving Bank', '', 'GBP', '3', '0000-00-00 00:00:00', '0', '0'); + ### Structure of table `0_bank_trans` ### @@ -45,27 +92,30 @@ CREATE TABLE `0_bank_trans` ( `bank_act` varchar(11) default NULL, `ref` varchar(40) default NULL, `trans_date` date NOT NULL default '0000-00-00', - `bank_trans_type_id` int(10) unsigned default NULL, `amount` double default NULL, `dimension_id` int(11) NOT NULL default '0', `dimension2_id` int(11) NOT NULL default '0', `person_type_id` int(11) NOT NULL default '0', `person_id` tinyblob, + `reconciled` date default NULL, PRIMARY KEY (`id`), KEY `bank_act` (`bank_act`,`ref`), KEY `type` (`type`,`trans_no`) -) TYPE=InnoDB AUTO_INCREMENT=24 ; +) TYPE=InnoDB AUTO_INCREMENT=30 AUTO_INCREMENT=30 ; -### Structure of table `0_bank_trans_types` ### -DROP TABLE IF EXISTS `0_bank_trans_types`; +### Data of table `0_bank_trans` ### + +INSERT INTO `0_bank_trans` VALUES ('21', '12', '7', '1', '6', '2008-03-06', '100', '0', '0', '2', '1', NULL); +INSERT INTO `0_bank_trans` VALUES ('22', '12', '8', '1', '7', '2008-03-06', '100', '0', '0', '2', '4', NULL); +INSERT INTO `0_bank_trans` VALUES ('23', '12', '9', '1', '8', '2008-03-07', '2000', '0', '0', '2', '1', NULL); +INSERT INTO `0_bank_trans` VALUES ('24', '12', '10', '1', '9', '2009-01-10', '1000', '0', '0', '2', '1', NULL); +INSERT INTO `0_bank_trans` VALUES ('25', '12', '11', '1', '10', '2009-01-10', '183.62116393597', '0', '0', '2', '3', NULL); +INSERT INTO `0_bank_trans` VALUES ('26', '22', '4', '1', '3', '2009-01-10', '-200', '0', '0', '3', '1', NULL); +INSERT INTO `0_bank_trans` VALUES ('27', '2', '5', '1', '14', '2009-01-29','200', '0', '0', '4', '3', NULL); +INSERT INTO `0_bank_trans` VALUES ('28', '1', '8', '1', '7', '2009-01-29', '-50', '0', '0', '4', '1', NULL); +INSERT INTO `0_bank_trans` VALUES ('29', '2', '6', '1', '15', '2009-01-29','50', '0', '0', '4', '3', NULL); -CREATE TABLE `0_bank_trans_types` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(60) NOT NULL default '', - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) TYPE=MyISAM AUTO_INCREMENT=4 ; ### Structure of table `0_bom` ### @@ -85,7 +135,17 @@ CREATE TABLE `0_bom` ( KEY `parent` (`parent`,`loc_code`), KEY `Parent_2` (`parent`), KEY `workcentre_added` (`workcentre_added`) -) TYPE=MyISAM AUTO_INCREMENT=6 ; +) TYPE=MyISAM AUTO_INCREMENT=6 AUTO_INCREMENT=6 ; + + +### Data of table `0_bom` ### + +INSERT INTO `0_bom` VALUES ('1', '3400', '102', '1', 'DEF', '1'); +INSERT INTO `0_bom` VALUES ('2', '3400', '103', '1', 'DEF', '1'); +INSERT INTO `0_bom` VALUES ('3', '3400', '104', '1', 'DEF', '1'); +INSERT INTO `0_bom` VALUES ('4', '3400', '201', '1', 'DEF', '1'); +INSERT INTO `0_bom` VALUES ('5', '3400', '103', '1', 'CWA', '1'); + ### Structure of table `0_budget_trans` ### @@ -105,7 +165,12 @@ CREATE TABLE `0_budget_trans` ( `person_id` tinyblob, PRIMARY KEY (`counter`), KEY `Type_and_Number` (`type`,`type_no`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; +) TYPE=InnoDB AUTO_INCREMENT=1 ; + + +### Data of table `0_budget_trans` ### + + ### Structure of table `0_chart_class` ### @@ -116,7 +181,17 @@ CREATE TABLE `0_chart_class` ( `class_name` varchar(60) NOT NULL default '', `balance_sheet` tinyint(1) NOT NULL default '0', PRIMARY KEY (`cid`) -) TYPE=MyISAM ; +) TYPE=MyISAM ; + + +### Data of table `0_chart_class` ### + +INSERT INTO `0_chart_class` VALUES ('1', 'Assets', '1'); +INSERT INTO `0_chart_class` VALUES ('2', 'Liabilities', '1'); +INSERT INTO `0_chart_class` VALUES ('3', 'Income', '0'); +INSERT INTO `0_chart_class` VALUES ('4', 'Costs', '0'); +INSERT INTO `0_chart_class` VALUES ('5', 'Gross', '0'); + ### Structure of table `0_chart_master` ### @@ -127,11 +202,61 @@ CREATE TABLE `0_chart_master` ( `account_code2` varchar(11) default '', `account_name` varchar(60) NOT NULL default '', `account_type` int(11) NOT NULL default '0', - `tax_code` int(11) NOT NULL default '0', + `inactive` tinyint(1) NOT NULL default '0', PRIMARY KEY (`account_code`), KEY `account_code` (`account_code`), KEY `account_name` (`account_name`) -) TYPE=MyISAM ; +) TYPE=MyISAM ; + + +### Data of table `0_chart_master` ### + +INSERT INTO `0_chart_master` VALUES ('3000', '', 'Sales', '1', '0'); +INSERT INTO `0_chart_master` VALUES ('3010', '', 'Sales - Wholesale', '1', '0'); +INSERT INTO `0_chart_master` VALUES ('3020', '', 'Sales of Other items', '1', '0'); +INSERT INTO `0_chart_master` VALUES ('3400', '', 'Difference On Exchange', '1', '0'); +INSERT INTO `0_chart_master` VALUES ('5000', '', 'Direct Labour', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('5050', '', 'Direct Labour Recovery', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('4200', '', 'Material Usage Varaiance', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('4210', '', 'Consumable Materials', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('4220', '', 'Purchase price Variance', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('4000', '', 'Purchases of materials', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('4250', '', 'Discounts Received', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('4260', '', 'Exchange Variation', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('4300', '', 'Freight Inwards', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('4010', '', 'Cost of Goods Sold - Retail', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('6790', '', 'Bank Charges', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('6800', '', 'Entertainments', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('6810', '', 'Legal Expenses', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('6600', '', 'Repairs and Maintenance Office', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('6730', '', 'phone', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('8200', '', 'Bank Interest', '52', '0'); +INSERT INTO `0_chart_master` VALUES ('6840', '', 'Credit Control', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('7040', '', 'Depreciation Office Equipment', '51', '0'); +INSERT INTO `0_chart_master` VALUES ('3800', '', 'Freight Outwards', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('4500', '', 'Packaging', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('6400', '', 'Commissions', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('3200', '', 'Prompt Payment Discounts', '1', '0'); +INSERT INTO `0_chart_master` VALUES ('6700', '', 'General Expenses', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('5200', '', 'Indirect Labour', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('5210', '', 'Overhead Recovery', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('1700', '', 'Bank account', '10', '0'); +INSERT INTO `0_chart_master` VALUES ('1705', '', 'Petty Cash', '10', '0'); +INSERT INTO `0_chart_master` VALUES ('1710', '', 'Foreign currency account', '10', '0'); +INSERT INTO `0_chart_master` VALUES ('1500', '', 'Accounts Receivable', '20', '0'); +INSERT INTO `0_chart_master` VALUES ('1400', '', 'Stocks of Raw Materials', '45', '0'); +INSERT INTO `0_chart_master` VALUES ('1410', '', 'Stocks of Work In Progress', '45', '0'); +INSERT INTO `0_chart_master` VALUES ('1420', '', 'Stocks of Finsihed Goods', '45', '0'); +INSERT INTO `0_chart_master` VALUES ('1430', '', 'Goods Received Clearing account', '30', '0'); +INSERT INTO `0_chart_master` VALUES ('2630', '', 'Accounts Payable', '30', '0'); +INSERT INTO `0_chart_master` VALUES ('2660', '', 'VAT out 5', '30', '0'); +INSERT INTO `0_chart_master` VALUES ('2662', '', 'VAT out 1', '30', '0'); +INSERT INTO `0_chart_master` VALUES ('2664', '', 'VAT out 25', '30', '0'); +INSERT INTO `0_chart_master` VALUES ('2680', '', 'VAT In 5', '30', '0'); +INSERT INTO `0_chart_master` VALUES ('2682', '', 'VAT In 25', '30', '0'); +INSERT INTO `0_chart_master` VALUES ('2050', '', 'Retained Earnings', '50', '0'); +INSERT INTO `0_chart_master` VALUES ('2000', '', 'Share Capital', '50', '0'); + ### Structure of table `0_chart_types` ### @@ -143,8 +268,24 @@ CREATE TABLE `0_chart_types` ( `class_id` tinyint(1) NOT NULL default '0', `parent` int(11) NOT NULL default '-1', PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) TYPE=MyISAM AUTO_INCREMENT=53 ; + KEY `name` (`name`) +) TYPE=MyISAM AUTO_INCREMENT=53 AUTO_INCREMENT=53 ; + + +### Data of table `0_chart_types` ### + +INSERT INTO `0_chart_types` VALUES ('1', 'Sales', '3', '-1'); +INSERT INTO `0_chart_types` VALUES ('2', 'Cost of Sales', '4', '-1'); +INSERT INTO `0_chart_types` VALUES ('5', 'Expenses', '4', '-1'); +INSERT INTO `0_chart_types` VALUES ('10', 'Cash/Bank', '1', '-1'); +INSERT INTO `0_chart_types` VALUES ('20', 'Accounts Receivable', '1', '-1'); +INSERT INTO `0_chart_types` VALUES ('30', 'Accounts Payable', '2', '-1'); +INSERT INTO `0_chart_types` VALUES ('40', 'Fixed Assets', '1', '-1'); +INSERT INTO `0_chart_types` VALUES ('45', 'Inventory', '1', '-1'); +INSERT INTO `0_chart_types` VALUES ('50', 'Equity', '2', '-1'); +INSERT INTO `0_chart_types` VALUES ('51', 'Depreciations', '4', '-1'); +INSERT INTO `0_chart_types` VALUES ('52', 'Financials', '4', '-1'); + ### Structure of table `0_comments` ### @@ -155,7 +296,21 @@ CREATE TABLE `0_comments` ( `id` int(11) NOT NULL default '0', `date_` date default '0000-00-00', `memo_` tinytext -) TYPE=InnoDB ; +) TYPE=InnoDB ; + + +### Data of table `0_comments` ### + +INSERT INTO `0_comments` VALUES ('17', '2', '2006-01-18', 'initial balances'); +INSERT INTO `0_comments` VALUES ('10', '6', '2007-01-30', 'Hi there you got it!'); +INSERT INTO `0_comments` VALUES ('12', '6', '2007-01-30', 'This is good'); +INSERT INTO `0_comments` VALUES ('1', '5', '2007-01-30', 'Total Gas'); +INSERT INTO `0_comments` VALUES ('0', '6', '2007-02-02', 'A big memo'); +INSERT INTO `0_comments` VALUES ('10', '7', '2007-02-03', 'Another big memo, which looks good.'); +INSERT INTO `0_comments` VALUES ('4', '3', '2007-03-09', 'A little cash up front.'); +INSERT INTO `0_comments` VALUES ('26', '6', '2008-02-28', 'nowe '); +INSERT INTO `0_comments` VALUES ('40', '2', '0000-00-00', 'Another project'); + ### Structure of table `0_company` ### @@ -211,8 +366,17 @@ CREATE TABLE `0_company` ( `no_customer_list` tinyint(1) NOT NULL default '0', `no_supplier_list` tinyint(1) NOT NULL default '0', `base_sales` int(11) NOT NULL default '-1', + `foreign_codes` tinyint(1) NOT NULL default '0', + `accumulate_shipping` tinyint(1) NOT NULL default '0', + `legal_text` tinytext NOT NULL, PRIMARY KEY (`coy_code`) -) TYPE=MyISAM ; +) TYPE=MyISAM ; + + +### Data of table `0_company` ### + +INSERT INTO `0_company` VALUES ('1', 'Training Co.', '987654321', '123123123', '1', '1', 'N/A', '202-122320', '202-18889123', 'delta@delta.com', 'logo_frontaccounting.jpg', 'DownTown', 'USD', '1500', '4250', '2630', '1430', '4260', '4220', '2050', '3800', '3000', '3000', '3200', '1420', '4010', '4210', '3000', '1410', '5000', '', '', '', '', '', '', '0', '10', '10', '1000', '20', '20', '30', '1', '7', '0', '0', '0', '0', '0', '0', ''); + ### Structure of table `0_credit_status` ### @@ -222,9 +386,18 @@ CREATE TABLE `0_credit_status` ( `id` int(11) NOT NULL auto_increment, `reason_description` char(100) NOT NULL default '', `dissallow_invoices` tinyint(1) NOT NULL default '0', + `inactive` tinyint(1) NOT NULL default '0', PRIMARY KEY (`id`), UNIQUE KEY `reason_description` (`reason_description`) -) TYPE=MyISAM AUTO_INCREMENT=5 ; +) TYPE=MyISAM AUTO_INCREMENT=5 AUTO_INCREMENT=5 ; + + +### Data of table `0_credit_status` ### + +INSERT INTO `0_credit_status` VALUES ('1', 'Good History', '0', '0'); +INSERT INTO `0_credit_status` VALUES ('3', 'No more work until payment received', '1', '0'); +INSERT INTO `0_credit_status` VALUES ('4', 'In liquidation', '1', '0'); + ### Structure of table `0_currencies` ### @@ -236,8 +409,19 @@ CREATE TABLE `0_currencies` ( `curr_symbol` varchar(10) NOT NULL default '', `country` varchar(100) NOT NULL default '', `hundreds_name` varchar(15) NOT NULL default '', + `inactive` tinyint(1) NOT NULL default '0', PRIMARY KEY (`curr_abrev`) -) TYPE=MyISAM ; +) TYPE=MyISAM ; + + +### Data of table `0_currencies` ### + +INSERT INTO `0_currencies` VALUES ('Kronor', 'SEK', 'kr', 'Sweden', '?ren', '0'); +INSERT INTO `0_currencies` VALUES ('Kroner', 'DKK', 'kr.', 'Denmark', '?re', '0'); +INSERT INTO `0_currencies` VALUES ('Euro', 'EUR', '?', 'Europe', 'Cents', '0'); +INSERT INTO `0_currencies` VALUES ('Pounds', 'GBP', '?', 'England', 'Pence', '0'); +INSERT INTO `0_currencies` VALUES ('US Dollars', 'USD', '$', 'United States', 'Cents', '0'); + ### Structure of table `0_cust_allocations` ### @@ -252,7 +436,19 @@ CREATE TABLE `0_cust_allocations` ( `trans_no_to` int(11) default NULL, `trans_type_to` int(11) default NULL, PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=9 ; +) TYPE=InnoDB AUTO_INCREMENT=12 AUTO_INCREMENT=12 ; + + +### Data of table `0_cust_allocations` ### + +INSERT INTO `0_cust_allocations` VALUES ('5', '135', '2008-03-06', '1', '11', '5', '10'); +INSERT INTO `0_cust_allocations` VALUES ('6', '135', '2008-03-06', '2', '11', '6', '10'); +INSERT INTO `0_cust_allocations` VALUES ('7', '135', '2008-03-06', '3', '11', '4', '10'); +INSERT INTO `0_cust_allocations` VALUES ('8', '125', '2008-03-07', '4', '11', '4', '11'); +INSERT INTO `0_cust_allocations` VALUES ('9', '137.5', '2009-01-10', '10', '12', '9', '10'); +INSERT INTO `0_cust_allocations` VALUES ('10', '125', '2009-01-10', '10', '12', '11', '10'); +INSERT INTO `0_cust_allocations` VALUES ('11', '11', '2009-01-10', '11', '12', '17', '10'); + ### Structure of table `0_cust_branch` ### @@ -278,10 +474,22 @@ CREATE TABLE `0_cust_branch` ( `default_ship_via` int(11) NOT NULL default '1', `disable_trans` tinyint(4) NOT NULL default '0', `br_post_address` tinytext NOT NULL, + `group_no` int(11) NOT NULL default '0', PRIMARY KEY (`branch_code`,`debtor_no`), KEY `branch_code` (`branch_code`), KEY `br_name` (`br_name`) -) TYPE=MyISAM AUTO_INCREMENT=8 ; +) TYPE=MyISAM AUTO_INCREMENT=8 AUTO_INCREMENT=8 ; + + +### Data of table `0_cust_branch` ### + +INSERT INTO `0_cust_branch` VALUES ('1', '1', 'Main', '', '1', '1', '', '', 'Lucky Luke Inc.', 'lucky@luke.com', 'DEF', '1', '3000', '3000', '1500', '3200', '1', '0', 'The Road', '0'); +INSERT INTO `0_cust_branch` VALUES ('2', '1', 'Service divison', '', '4', '1', '', '', '', '', 'DEF', '2', '3000', '3000', '1500', '3200', '1', '0', 'Another Road', '0'); +INSERT INTO `0_cust_branch` VALUES ('3', '2', 'Main', '', '4', '2', '', '', 'Money Makers Ltd.', '', 'DEF', '2', '3000', '3000', '1500', '3200', '1', '0', '', '0'); +INSERT INTO `0_cust_branch` VALUES ('5', '3', 'Main', '', '4', '1', '', '', 'Junk Beer ApS', '', 'CWA', '2', '3000', '3000', '1500', '3200', '1', '0', '', '0'); +INSERT INTO `0_cust_branch` VALUES ('6', '4', 'Johny Bravo', 'Never Mind 13', '1', '1', '123', '', 'Johny Bravo', '', 'DEF', '1', '3000', '3000', '1500', '3200', '1', '0', 'Never Mind 13', '0'); +INSERT INTO `0_cust_branch` VALUES ('7', '3', 'Junk Beer ApS', 'N/A', '1', '1', '1223123', '', 'junk@junkbeer.dk', '', 'DEF', '5', '3000', '3000', '1500', '3200', '1', '0', 'N/A', '0'); + ### Structure of table `0_debtor_trans` ### @@ -307,9 +515,77 @@ CREATE TABLE `0_debtor_trans` ( `rate` double NOT NULL default '1', `ship_via` int(11) default NULL, `trans_link` int(11) NOT NULL default '0', + `dimension_id` int(11) NOT NULL default '0', + `dimension2_id` int(11) NOT NULL default '0', PRIMARY KEY (`trans_no`,`type`), KEY `debtor_no` (`debtor_no`,`branch_code`) -) TYPE=InnoDB ; +) TYPE=InnoDB ; + + +### Data of table `0_debtor_trans` ### + +INSERT INTO `0_debtor_trans` VALUES ('1', '10', '0', '4', '6', '2008-03-06', '2008-03-16', '0', '1', '1', '125', '0', '10', '0', '0', '0', '1', '1', '1', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('1', '11', '0', '4', '6', '2008-03-06', '0000-00-00', '0', '1', '5', '125', '0', '10', '0', '0', '0', '1', '1', '5', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('1', '13', '1', '4', '6', '2008-03-06', '2008-03-16', '0', '1', '1', '125', '0', '10', '0', '0', '0', '1', '1', '1', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('2', '10', '0', '4', '6', '2008-03-06', '2008-03-06', '1', '1', '2', '125', '0', '10', '0', '0', '0', '1', '1', '2', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('2', '11', '0', '4', '6', '2008-03-06', '0000-00-00', '1', '1', '6', '125', '0', '10', '0', '0', '135', '1', '1', '6', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('2', '13', '1', '4', '6', '2008-03-06', '2008-03-06', 'auto', '1', '2', '125', '0', '10', '0', '0', '0', '1', '1', '2', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('3', '10', '0', '4', '6', '2008-03-06', '2008-03-06', '2', '1', '3', '125', '0', '10', '0', '0', '0', '1', '1', '3', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('3', '11', '0', '4', '6', '2008-03-06', '0000-00-00', '2', '1', '4', '125', '0', '10', '0', '0', '135', '1', '1', '4', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('3', '13', '1', '4', '6', '2008-03-06', '2008-03-06', 'auto', '1', '3', '125', '0', '10', '0', '0', '0', '1', '1', '3', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('4', '10', '1', '4', '6', '2008-03-06', '2008-03-06', '3', '1', '4', '125', '0', '10', '0', '0', '135', '1', '1', '4', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('4', '11', '0', '1', '1', '2008-03-07', '0000-00-00', '3', '1', '0', '100', '25', '0', '0', '0', '250', '1', '1', '0', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('4', '13', '1', '4', '6', '2008-03-06', '2008-03-06', 'auto', '1', '4', '125', '0', '10', '0', '0', '0', '1', '1', '4', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('5', '10', '1', '4', '6', '2008-03-06', '2008-03-06', '4', '1', '5', '125', '0', '10', '0', '0', '135', '1', '1', '5', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('5', '13', '1', '4', '6', '2008-03-06', '2008-03-06', 'auto', '1', '5', '125', '0', '10', '0', '0', '0', '1', '1', '5', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('6', '10', '1', '4', '6', '2008-03-06', '2008-03-06', '5', '1', '6', '125', '0', '10', '0', '0', '135', '1', '1', '6', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('6', '13', '1', '4', '6', '2008-03-06', '2008-03-06', 'auto', '1', '6', '125', '0', '10', '0', '0', '0', '1', '1', '6', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('7', '10', '0', '4', '6', '2008-03-08', '2008-03-08', '6', '1', '9', '125', '0', '10', '0', '0', '0', '1', '1', '9', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('7', '12', '0', '1', '1', '2008-03-06', '0000-00-00', '6', '0', '0', '100', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('7', '13', '0', '4', '6', '2008-03-06', '2008-03-06', '1', '1', '7', '125', '0', '10', '0', '0', '0', '1', '1', '0', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('8', '10', '0', '4', '6', '2008-03-09', '2008-03-09', '7', '1', '10', '125', '0', '12.5', '0', '0', '0', '1', '1', '10', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('8', '12', '0', '4', '6', '2008-03-06', '0000-00-00', '7', '0', '0', '100', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('8', '13', '1', '4', '6', '2008-03-07', '2008-03-07', '2', '1', '8', '125', '0', '10', '0', '0', '0', '1', '1', '13', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('9', '10', '0', '1', '1', '2008-03-09', '2008-03-09', '8', '2', '11', '100', '25', '10', '2.5', '0', '137.5', '1', '1', '11', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('9', '12', '0', '1', '1', '2008-03-07', '0000-00-00', '8', '0', '0', '2000', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('9', '13', '1', '4', '6', '2008-03-08', '2008-03-08', 'auto', '1', '9', '125', '0', '10', '0', '0', '0', '1', '1', '7', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('10', '10', '0', '4', '6', '2008-03-09', '2008-03-09', '9', '1', '12', '125', '0', '10', '0', '0', '0', '1', '1', '12', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('10', '12', '0', '1', '1', '2009-01-10', '0000-00-00', '9', '0', '0', '1000', '0', '0', '0', '0', '262.5', '1', '0', '0', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('10', '13', '1', '4', '6', '2008-03-09', '2008-03-09', 'auto', '1', '10', '125', '0', '12.5', '0', '0', '0', '1', '1', '8', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('11', '10', '0', '1', '1', '2008-03-10', '2008-03-20', '10', '2', '15', '100', '25', '0', '0', '0', '125', '1', '1', '14', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('11', '12', '0', '3', '7', '2009-01-10', '0000-00-00', '10', '0', '0', '1000', '0', '0', '0', '0', '11', '0.1836', '0', '0', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('11', '13', '1', '1', '1', '2008-03-09', '2008-03-09', 'auto', '2', '11', '100', '25', '10', '2.5', '0', '0', '1', '1', '9', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('12', '10', '0', '1', '1', '2008-03-10', '2008-03-29', '11', '2', '16', '100', '25', '0', '0', '0', '0', '1', '1', '15', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('12', '13', '1', '4', '6', '2008-03-09', '2008-03-09', 'auto', '1', '12', '125', '0', '10', '0', '0', '0', '1', '1', '10', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('13', '10', '0', '4', '6', '2008-03-07', '2008-03-07', '12', '1', '8', '125', '0', '10', '0', '0', '0', '1', '1', '8', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('13', '13', '1', '4', '6', '2008-03-10', '2008-03-20', '3', '1', '14', '40', '0', '0', '0', '0', '0', '1', '1', '15', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('14', '10', '0', '4', '6', '2008-03-10', '2008-03-10', '13', '1', '18', '125', '0', '10', '0', '0', '0', '1', '1', '17', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('14', '13', '1', '1', '1', '2008-03-10', '2008-03-20', '4', '2', '15', '100', '25', '0', '0', '0', '0', '1', '1', '11', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('15', '10', '0', '4', '6', '2008-03-10', '2008-04-17', '14', '1', '14', '40', '0', '0', '0', '0', '0', '1', '1', '13', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('15', '13', '1', '1', '1', '2008-03-10', '2008-03-20', '5', '2', '16', '100', '25', '0', '0', '0', '0', '1', '1', '12', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('16', '10', '0', '4', '6', '2008-03-17', '2008-04-17', '15', '1', '19', '125', '0', '10', '0', '0', '0', '1', '1', '18', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('16', '13', '1', '3', '5', '2008-03-10', '2008-03-20', '6', '1', '17', '11', '0', '0', '0', '0', '0', '0.20563796227935', '1', '17', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('17', '10', '0', '3', '5', '2008-03-10', '2008-04-17', '16', '1', '17', '11', '0', '0', '0', '0', '11', '0.20563796227935', '1', '16', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('17', '13', '1', '4', '6', '2008-03-10', '2008-03-10', 'auto', '1', '18', '125', '0', '10', '0', '0', '0', '1', '1', '14', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('18', '10', '0', '3', '5', '2008-03-29', '2008-04-17', '17', '1', '20', '0', '0', '0', '0', '0', '0', '0.20674817019223', '1', '19', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('18', '13', '1', '4', '6', '2008-03-17', '2008-03-27', '7', '1', '19', '125', '0', '10', '0', '0', '0', '1', '1', '16', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('19', '10', '0', '4', '6', '2008-03-29', '2008-04-17', '18', '1', '21', '125', '0', '0', '0', '0', '0', '1', '1', '20', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('19', '13', '1', '3', '5', '2008-03-29', '2008-04-17', 'auto', '1', '20', '0', '0', '0', '0', '0', '0', '0.20674817019223', '1', '18', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('20', '10', '0', '1', '1', '2009-01-10', '2009-02-17', '19', '2', '22', '30', '7.5', '0', '0', '0', '0', '1', '1', '21', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('20', '13', '1', '4', '6', '2008-03-29', '2008-04-08', '8', '1', '21', '125', '0', '0', '0', '0', '0', '1', '1', '19', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('21', '10', '0', '3', '7', '2009-01-29', '2009-01-29', '20', '1', '23', '100', '0', '0', '0', '0', '0', '0.17593462333271', '1', '22', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('21', '13', '1', '1', '1', '2009-01-10', '2009-02-17', 'auto', '2', '22', '30', '7.5', '0', '0', '0', '0', '1', '1', '20', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('22', '10', '0', '3', '7', '2009-01-29', '2009-02-17', '21', '1', '24', '100', '0', '0', '0', '0', '0', '0.17593462333271', '1', '23', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('22', '13', '1', '3', '7', '2009-01-29', '2009-01-29', 'auto', '1', '23', '100', '0', '0', '0', '0', '0', '0.17593462333271', '1', '21', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('23', '10', '0', '3', '7', '2009-01-29', '2009-02-17', '22', '1', '25', '100', '0', '0', '0', '0', '0', '0.17593462333271', '1', '24', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('23', '13', '1', '3', '7', '2009-01-29', '2009-02-17', 'auto', '1', '24', '100', '0', '0', '0', '0', '0', '0.17593462333271', '1', '22', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('24', '10', '0', '3', '7', '2009-01-29', '2009-02-17', '23', '1', '26', '100', '0', '0', '0', '0', '0', '0.17593462333271', '1', '25', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('24', '13', '1', '3', '7', '2009-01-29', '2009-02-17', 'auto', '1', '25', '100', '0', '0', '0', '0', '0', '0.17593462333271', '1', '23', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('25', '10', '0', '3', '7', '2009-01-29', '2009-02-17', '24', '1', '27', '100', '0', '0', '0', '0', '0', '0.17593462333271', '1', '26', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('25', '13', '1', '3', '7', '2009-01-29', '2009-02-17', 'auto', '1', '26', '100', '0', '0', '0', '0', '0', '0.17593462333271', '1', '24', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('26', '13', '1', '3', '7', '2009-01-29', '2009-02-17', 'auto', '1', '27', '100', '0', '0', '0', '0', '0', '0.17593462333271', '1', '25', '0', '0'); +INSERT INTO `0_debtor_trans` VALUES ('27', '13', '0', '3', '7', '2009-01-30', '2009-01-31', '9', '1', '28', '110', '0', '0', '0', '0', '0', '0.17593462333271', '1', '0', '0', '0'); + ### Structure of table `0_debtor_trans_details` ### @@ -328,23 +604,70 @@ CREATE TABLE `0_debtor_trans_details` ( `standard_cost` double NOT NULL default '0', `qty_done` double NOT NULL default '0', PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=46 ; +) TYPE=InnoDB AUTO_INCREMENT=59 AUTO_INCREMENT=59 ; -### Structure of table `0_debtor_trans_tax_details` ### -DROP TABLE IF EXISTS `0_debtor_trans_tax_details`; +### Data of table `0_debtor_trans_details` ### + +INSERT INTO `0_debtor_trans_details` VALUES ('1', '1', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('2', '1', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('3', '2', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('4', '2', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('5', '3', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('6', '3', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('7', '4', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('8', '4', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('9', '5', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('10', '5', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('11', '1', '11', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('12', '6', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('13', '6', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('14', '7', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('15', '2', '11', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('16', '3', '11', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('17', '4', '11', '102', '17 inch VGA Monitor', '100', '25', '1', '0', '0', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('18', '8', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('19', '9', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('20', '7', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('21', '10', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('22', '8', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('23', '11', '13', '102', '17 inch VGA Monitor', '100', '25', '1', '0', '80', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('24', '9', '10', '102', '17 inch VGA Monitor', '100', '25', '1', '0', '80', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('25', '12', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('26', '10', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('27', '13', '13', '103', '32MB VGA Card', '40', '8', '1', '0', '20', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('28', '14', '13', '102', '17 inch VGA Monitor', '100', '25', '1', '0', '80', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('29', '11', '10', '102', '17 inch VGA Monitor', '100', '25', '1', '0', '80', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('30', '15', '13', '102', '17 inch VGA Monitor', '100', '25', '1', '0', '80', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('31', '12', '10', '102', '17 inch VGA Monitor', '100', '25', '1', '0', '80', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('32', '13', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('33', '16', '13', '102', '17 inch VGA Monitor', '11', '0', '1', '0', '80', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('34', '17', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('35', '14', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('36', '15', '10', '103', '32MB VGA Card', '40', '8', '1', '0', '20', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('37', '18', '13', '102', '17 inch VGA Monitor', '125', '25', '0', '0', '-3.4114285714283', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('38', '18', '13', 'AA101', 'olie 5w40', '125', '25', '1', '0', '5.0599509174312', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('39', '16', '10', '102', '17 inch VGA Monitor', '125', '25', '0', '0', '-3.4114285714283', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('40', '16', '10', 'AA101', 'olie 5w40', '125', '25', '1', '0', '5.0599509174312', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('41', '17', '10', '102', '17 inch VGA Monitor', '11', '0', '1', '0', '80', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('42', '19', '13', '102', '17 inch VGA Monitor', '0', '0', '1', '0', '-3.4114285714283', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('43', '18', '10', '102', '17 inch VGA Monitor', '0', '0', '1', '0', '-3.4114285714283', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('44', '20', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '-3.4114285714283', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('45', '19', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '-3.4114285714283', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('46', '21', '13', '201', 'Assembly Labour', '30', '7.5', '1', '0', '0', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('47', '20', '10', '201', 'Assembly Labour', '30', '7.5', '1', '0', '0', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('48', '22', '13', '201', 'Assembly Labour', '100', '20', '1', '0', '0', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('49', '21', '10', '201', 'Assembly Labour', '100', '20', '1', '0', '0', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('50', '23', '13', '201', 'Assembly Labour', '100', '20', '1', '0', '0', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('51', '22', '10', '201', 'Assembly Labour', '100', '20', '1', '0', '0', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('52', '24', '13', '201', 'Assembly Labour', '100', '20', '1', '0', '0', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('53', '23', '10', '201', 'Assembly Labour', '100', '20', '1', '0', '0', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('54', '25', '13', '201', 'Assembly Labour', '100', '20', '1', '0', '0', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('55', '24', '10', '201', 'Assembly Labour', '100', '20', '1', '0', '0', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('56', '26', '13', '201', 'Assembly Labour', '100', '0', '1', '0', '0', '1'); +INSERT INTO `0_debtor_trans_details` VALUES ('57', '25', '10', '201', 'Assembly Labour', '100', '0', '1', '0', '0', '0'); +INSERT INTO `0_debtor_trans_details` VALUES ('58', '27', '13', '201', 'Assembly Labour', '110', '0', '1', '0', '0', '0'); -CREATE TABLE `0_debtor_trans_tax_details` ( - `id` int(11) NOT NULL auto_increment, - `debtor_trans_no` int(11) default NULL, - `debtor_trans_type` int(11) default NULL, - `tax_type_id` int(11) NOT NULL default '0', - `tax_type_name` varchar(60) default NULL, - `rate` double NOT NULL default '0', - `included_in_price` tinyint(1) NOT NULL default '0', - `amount` double NOT NULL default '0', - PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=40 ; ### Structure of table `0_debtors_master` ### @@ -365,9 +688,19 @@ CREATE TABLE `0_debtors_master` ( `discount` double NOT NULL default '0', `pymt_discount` double NOT NULL default '0', `credit_limit` float NOT NULL default '1000', + `inactive` tinyint(1) NOT NULL default '0', PRIMARY KEY (`debtor_no`), UNIQUE KEY `name` (`name`) -) TYPE=MyISAM AUTO_INCREMENT=5 ; +) TYPE=MyISAM AUTO_INCREMENT=5 AUTO_INCREMENT=5 ; + + +### Data of table `0_debtors_master` ### + +INSERT INTO `0_debtors_master` VALUES ('1', 'Lucky Luke Inc.', '35 Waldorf Street\r\nTown 19358, AR', 'joe@home.com', '12311231', 'USD', '2', '0', '0', '1', '1', '0', '0', '1000', '0'); +INSERT INTO `0_debtors_master` VALUES ('2', 'Money Makers Ltd.', 'N/A', '', '9876543', 'GBP', '2', '0', '0', '1', '1', '0', '0', '1000', '0'); +INSERT INTO `0_debtors_master` VALUES ('3', 'Junk Beer ApS', 'N/A', '', '123321123', 'DKK', '1', '0', '0', '1', '1', '0', '0', '1000', '0'); +INSERT INTO `0_debtors_master` VALUES ('4', 'Retail clients', 'Never Mind 13', '', '', 'USD', '1', '0', '0', '1', '1', '0', '0', '1000', '0'); + ### Structure of table `0_dimensions` ### @@ -383,7 +716,15 @@ CREATE TABLE `0_dimensions` ( `due_date` date NOT NULL default '0000-00-00', PRIMARY KEY (`id`), UNIQUE KEY `reference` (`reference`) -) TYPE=InnoDB AUTO_INCREMENT=4 ; +) TYPE=InnoDB AUTO_INCREMENT=4 AUTO_INCREMENT=4 ; + + +### Data of table `0_dimensions` ### + +INSERT INTO `0_dimensions` VALUES ('1', '1', 'Development', '1', '0', '2006-01-18', '2006-02-07'); +INSERT INTO `0_dimensions` VALUES ('2', '2', 'Support', '1', '0', '2006-01-18', '2007-03-07'); +INSERT INTO `0_dimensions` VALUES ('3', '3', 'Training', '2', '0', '2006-01-18', '2007-03-07'); + ### Structure of table `0_exchange_rates` ### @@ -397,7 +738,31 @@ CREATE TABLE `0_exchange_rates` ( `date_` date NOT NULL default '0000-00-00', PRIMARY KEY (`id`), UNIQUE KEY `curr_code` (`curr_code`,`date_`) -) TYPE=MyISAM AUTO_INCREMENT=13 ; +) TYPE=MyISAM AUTO_INCREMENT=21 AUTO_INCREMENT=21 ; + + +### Data of table `0_exchange_rates` ### + +INSERT INTO `0_exchange_rates` VALUES ('2', 'GBP', '1.2', '1.2', '2006-01-18'); +INSERT INTO `0_exchange_rates` VALUES ('3', 'SEK', '0.1667', '0.1667', '2007-01-29'); +INSERT INTO `0_exchange_rates` VALUES ('4', 'DKK', '0.2', '0.2', '2007-03-05'); +INSERT INTO `0_exchange_rates` VALUES ('5', 'EUR', '1.1', '1.1', '2007-03-05'); +INSERT INTO `0_exchange_rates` VALUES ('6', 'DKK', '0.20563796227935', '0.20563796227935', '2008-03-06'); +INSERT INTO `0_exchange_rates` VALUES ('7', 'EUR', '1.5561', '1.5561', '2008-03-15'); +INSERT INTO `0_exchange_rates` VALUES ('8', 'DKK', '0.20867920985932', '0.20867920985932', '2008-03-16'); +INSERT INTO `0_exchange_rates` VALUES ('9', 'GBP', '1.9816266221251', '1.9816266221251', '2008-03-24'); +INSERT INTO `0_exchange_rates` VALUES ('10', 'DKK', '0.20674817019223', '0.20674817019223', '2008-03-24'); +INSERT INTO `0_exchange_rates` VALUES ('11', 'EUR', '1.5569', '1.5569', '2008-03-25'); +INSERT INTO `0_exchange_rates` VALUES ('12', 'EUR', '1.5796', '1.5796', '2008-03-28'); +INSERT INTO `0_exchange_rates` VALUES ('13', 'DKK', '0.18362116393597', '0.18362116393597', '2009-01-10'); +INSERT INTO `0_exchange_rates` VALUES ('14', 'GBP', '1.5292802860975', '1.5292802860975', '2009-01-10'); +INSERT INTO `0_exchange_rates` VALUES ('15', 'DKK', '0.17593462333271', '0.17593462333271', '2009-01-29'); +INSERT INTO `0_exchange_rates` VALUES ('16', 'GBP', '1.4293813028073', '1.4293813028073', '2009-01-29'); +INSERT INTO `0_exchange_rates` VALUES ('17', 'DKK', '0.17593462333271', '0.17593462333271', '2009-01-30'); +INSERT INTO `0_exchange_rates` VALUES ('18', 'GBP', '1.4293813028073', '1.4293813028073', '2009-01-30'); +INSERT INTO `0_exchange_rates` VALUES ('19', 'EUR', '1.3111', '1.3111', '2009-01-30'); +INSERT INTO `0_exchange_rates` VALUES ('20', 'SEK', '0.12446246001082', '0.12446246001082', '2009-01-30'); + ### Structure of table `0_fiscal_year` ### @@ -409,7 +774,17 @@ CREATE TABLE `0_fiscal_year` ( `end` date default '0000-00-00', `closed` tinyint(1) NOT NULL default '0', PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=7 ; +) TYPE=InnoDB AUTO_INCREMENT=8 AUTO_INCREMENT=8 ; + + +### Data of table `0_fiscal_year` ### + +INSERT INTO `0_fiscal_year` VALUES ('1', '2006-01-01', '2006-12-31', '0'); +INSERT INTO `0_fiscal_year` VALUES ('2', '2007-01-01', '2007-12-31', '0'); +INSERT INTO `0_fiscal_year` VALUES ('5', '2005-01-01', '2005-12-31', '1'); +INSERT INTO `0_fiscal_year` VALUES ('6', '2008-01-01', '2008-12-31', '0'); +INSERT INTO `0_fiscal_year` VALUES ('7', '2009-01-01', '2009-12-31', '0'); + ### Structure of table `0_gl_trans` ### @@ -429,967 +804,10 @@ CREATE TABLE `0_gl_trans` ( `person_id` tinyblob, PRIMARY KEY (`counter`), KEY `Type_and_Number` (`type`,`type_no`) -) TYPE=InnoDB AUTO_INCREMENT=170 ; - -### Structure of table `0_grn_batch` ### - -DROP TABLE IF EXISTS `0_grn_batch`; - -CREATE TABLE `0_grn_batch` ( - `id` int(11) NOT NULL auto_increment, - `supplier_id` int(11) NOT NULL default '0', - `purch_order_no` int(11) default NULL, - `reference` varchar(60) NOT NULL default '', - `delivery_date` date NOT NULL default '0000-00-00', - `loc_code` varchar(5) default NULL, - PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=13 ; - -### Structure of table `0_grn_items` ### - -DROP TABLE IF EXISTS `0_grn_items`; - -CREATE TABLE `0_grn_items` ( - `id` int(11) NOT NULL auto_increment, - `grn_batch_id` int(11) default NULL, - `po_detail_item` int(11) NOT NULL default '0', - `item_code` varchar(20) NOT NULL default '', - `description` tinytext, - `qty_recd` double NOT NULL default '0', - `quantity_inv` double NOT NULL default '0', - PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=17 ; - -### Structure of table `0_item_tax_type_exemptions` ### +) TYPE=InnoDB AUTO_INCREMENT=215 AUTO_INCREMENT=215 ; -DROP TABLE IF EXISTS `0_item_tax_type_exemptions`; - -CREATE TABLE `0_item_tax_type_exemptions` ( - `item_tax_type_id` int(11) NOT NULL default '0', - `tax_type_id` int(11) NOT NULL default '0', - PRIMARY KEY (`item_tax_type_id`,`tax_type_id`) -) TYPE=InnoDB ; -### Structure of table `0_item_tax_types` ### - -DROP TABLE IF EXISTS `0_item_tax_types`; - -CREATE TABLE `0_item_tax_types` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(60) NOT NULL default '', - `exempt` tinyint(1) NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) TYPE=InnoDB AUTO_INCREMENT=3 ; - -### Structure of table `0_item_units` ### - -DROP TABLE IF EXISTS `0_item_units`; - -CREATE TABLE `0_item_units` ( - `abbr` varchar(20) NOT NULL default '', - `name` varchar(40) NOT NULL default '', - `decimals` tinyint(2) NOT NULL default '0', - PRIMARY KEY (`abbr`), - UNIQUE KEY `name` (`name`) -) TYPE=MyISAM COMMENT='units of measure' ; - -### Structure of table `0_loc_stock` ### - -DROP TABLE IF EXISTS `0_loc_stock`; - -CREATE TABLE `0_loc_stock` ( - `loc_code` char(5) NOT NULL default '', - `stock_id` char(20) NOT NULL default '', - `reorder_level` bigint(20) NOT NULL default '0', - PRIMARY KEY (`loc_code`,`stock_id`), - KEY `stock_id` (`stock_id`) -) TYPE=InnoDB ; - -### Structure of table `0_locations` ### - -DROP TABLE IF EXISTS `0_locations`; - -CREATE TABLE `0_locations` ( - `loc_code` varchar(5) NOT NULL default '', - `location_name` varchar(60) NOT NULL default '', - `delivery_address` tinytext NOT NULL, - `phone` varchar(30) NOT NULL default '', - `fax` varchar(30) NOT NULL default '', - `email` varchar(100) NOT NULL default '', - `contact` varchar(30) NOT NULL default '', - PRIMARY KEY (`loc_code`) -) TYPE=MyISAM ; - -### Structure of table `0_movement_types` ### - -DROP TABLE IF EXISTS `0_movement_types`; - -CREATE TABLE `0_movement_types` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(60) NOT NULL default '', - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) TYPE=MyISAM AUTO_INCREMENT=2 ; - -### Structure of table `0_payment_terms` ### - -DROP TABLE IF EXISTS `0_payment_terms`; - -CREATE TABLE `0_payment_terms` ( - `terms_indicator` int(11) NOT NULL auto_increment, - `terms` char(80) NOT NULL default '', - `days_before_due` smallint(6) NOT NULL default '0', - `day_in_following_month` smallint(6) NOT NULL default '0', - PRIMARY KEY (`terms_indicator`), - UNIQUE KEY `terms` (`terms`) -) TYPE=MyISAM AUTO_INCREMENT=5 ; - -### Structure of table `0_prices` ### - -DROP TABLE IF EXISTS `0_prices`; - -CREATE TABLE `0_prices` ( - `id` int(11) NOT NULL auto_increment, - `stock_id` varchar(20) NOT NULL default '', - `sales_type_id` int(11) NOT NULL default '0', - `curr_abrev` char(3) NOT NULL default '', - `price` double NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `price` (`stock_id`,`sales_type_id`,`curr_abrev`) -) TYPE=MyISAM AUTO_INCREMENT=13 ; - -### Structure of table `0_purch_data` ### - -DROP TABLE IF EXISTS `0_purch_data`; - -CREATE TABLE `0_purch_data` ( - `supplier_id` int(11) NOT NULL default '0', - `stock_id` char(20) NOT NULL default '', - `price` double NOT NULL default '0', - `suppliers_uom` char(50) NOT NULL default '', - `conversion_factor` double NOT NULL default '1', - `supplier_description` char(50) NOT NULL default '', - PRIMARY KEY (`supplier_id`,`stock_id`) -) TYPE=MyISAM ; - -### Structure of table `0_purch_order_details` ### - -DROP TABLE IF EXISTS `0_purch_order_details`; - -CREATE TABLE `0_purch_order_details` ( - `po_detail_item` int(11) NOT NULL auto_increment, - `order_no` int(11) NOT NULL default '0', - `item_code` varchar(20) NOT NULL default '', - `description` tinytext, - `delivery_date` date NOT NULL default '0000-00-00', - `qty_invoiced` double NOT NULL default '0', - `unit_price` double NOT NULL default '0', - `act_price` double NOT NULL default '0', - `std_cost_unit` double NOT NULL default '0', - `quantity_ordered` double NOT NULL default '0', - `quantity_received` double NOT NULL default '0', - PRIMARY KEY (`po_detail_item`) -) TYPE=InnoDB AUTO_INCREMENT=18 ; - -### Structure of table `0_purch_orders` ### - -DROP TABLE IF EXISTS `0_purch_orders`; - -CREATE TABLE `0_purch_orders` ( - `order_no` int(11) NOT NULL auto_increment, - `version` tinyint(1) unsigned NOT NULL default '0', - `supplier_id` int(11) NOT NULL default '0', - `comments` tinytext, - `ord_date` date NOT NULL default '0000-00-00', - `reference` tinytext NOT NULL, - `requisition_no` tinytext, - `into_stock_location` varchar(5) NOT NULL default '', - `delivery_address` tinytext NOT NULL, - PRIMARY KEY (`order_no`) -) TYPE=InnoDB AUTO_INCREMENT=14 ; - -### Structure of table `0_refs` ### - -DROP TABLE IF EXISTS `0_refs`; - -CREATE TABLE `0_refs` ( - `id` int(11) NOT NULL default '0', - `type` int(11) NOT NULL default '0', - `reference` varchar(100) NOT NULL default '', - PRIMARY KEY (`id`,`type`) -) TYPE=InnoDB ; - -### Structure of table `0_sales_order_details` ### - -DROP TABLE IF EXISTS `0_sales_order_details`; - -CREATE TABLE `0_sales_order_details` ( - `id` int(11) NOT NULL auto_increment, - `order_no` int(11) NOT NULL default '0', - `stk_code` varchar(20) NOT NULL default '', - `description` tinytext, - `qty_sent` double NOT NULL default '0', - `unit_price` double NOT NULL default '0', - `quantity` double NOT NULL default '0', - `discount_percent` double NOT NULL default '0', - PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=24 ; - -### Structure of table `0_sales_orders` ### - -DROP TABLE IF EXISTS `0_sales_orders`; - -CREATE TABLE `0_sales_orders` ( - `order_no` int(11) NOT NULL auto_increment, - `version` tinyint(1) unsigned NOT NULL default '0', - `type` tinyint(1) NOT NULL default '0', - `debtor_no` int(11) NOT NULL default '0', - `branch_code` int(11) NOT NULL default '0', - `customer_ref` tinytext NOT NULL, - `comments` tinytext, - `ord_date` date NOT NULL default '0000-00-00', - `order_type` int(11) NOT NULL default '0', - `ship_via` int(11) NOT NULL default '0', - `delivery_address` tinytext NOT NULL, - `contact_phone` varchar(30) default NULL, - `contact_email` varchar(100) default NULL, - `deliver_to` tinytext NOT NULL, - `freight_cost` double NOT NULL default '0', - `from_stk_loc` varchar(5) NOT NULL default '', - `delivery_date` date NOT NULL default '0000-00-00', - PRIMARY KEY (`order_no`) -) TYPE=InnoDB AUTO_INCREMENT=22 ; - -### Structure of table `0_sales_types` ### - -DROP TABLE IF EXISTS `0_sales_types`; - -CREATE TABLE `0_sales_types` ( - `id` int(11) NOT NULL auto_increment, - `sales_type` char(50) NOT NULL default '', - `tax_included` int(1) NOT NULL default '0', - `factor` double NOT NULL default '1', - PRIMARY KEY (`id`), - UNIQUE KEY `sales_type` (`sales_type`) -) TYPE=MyISAM AUTO_INCREMENT=3 ; - -### Structure of table `0_salesman` ### - -DROP TABLE IF EXISTS `0_salesman`; - -CREATE TABLE `0_salesman` ( - `salesman_code` int(11) NOT NULL auto_increment, - `salesman_name` varchar(60) NOT NULL default '', - `salesman_phone` varchar(30) NOT NULL default '', - `salesman_fax` varchar(30) NOT NULL default '', - `salesman_email` varchar(100) NOT NULL default '', - `provision` double NOT NULL default '0', - `break_pt` double NOT NULL default '0', - `provision2` double NOT NULL default '0', - PRIMARY KEY (`salesman_code`), - UNIQUE KEY `salesman_name` (`salesman_name`) -) TYPE=MyISAM AUTO_INCREMENT=3 ; - -### Structure of table `0_shippers` ### - -DROP TABLE IF EXISTS `0_shippers`; - -CREATE TABLE `0_shippers` ( - `shipper_id` int(11) NOT NULL auto_increment, - `shipper_name` varchar(60) NOT NULL default '', - `phone` varchar(30) NOT NULL default '', - `contact` tinytext NOT NULL, - `address` tinytext NOT NULL, - PRIMARY KEY (`shipper_id`), - UNIQUE KEY `name` (`shipper_name`) -) TYPE=MyISAM AUTO_INCREMENT=3 ; - -### Structure of table `0_stock_category` ### - -DROP TABLE IF EXISTS `0_stock_category`; - -CREATE TABLE `0_stock_category` ( - `category_id` int(11) NOT NULL auto_increment, - `description` varchar(60) NOT NULL default '', - `stock_act` varchar(11) default NULL, - `cogs_act` varchar(11) default NULL, - `adj_gl_act` varchar(11) default NULL, - `purch_price_var_act` varchar(11) default NULL, - PRIMARY KEY (`category_id`), - UNIQUE KEY `description` (`description`) -) TYPE=MyISAM AUTO_INCREMENT=5 ; - -### Structure of table `0_stock_master` ### - -DROP TABLE IF EXISTS `0_stock_master`; - -CREATE TABLE `0_stock_master` ( - `stock_id` varchar(20) NOT NULL default '', - `category_id` int(11) NOT NULL default '0', - `tax_type_id` int(11) NOT NULL default '0', - `description` varchar(200) NOT NULL default '', - `long_description` tinytext NOT NULL, - `units` varchar(20) NOT NULL default 'each', - `mb_flag` char(1) NOT NULL default 'B', - `sales_account` varchar(11) NOT NULL default '', - `cogs_account` varchar(11) NOT NULL default '', - `inventory_account` varchar(11) NOT NULL default '', - `adjustment_account` varchar(11) NOT NULL default '', - `assembly_account` varchar(11) NOT NULL default '', - `dimension_id` int(11) default NULL, - `dimension2_id` int(11) default NULL, - `actual_cost` double NOT NULL default '0', - `last_cost` double NOT NULL default '0', - `material_cost` double NOT NULL default '0', - `labour_cost` double NOT NULL default '0', - `overhead_cost` double NOT NULL default '0', - PRIMARY KEY (`stock_id`) -) TYPE=InnoDB ; - -### Structure of table `0_stock_moves` ### - -DROP TABLE IF EXISTS `0_stock_moves`; - -CREATE TABLE `0_stock_moves` ( - `trans_id` int(11) NOT NULL auto_increment, - `trans_no` int(11) NOT NULL default '0', - `stock_id` char(20) NOT NULL default '', - `type` smallint(6) NOT NULL default '0', - `loc_code` char(5) NOT NULL default '', - `tran_date` date NOT NULL default '0000-00-00', - `person_id` int(11) default NULL, - `price` double NOT NULL default '0', - `reference` char(40) NOT NULL default '', - `qty` double NOT NULL default '1', - `discount_percent` double NOT NULL default '0', - `standard_cost` double NOT NULL default '0', - `visible` tinyint(1) NOT NULL default '1', - PRIMARY KEY (`trans_id`), - KEY `type` (`type`,`trans_no`) -) TYPE=InnoDB AUTO_INCREMENT=42 ; - -### Structure of table `0_supp_allocations` ### - -DROP TABLE IF EXISTS `0_supp_allocations`; - -CREATE TABLE `0_supp_allocations` ( - `id` int(11) NOT NULL auto_increment, - `amt` double unsigned default NULL, - `date_alloc` date NOT NULL default '0000-00-00', - `trans_no_from` int(11) default NULL, - `trans_type_from` int(11) default NULL, - `trans_no_to` int(11) default NULL, - `trans_type_to` int(11) default NULL, - PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=10 ; - -### Structure of table `0_supp_invoice_items` ### - -DROP TABLE IF EXISTS `0_supp_invoice_items`; - -CREATE TABLE `0_supp_invoice_items` ( - `id` int(11) NOT NULL auto_increment, - `supp_trans_no` int(11) default NULL, - `supp_trans_type` int(11) default NULL, - `gl_code` varchar(11) NOT NULL default '0', - `grn_item_id` int(11) default NULL, - `po_detail_item_id` int(11) default NULL, - `stock_id` varchar(20) NOT NULL default '', - `description` tinytext, - `quantity` double NOT NULL default '0', - `unit_price` double NOT NULL default '0', - `unit_tax` double NOT NULL default '0', - `memo_` tinytext, - PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=22 ; - -### Structure of table `0_supp_invoice_tax_items` ### - -DROP TABLE IF EXISTS `0_supp_invoice_tax_items`; - -CREATE TABLE `0_supp_invoice_tax_items` ( - `id` int(11) NOT NULL auto_increment, - `supp_trans_no` int(11) default NULL, - `supp_trans_type` int(11) default NULL, - `tax_type_id` int(11) NOT NULL default '0', - `tax_type_name` varchar(60) default NULL, - `rate` double NOT NULL default '0', - `included_in_price` tinyint(1) NOT NULL default '0', - `amount` double NOT NULL default '0', - PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=5 ; - -### Structure of table `0_supp_trans` ### - -DROP TABLE IF EXISTS `0_supp_trans`; - -CREATE TABLE `0_supp_trans` ( - `trans_no` int(11) unsigned NOT NULL default '0', - `type` smallint(6) unsigned NOT NULL default '0', - `supplier_id` int(11) unsigned default NULL, - `reference` tinytext NOT NULL, - `supp_reference` varchar(60) NOT NULL default '', - `tran_date` date NOT NULL default '0000-00-00', - `due_date` date NOT NULL default '0000-00-00', - `ov_amount` double NOT NULL default '0', - `ov_discount` double NOT NULL default '0', - `ov_gst` double NOT NULL default '0', - `rate` double NOT NULL default '1', - `alloc` double NOT NULL default '0', - PRIMARY KEY (`trans_no`,`type`), - KEY `supplier_id` (`supplier_id`), - KEY `SupplierID_2` (`supplier_id`,`supp_reference`), - KEY `type` (`type`) -) TYPE=InnoDB ; - -### Structure of table `0_suppliers` ### - -DROP TABLE IF EXISTS `0_suppliers`; - -CREATE TABLE `0_suppliers` ( - `supplier_id` int(11) NOT NULL auto_increment, - `supp_name` varchar(60) NOT NULL default '', - `address` tinytext NOT NULL, - `email` varchar(100) NOT NULL default '', - `bank_account` varchar(60) NOT NULL default '', - `curr_code` char(3) default NULL, - `payment_terms` int(11) default NULL, - `dimension_id` int(11) default '0', - `dimension2_id` int(11) default '0', - `tax_group_id` int(11) default NULL, - `purchase_account` varchar(11) default NULL, - `payable_account` varchar(11) default NULL, - `payment_discount_account` varchar(11) default NULL, - PRIMARY KEY (`supplier_id`) -) TYPE=MyISAM AUTO_INCREMENT=5 ; - -### Structure of table `0_sys_types` ### - -DROP TABLE IF EXISTS `0_sys_types`; - -CREATE TABLE `0_sys_types` ( - `type_id` smallint(6) NOT NULL default '0', - `type_name` varchar(60) NOT NULL default '', - `type_no` int(11) NOT NULL default '1', - `next_reference` varchar(100) NOT NULL default '', - PRIMARY KEY (`type_id`) -) TYPE=InnoDB ; - -### Structure of table `0_tax_group_items` ### - -DROP TABLE IF EXISTS `0_tax_group_items`; - -CREATE TABLE `0_tax_group_items` ( - `tax_group_id` int(11) NOT NULL default '0', - `tax_type_id` int(11) NOT NULL default '0', - `rate` double NOT NULL default '0', - `included_in_price` tinyint(1) NOT NULL default '0', - PRIMARY KEY (`tax_group_id`,`tax_type_id`) -) TYPE=InnoDB ; - -### Structure of table `0_tax_groups` ### - -DROP TABLE IF EXISTS `0_tax_groups`; - -CREATE TABLE `0_tax_groups` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(60) NOT NULL default '', - `tax_shipping` tinyint(1) NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) TYPE=InnoDB AUTO_INCREMENT=5 ; - -### Structure of table `0_tax_types` ### - -DROP TABLE IF EXISTS `0_tax_types`; - -CREATE TABLE `0_tax_types` ( - `id` int(11) NOT NULL auto_increment, - `rate` double NOT NULL default '0', - `sales_gl_code` varchar(11) NOT NULL default '', - `purchasing_gl_code` varchar(11) NOT NULL default '', - `name` varchar(60) NOT NULL default '', - `out` tinyint(1) NOT NULL default '1', - PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=4 ; - -### Structure of table `0_users` ### - -DROP TABLE IF EXISTS `0_users`; - -CREATE TABLE `0_users` ( - `user_id` varchar(60) NOT NULL default '', - `password` varchar(100) NOT NULL default '', - `real_name` varchar(100) NOT NULL default '', - `full_access` int(11) NOT NULL default '1', - `phone` varchar(30) NOT NULL default '', - `email` varchar(100) default NULL, - `language` varchar(20) default NULL, - `date_format` tinyint(1) NOT NULL default '0', - `date_sep` tinyint(1) NOT NULL default '0', - `tho_sep` tinyint(1) NOT NULL default '0', - `dec_sep` tinyint(1) NOT NULL default '0', - `theme` varchar(20) NOT NULL default 'default', - `page_size` varchar(20) NOT NULL default 'A4', - `prices_dec` smallint(6) NOT NULL default '2', - `qty_dec` smallint(6) NOT NULL default '2', - `rates_dec` smallint(6) NOT NULL default '4', - `percent_dec` smallint(6) NOT NULL default '1', - `show_gl` tinyint(1) NOT NULL default '1', - `show_codes` tinyint(1) NOT NULL default '0', - `show_hints` tinyint(1) NOT NULL default '0', - `last_visit_date` datetime default NULL, - PRIMARY KEY (`user_id`) -) TYPE=MyISAM ; - -### Structure of table `0_voided` ### - -DROP TABLE IF EXISTS `0_voided`; - -CREATE TABLE `0_voided` ( - `type` int(11) NOT NULL default '0', - `id` int(11) NOT NULL default '0', - `date_` date NOT NULL default '0000-00-00', - `memo_` tinytext NOT NULL, - UNIQUE KEY `id` (`type`,`id`) -) TYPE=InnoDB ; - -### Structure of table `0_wo_issue_items` ### - -DROP TABLE IF EXISTS `0_wo_issue_items`; - -CREATE TABLE `0_wo_issue_items` ( - `id` int(11) NOT NULL auto_increment, - `stock_id` varchar(40) default NULL, - `issue_id` int(11) default NULL, - `qty_issued` double default NULL, - PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=2 ; - -### Structure of table `0_wo_issues` ### - -DROP TABLE IF EXISTS `0_wo_issues`; - -CREATE TABLE `0_wo_issues` ( - `issue_no` int(11) NOT NULL auto_increment, - `workorder_id` int(11) NOT NULL default '0', - `reference` varchar(100) default NULL, - `issue_date` date default NULL, - `loc_code` varchar(5) default NULL, - `workcentre_id` int(11) default NULL, - PRIMARY KEY (`issue_no`) -) TYPE=InnoDB AUTO_INCREMENT=2 ; - -### Structure of table `0_wo_manufacture` ### - -DROP TABLE IF EXISTS `0_wo_manufacture`; - -CREATE TABLE `0_wo_manufacture` ( - `id` int(11) NOT NULL auto_increment, - `reference` varchar(100) default NULL, - `workorder_id` int(11) NOT NULL default '0', - `quantity` double NOT NULL default '0', - `date_` date NOT NULL default '0000-00-00', - PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=3 ; - -### Structure of table `0_wo_requirements` ### - -DROP TABLE IF EXISTS `0_wo_requirements`; - -CREATE TABLE `0_wo_requirements` ( - `id` int(11) NOT NULL auto_increment, - `workorder_id` int(11) NOT NULL default '0', - `stock_id` char(20) NOT NULL default '', - `workcentre` int(11) NOT NULL default '0', - `units_req` double NOT NULL default '1', - `std_cost` double NOT NULL default '0', - `loc_code` char(5) NOT NULL default '', - `units_issued` double NOT NULL default '0', - PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=29 ; - -### Structure of table `0_workcentres` ### - -DROP TABLE IF EXISTS `0_workcentres`; - -CREATE TABLE `0_workcentres` ( - `id` int(11) NOT NULL auto_increment, - `name` char(40) NOT NULL default '', - `description` char(50) NOT NULL default '', - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) TYPE=MyISAM AUTO_INCREMENT=2 ; - -### Structure of table `0_workorders` ### - -DROP TABLE IF EXISTS `0_workorders`; - -CREATE TABLE `0_workorders` ( - `id` int(11) NOT NULL auto_increment, - `wo_ref` varchar(60) NOT NULL default '', - `loc_code` varchar(5) NOT NULL default '', - `units_reqd` double NOT NULL default '1', - `stock_id` varchar(20) NOT NULL default '', - `date_` date NOT NULL default '0000-00-00', - `type` tinyint(4) NOT NULL default '0', - `required_by` date NOT NULL default '0000-00-00', - `released_date` date NOT NULL default '0000-00-00', - `units_issued` double NOT NULL default '0', - `closed` tinyint(1) NOT NULL default '0', - `released` tinyint(1) NOT NULL default '0', - `additional_costs` double NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `wo_ref` (`wo_ref`) -) TYPE=InnoDB AUTO_INCREMENT=8 ; - -### Data of table `0_areas` ### - -INSERT INTO `0_areas` VALUES ('1', 'USA'); -INSERT INTO `0_areas` VALUES ('2', 'Far East'); -INSERT INTO `0_areas` VALUES ('3', 'Africa'); -INSERT INTO `0_areas` VALUES ('4', 'Europe'); - -### Data of table `0_bank_accounts` ### - -INSERT INTO `0_bank_accounts` VALUES ('1700', '0', 'Current account', 'N/A', 'N/A', NULL, 'USD'); -INSERT INTO `0_bank_accounts` VALUES ('1705', '0', 'Petty Cash account', 'N/A', 'N/A', NULL, 'USD'); -INSERT INTO `0_bank_accounts` VALUES ('1710', '0', 'Saving account', '10001000', 'Saving Bank', NULL, 'GBP'); - -### Data of table `0_bank_trans` ### - -INSERT INTO `0_bank_trans` VALUES ('1', '12', '2', '1700', '111', '2006-01-18', '1', '5000', '0', '0', '2', '1'); -INSERT INTO `0_bank_trans` VALUES ('2', '12', '3', '1700', '112', '2006-01-18', '1', '240', '0', '0', '2', '2'); -INSERT INTO `0_bank_trans` VALUES ('3', '12', '4', '1700', '113', '2006-01-18', '1', '360', '0', '0', '2', '2'); -INSERT INTO `0_bank_trans` VALUES ('4', '12', '5', '1700', '114', '2006-01-18', '1', '500', '0', '0', '2', '1'); -INSERT INTO `0_bank_trans` VALUES ('5', '1', '2', '1700', '1', '2006-01-18', '1', '-25', '0', '0', '0', NULL); -INSERT INTO `0_bank_trans` VALUES ('6', '1', '3', '1705', '2', '2006-01-18', '1', '-250', '0', '0', '0', NULL); -INSERT INTO `0_bank_trans` VALUES ('7', '1', '4', '1700', '3', '2006-01-18', '1', '-555', '0', '0', '4', '1'); -INSERT INTO `0_bank_trans` VALUES ('8', '4', '2', '1700', '4', '2006-01-18', '1', '-300', '0', '0', '0', NULL); -INSERT INTO `0_bank_trans` VALUES ('9', '4', '2', '1710', '4', '2006-01-18', '1', '250', '0', '0', '0', NULL); -INSERT INTO `0_bank_trans` VALUES ('10', '22', '2', '1700', '1', '2006-01-18', '1', '-5000', '0', '0', '3', '1'); -INSERT INTO `0_bank_trans` VALUES ('11', '22', '3', '1710', '2', '2006-01-18', '1', '-3300', '0', '0', '3', '2'); -INSERT INTO `0_bank_trans` VALUES ('12', '2', '2', '1700', '11', '2006-01-20', '1', '1050', '0', '0', '0', NULL); -INSERT INTO `0_bank_trans` VALUES ('13', '12', '6', '1700', '115', '2007-01-30', '1', '200', '0', '0', '2', '1'); -INSERT INTO `0_bank_trans` VALUES ('14', '1', '5', '1700', '4', '2007-01-30', '1', '-200', '0', '0', '4', '1'); -INSERT INTO `0_bank_trans` VALUES ('15', '2', '3', '1700', '12', '2007-01-30', '3', '70', '0', '0', '4', '2'); -INSERT INTO `0_bank_trans` VALUES ('16', '4', '3', '1700', '5', '2007-03-09', '1', '-222', '0', '0', '0', NULL); -INSERT INTO `0_bank_trans` VALUES ('17', '4', '3', '1705', '5', '2007-03-09', '1', '222', '0', '0', '0', NULL); -INSERT INTO `0_bank_trans` VALUES ('18', '2', '4', '1700', '13', '2007-03-09', '3', '200', '0', '0', '2', '1'); -INSERT INTO `0_bank_trans` VALUES ('19', '1', '6', '1700', '5', '2007-03-22', '1', '-200', '0', '0', '3', '1'); -INSERT INTO `0_bank_trans` VALUES ('20', '1', '7', '1700', '6', '2007-03-22', '1', '-125', '0', '0', '0', 'Gas Transport'); -INSERT INTO `0_bank_trans` VALUES ('21', '12', '7', '1700', '6', '2008-03-06', '1', '100', '0', '0', '2', '1'); -INSERT INTO `0_bank_trans` VALUES ('22', '12', '8', '1700', '7', '2008-03-06', '1', '100', '0', '0', '2', '4'); -INSERT INTO `0_bank_trans` VALUES ('23', '12', '9', '1700', '8', '2008-03-07', '1', '2000', '0', '0', '2', '1'); - -### Data of table `0_bank_trans_types` ### - -INSERT INTO `0_bank_trans_types` VALUES ('1', 'Cash'); -INSERT INTO `0_bank_trans_types` VALUES ('2', 'Cheque'); -INSERT INTO `0_bank_trans_types` VALUES ('3', 'Transfer'); - -### Data of table `0_bom` ### - -INSERT INTO `0_bom` VALUES ('1', '3400', '102', '1', 'DEF', '1'); -INSERT INTO `0_bom` VALUES ('2', '3400', '103', '1', 'DEF', '1'); -INSERT INTO `0_bom` VALUES ('3', '3400', '104', '1', 'DEF', '1'); -INSERT INTO `0_bom` VALUES ('4', '3400', '201', '1', 'DEF', '1'); -INSERT INTO `0_bom` VALUES ('5', '3400', '103', '1', 'CWA', '1'); - -### Data of table `0_chart_class` ### - -INSERT INTO `0_chart_class` VALUES ('1', 'Assets', '1'); -INSERT INTO `0_chart_class` VALUES ('2', 'Liabilities', '1'); -INSERT INTO `0_chart_class` VALUES ('3', 'Income', '0'); -INSERT INTO `0_chart_class` VALUES ('4', 'Costs', '0'); -INSERT INTO `0_chart_class` VALUES ('5', 'Gross', '0'); - -### Data of table `0_chart_master` ### - -INSERT INTO `0_chart_master` VALUES ('3000', NULL, 'Sales', '1', '1'); -INSERT INTO `0_chart_master` VALUES ('3010', NULL, 'Sales - Wholesale', '1', '1'); -INSERT INTO `0_chart_master` VALUES ('3020', NULL, 'Sales of Other items', '1', '1'); -INSERT INTO `0_chart_master` VALUES ('3400', NULL, 'Difference On Exchange', '1', '0'); -INSERT INTO `0_chart_master` VALUES ('5000', NULL, 'Direct Labour', '2', '0'); -INSERT INTO `0_chart_master` VALUES ('5050', NULL, 'Direct Labour Recovery', '2', '0'); -INSERT INTO `0_chart_master` VALUES ('4200', NULL, 'Material Usage Varaiance', '2', '4'); -INSERT INTO `0_chart_master` VALUES ('4210', NULL, 'Consumable Materials', '2', '4'); -INSERT INTO `0_chart_master` VALUES ('4220', NULL, 'Purchase price Variance', '2', '0'); -INSERT INTO `0_chart_master` VALUES ('4000', NULL, 'Purchases of materials', '2', '4'); -INSERT INTO `0_chart_master` VALUES ('4250', NULL, 'Discounts Received', '2', '0'); -INSERT INTO `0_chart_master` VALUES ('4260', NULL, 'Exchange Variation', '2', '0'); -INSERT INTO `0_chart_master` VALUES ('4300', NULL, 'Freight Inwards', '2', '4'); -INSERT INTO `0_chart_master` VALUES ('4010', NULL, 'Cost of Goods Sold - Retail', '2', '4'); -INSERT INTO `0_chart_master` VALUES ('6790', NULL, 'Bank Charges', '5', '4'); -INSERT INTO `0_chart_master` VALUES ('6800', NULL, 'Entertainments', '5', '4'); -INSERT INTO `0_chart_master` VALUES ('6810', NULL, 'Legal Expenses', '5', '4'); -INSERT INTO `0_chart_master` VALUES ('6600', NULL, 'Repairs and Maintenance Office', '5', '4'); -INSERT INTO `0_chart_master` VALUES ('6730', NULL, 'phone', '5', '4'); -INSERT INTO `0_chart_master` VALUES ('8200', NULL, 'Bank Interest', '52', '0'); -INSERT INTO `0_chart_master` VALUES ('6840', NULL, 'Credit Control', '5', '0'); -INSERT INTO `0_chart_master` VALUES ('7040', NULL, 'Depreciation Office Equipment', '51', '0'); -INSERT INTO `0_chart_master` VALUES ('3800', NULL, 'Freight Outwards', '5', '4'); -INSERT INTO `0_chart_master` VALUES ('4500', NULL, 'Packaging', '5', '4'); -INSERT INTO `0_chart_master` VALUES ('6400', NULL, 'Commissions', '5', '0'); -INSERT INTO `0_chart_master` VALUES ('3200', NULL, 'Prompt Payment Discounts', '1', '0'); -INSERT INTO `0_chart_master` VALUES ('6700', NULL, 'General Expenses', '5', '4'); -INSERT INTO `0_chart_master` VALUES ('5200', NULL, 'Indirect Labour', '2', '0'); -INSERT INTO `0_chart_master` VALUES ('5210', NULL, 'Overhead Recovery', '5', '0'); -INSERT INTO `0_chart_master` VALUES ('1700', NULL, 'Bank account', '10', '0'); -INSERT INTO `0_chart_master` VALUES ('1705', NULL, 'Petty Cash', '10', '0'); -INSERT INTO `0_chart_master` VALUES ('1710', NULL, 'Foreign currency account', '10', '0'); -INSERT INTO `0_chart_master` VALUES ('1500', NULL, 'Accounts Receivable', '20', '0'); -INSERT INTO `0_chart_master` VALUES ('1400', NULL, 'Stocks of Raw Materials', '45', '0'); -INSERT INTO `0_chart_master` VALUES ('1410', NULL, 'Stocks of Work In Progress', '45', '0'); -INSERT INTO `0_chart_master` VALUES ('1420', NULL, 'Stocks of Finsihed Goods', '45', '0'); -INSERT INTO `0_chart_master` VALUES ('1430', NULL, 'Goods Received Clearing account', '30', '0'); -INSERT INTO `0_chart_master` VALUES ('2630', NULL, 'Accounts Payable', '30', '0'); -INSERT INTO `0_chart_master` VALUES ('2660', NULL, 'VAT out 5', '30', '0'); -INSERT INTO `0_chart_master` VALUES ('2662', NULL, 'VAT out 1', '30', '0'); -INSERT INTO `0_chart_master` VALUES ('2664', NULL, 'VAT out 25', '30', '0'); -INSERT INTO `0_chart_master` VALUES ('2680', NULL, 'VAT In 5', '30', '0'); -INSERT INTO `0_chart_master` VALUES ('2682', NULL, 'VAT In 25', '30', '0'); -INSERT INTO `0_chart_master` VALUES ('2050', NULL, 'Retained Earnings', '50', '0'); -INSERT INTO `0_chart_master` VALUES ('2000', NULL, 'Share Capital', '50', '0'); - -### Data of table `0_chart_types` ### - -INSERT INTO `0_chart_types` VALUES ('1', 'Sales', '3', '-1'); -INSERT INTO `0_chart_types` VALUES ('2', 'Cost of Sales', '4', '-1'); -INSERT INTO `0_chart_types` VALUES ('5', 'Expenses', '4', '-1'); -INSERT INTO `0_chart_types` VALUES ('10', 'Cash/Bank', '1', '-1'); -INSERT INTO `0_chart_types` VALUES ('20', 'Accounts Receivable', '1', '-1'); -INSERT INTO `0_chart_types` VALUES ('30', 'Accounts Payable', '2', '-1'); -INSERT INTO `0_chart_types` VALUES ('40', 'Fixed Assets', '1', '-1'); -INSERT INTO `0_chart_types` VALUES ('45', 'Inventory', '1', '-1'); -INSERT INTO `0_chart_types` VALUES ('50', 'Equity', '2', '-1'); -INSERT INTO `0_chart_types` VALUES ('51', 'Depreciations', '4', '-1'); -INSERT INTO `0_chart_types` VALUES ('52', 'Financials', '4', '-1'); - -### Data of table `0_comments` ### - -INSERT INTO `0_comments` VALUES ('17', '2', '2006-01-18', 'initial balances'); -INSERT INTO `0_comments` VALUES ('10', '6', '2007-01-30', 'Hi there you got it!'); -INSERT INTO `0_comments` VALUES ('12', '6', '2007-01-30', 'This is good'); -INSERT INTO `0_comments` VALUES ('1', '5', '2007-01-30', 'Total Gas'); -INSERT INTO `0_comments` VALUES ('0', '6', '2007-02-02', 'A big memo'); -INSERT INTO `0_comments` VALUES ('10', '7', '2007-02-03', 'Another big memo, which looks good.'); -INSERT INTO `0_comments` VALUES ('4', '3', '2007-03-09', 'A little cash up front.'); -INSERT INTO `0_comments` VALUES ('26', '6', '2008-02-28', 'nowe '); -INSERT INTO `0_comments` VALUES ('40', '2', '0000-00-00', 'Another project'); - -### Data of table `0_company` ### - -INSERT INTO `0_company` VALUES ('1', 'Drill Company Inc.', '987654321', '123123123', '1', '1', 'N/A', '202-122320', '202-18889123', 'delta@delta.com', 'logo_frontaccounting.jpg', 'DownTown', 'USD', '1500', '4250', '2630', '1430', '4260', '4220', '2050', '3800', '3000', '3000', '3200', '1420', '4010', '4210', '3000', '1410', '5000', '', '', '', '', '', '', '0', '10', '10', '1000', '20', '20', '30', '1', '6', '0', '0', '0', -1); - -### Data of table `0_credit_status` ### - -INSERT INTO `0_credit_status` VALUES ('1', 'Good History', '0'); -INSERT INTO `0_credit_status` VALUES ('3', 'No more work until payment received', '1'); -INSERT INTO `0_credit_status` VALUES ('4', 'In liquidation', '1'); - -### Data of table `0_currencies` ### - -INSERT INTO `0_currencies` VALUES ('Kronor', 'SEK', 'kr', 'Sweden', '?ren'); -INSERT INTO `0_currencies` VALUES ('Kroner', 'DKK', 'kr.', 'Denmark', '?re'); -INSERT INTO `0_currencies` VALUES ('Euro', 'EUR', '?', 'Europe', 'Cents'); -INSERT INTO `0_currencies` VALUES ('Pounds', 'GBP', '?', 'England', 'Pence'); -INSERT INTO `0_currencies` VALUES ('US Dollars', 'USD', '$', 'United States', 'Cents'); - -### Data of table `0_cust_allocations` ### - -INSERT INTO `0_cust_allocations` VALUES ('1', '200', '2007-01-30', '6', '12', '6', '10'); -INSERT INTO `0_cust_allocations` VALUES ('4', '133', '2007-03-09', '4', '2', '6', '10'); -INSERT INTO `0_cust_allocations` VALUES ('5', '135', '2008-03-06', '1', '11', '5', '10'); -INSERT INTO `0_cust_allocations` VALUES ('6', '135', '2008-03-06', '2', '11', '6', '10'); -INSERT INTO `0_cust_allocations` VALUES ('7', '135', '2008-03-06', '3', '11', '4', '10'); -INSERT INTO `0_cust_allocations` VALUES ('8', '125', '2008-03-07', '4', '11', '4', '11'); - -### Data of table `0_cust_branch` ### - -INSERT INTO `0_cust_branch` VALUES ('1', '1', 'Main', '', '1', '1', '', '', 'Lucky Luke Inc.', 'lucky@luke.com', 'DEF', '1', '3000', '3000', '1500', '3200', '1', '0', 'The Road'); -INSERT INTO `0_cust_branch` VALUES ('2', '1', 'Service divison', '', '4', '1', '', '', '', '', 'DEF', '2', '3000', '3000', '1500', '3200', '1', '0', 'Another Road'); -INSERT INTO `0_cust_branch` VALUES ('3', '2', 'Main', '', '4', '2', '', '', 'Money Makers Ltd.', '', 'DEF', '2', '3000', '3000', '1500', '3200', '1', '0', ''); -INSERT INTO `0_cust_branch` VALUES ('5', '3', 'Main', '', '4', '1', '', '', 'Junk Beer ApS', '', 'CWA', '2', '3000', '3000', '1500', '3200', '1', '0', ''); -INSERT INTO `0_cust_branch` VALUES ('6', '4', 'Johny Bravo', 'Never Mind 13', '1', '1', '123', '', 'Johny Bravo', '', 'DEF', '1', '3000', '3000', '1500', '3200', '1', '0', 'Never Mind 13'); -INSERT INTO `0_cust_branch` VALUES ('7', '3', 'Junk Beer ApS', 'N/A', '1', '1', '1223123', '', 'junk@junkbeer.dk', '', 'DEF', '1', '3000', '3000', '1500', '3200', '1', '0', 'N/A'); - -### Data of table `0_debtor_trans` ### - -INSERT INTO `0_debtor_trans` VALUES ('1', '10', '0', '4', '6', '2008-03-06', '2008-03-16', '0', '1', '1', '125', '0', '10', '0', '0', '0', '1', '1', '1'); -INSERT INTO `0_debtor_trans` VALUES ('1', '11', '0', '4', '6', '2008-03-06', '0000-00-00', '0', '1', '5', '125', '0', '10', '0', '0', '0', '1', '1', '5'); -INSERT INTO `0_debtor_trans` VALUES ('1', '13', '1', '4', '6', '2008-03-06', '2008-03-16', '0', '1', '1', '125', '0', '10', '0', '0', '0', '1', '1', '1'); -INSERT INTO `0_debtor_trans` VALUES ('2', '10', '0', '4', '6', '2008-03-06', '2008-03-06', '1', '1', '2', '125', '0', '10', '0', '0', '0', '1', '1', '2'); -INSERT INTO `0_debtor_trans` VALUES ('2', '11', '0', '4', '6', '2008-03-06', '0000-00-00', '1', '1', '6', '125', '0', '10', '0', '0', '135', '1', '1', '6'); -INSERT INTO `0_debtor_trans` VALUES ('2', '13', '1', '4', '6', '2008-03-06', '2008-03-06', 'auto', '1', '2', '125', '0', '10', '0', '0', '0', '1', '1', '2'); -INSERT INTO `0_debtor_trans` VALUES ('3', '10', '0', '4', '6', '2008-03-06', '2008-03-06', '2', '1', '3', '125', '0', '10', '0', '0', '0', '1', '1', '3'); -INSERT INTO `0_debtor_trans` VALUES ('3', '11', '0', '4', '6', '2008-03-06', '0000-00-00', '2', '1', '4', '125', '0', '10', '0', '0', '135', '1', '1', '4'); -INSERT INTO `0_debtor_trans` VALUES ('3', '13', '1', '4', '6', '2008-03-06', '2008-03-06', 'auto', '1', '3', '125', '0', '10', '0', '0', '0', '1', '1', '3'); -INSERT INTO `0_debtor_trans` VALUES ('4', '10', '1', '4', '6', '2008-03-06', '2008-03-06', '3', '1', '4', '125', '0', '10', '0', '0', '135', '1', '1', '4'); -INSERT INTO `0_debtor_trans` VALUES ('4', '11', '0', '1', '1', '2008-03-07', '0000-00-00', '3', '1', '0', '100', '25', '0', '0', '0', '250', '1', '1', '0'); -INSERT INTO `0_debtor_trans` VALUES ('4', '13', '1', '4', '6', '2008-03-06', '2008-03-06', 'auto', '1', '4', '125', '0', '10', '0', '0', '0', '1', '1', '4'); -INSERT INTO `0_debtor_trans` VALUES ('5', '10', '1', '4', '6', '2008-03-06', '2008-03-06', '4', '1', '5', '125', '0', '10', '0', '0', '135', '1', '1', '5'); -INSERT INTO `0_debtor_trans` VALUES ('5', '13', '1', '4', '6', '2008-03-06', '2008-03-06', 'auto', '1', '5', '125', '0', '10', '0', '0', '0', '1', '1', '5'); -INSERT INTO `0_debtor_trans` VALUES ('6', '10', '1', '4', '6', '2008-03-06', '2008-03-06', '5', '1', '6', '125', '0', '10', '0', '0', '135', '1', '1', '6'); -INSERT INTO `0_debtor_trans` VALUES ('6', '13', '1', '4', '6', '2008-03-06', '2008-03-06', 'auto', '1', '6', '125', '0', '10', '0', '0', '0', '1', '1', '6'); -INSERT INTO `0_debtor_trans` VALUES ('7', '10', '0', '4', '6', '2008-03-08', '2008-03-08', '6', '1', '9', '125', '0', '10', '0', '0', '0', '1', '1', '9'); -INSERT INTO `0_debtor_trans` VALUES ('7', '12', '0', '1', '1', '2008-03-06', '0000-00-00', '6', '0', '0', '100', '0', '0', '0', '0', '0', '1', '0', '0'); -INSERT INTO `0_debtor_trans` VALUES ('7', '13', '0', '4', '6', '2008-03-06', '2008-03-06', '1', '1', '7', '125', '0', '10', '0', '0', '0', '1', '1', '0'); -INSERT INTO `0_debtor_trans` VALUES ('8', '10', '0', '4', '6', '2008-03-09', '2008-03-09', '7', '1', '10', '125', '0', '12.5', '0', '0', '0', '1', '1', '10'); -INSERT INTO `0_debtor_trans` VALUES ('8', '12', '0', '4', '6', '2008-03-06', '0000-00-00', '7', '0', '0', '100', '0', '0', '0', '0', '0', '1', '0', '0'); -INSERT INTO `0_debtor_trans` VALUES ('8', '13', '1', '4', '6', '2008-03-07', '2008-03-07', '2', '1', '8', '125', '0', '10', '0', '0', '0', '1', '1', '13'); -INSERT INTO `0_debtor_trans` VALUES ('9', '10', '0', '1', '1', '2008-03-09', '2008-03-09', '8', '2', '11', '100', '25', '10', '2.5', '0', '0', '1', '1', '11'); -INSERT INTO `0_debtor_trans` VALUES ('9', '12', '0', '1', '1', '2008-03-07', '0000-00-00', '8', '0', '0', '2000', '0', '0', '0', '0', '0', '1', '0', '0'); -INSERT INTO `0_debtor_trans` VALUES ('9', '13', '1', '4', '6', '2008-03-08', '2008-03-08', 'auto', '1', '9', '125', '0', '10', '0', '0', '0', '1', '1', '7'); -INSERT INTO `0_debtor_trans` VALUES ('10', '10', '0', '4', '6', '2008-03-09', '2008-03-09', '9', '1', '12', '125', '0', '10', '0', '0', '0', '1', '1', '12'); -INSERT INTO `0_debtor_trans` VALUES ('10', '13', '1', '4', '6', '2008-03-09', '2008-03-09', 'auto', '1', '10', '125', '0', '12.5', '0', '0', '0', '1', '1', '8'); -INSERT INTO `0_debtor_trans` VALUES ('11', '10', '0', '1', '1', '2008-03-10', '2008-03-20', '10', '2', '15', '100', '25', '0', '0', '0', '0', '1', '1', '14'); -INSERT INTO `0_debtor_trans` VALUES ('11', '13', '1', '1', '1', '2008-03-09', '2008-03-09', 'auto', '2', '11', '100', '25', '10', '2.5', '0', '0', '1', '1', '9'); -INSERT INTO `0_debtor_trans` VALUES ('12', '10', '0', '1', '1', '2008-03-10', '2008-03-29', '11', '2', '16', '100', '25', '0', '0', '0', '0', '1', '1', '15'); -INSERT INTO `0_debtor_trans` VALUES ('12', '13', '1', '4', '6', '2008-03-09', '2008-03-09', 'auto', '1', '12', '125', '0', '10', '0', '0', '0', '1', '1', '10'); -INSERT INTO `0_debtor_trans` VALUES ('13', '10', '0', '4', '6', '2008-03-07', '2008-03-07', '12', '1', '8', '125', '0', '10', '0', '0', '0', '1', '1', '8'); -INSERT INTO `0_debtor_trans` VALUES ('13', '13', '1', '4', '6', '2008-03-10', '2008-03-20', '3', '1', '14', '40', '0', '0', '0', '0', '0', '1', '1', '15'); -INSERT INTO `0_debtor_trans` VALUES ('14', '10', '0', '4', '6', '2008-03-10', '2008-03-10', '13', '1', '18', '125', '0', '10', '0', '0', '0', '1', '1', '17'); -INSERT INTO `0_debtor_trans` VALUES ('14', '13', '1', '1', '1', '2008-03-10', '2008-03-20', '4', '2', '15', '100', '25', '0', '0', '0', '0', '1', '1', '11'); -INSERT INTO `0_debtor_trans` VALUES ('15', '10', '0', '4', '6', '2008-03-10', '2008-04-17', '14', '1', '14', '40', '0', '0', '0', '0', '0', '1', '1', '13'); -INSERT INTO `0_debtor_trans` VALUES ('15', '13', '1', '1', '1', '2008-03-10', '2008-03-20', '5', '2', '16', '100', '25', '0', '0', '0', '0', '1', '1', '12'); -INSERT INTO `0_debtor_trans` VALUES ('16', '10', '0', '4', '6', '2008-03-17', '2008-04-17', '15', '1', '19', '125', '0', '10', '0', '0', '0', '1', '1', '18'); -INSERT INTO `0_debtor_trans` VALUES ('16', '13', '1', '3', '5', '2008-03-10', '2008-03-20', '6', '1', '17', '11', '0', '0', '0', '0', '0', '0.20563796227935', '1', '17'); -INSERT INTO `0_debtor_trans` VALUES ('17', '10', '0', '3', '5', '2008-03-10', '2008-04-17', '16', '1', '17', '11', '0', '0', '0', '0', '0', '0.20563796227935', '1', '16'); -INSERT INTO `0_debtor_trans` VALUES ('17', '13', '1', '4', '6', '2008-03-10', '2008-03-10', 'auto', '1', '18', '125', '0', '10', '0', '0', '0', '1', '1', '14'); -INSERT INTO `0_debtor_trans` VALUES ('18', '10', '0', '3', '5', '2008-03-29', '2008-04-17', '17', '1', '20', '0', '0', '0', '0', '0', '0', '0.20674817019223', '1', '19'); -INSERT INTO `0_debtor_trans` VALUES ('18', '13', '1', '4', '6', '2008-03-17', '2008-03-27', '7', '1', '19', '125', '0', '10', '0', '0', '0', '1', '1', '16'); -INSERT INTO `0_debtor_trans` VALUES ('19', '10', '0', '4', '6', '2008-03-29', '2008-04-17', '18', '1', '21', '125', '0', '0', '0', '0', '0', '1', '1', '20'); -INSERT INTO `0_debtor_trans` VALUES ('19', '13', '1', '3', '5', '2008-03-29', '2008-04-17', 'auto', '1', '20', '0', '0', '0', '0', '0', '0', '0.20674817019223', '1', '18'); -INSERT INTO `0_debtor_trans` VALUES ('20', '13', '1', '4', '6', '2008-03-29', '2008-04-08', '8', '1', '21', '125', '0', '0', '0', '0', '0', '1', '1', '19'); - -### Data of table `0_debtor_trans_details` ### - -INSERT INTO `0_debtor_trans_details` VALUES ('1', '1', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('2', '1', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('3', '2', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('4', '2', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('5', '3', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('6', '3', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('7', '4', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('8', '4', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('9', '5', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('10', '5', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('11', '1', '11', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('12', '6', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('13', '6', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('14', '7', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('15', '2', '11', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('16', '3', '11', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('17', '4', '11', '102', '17 inch VGA Monitor', '100', '25', '1', '0', '0', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('18', '8', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('19', '9', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('20', '7', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('21', '10', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('22', '8', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('23', '11', '13', '102', '17 inch VGA Monitor', '100', '25', '1', '0', '80', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('24', '9', '10', '102', '17 inch VGA Monitor', '100', '25', '1', '0', '80', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('25', '12', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('26', '10', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('27', '13', '13', '103', '32MB VGA Card', '40', '8', '1', '0', '20', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('28', '14', '13', '102', '17 inch VGA Monitor', '100', '25', '1', '0', '80', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('29', '11', '10', '102', '17 inch VGA Monitor', '100', '25', '1', '0', '80', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('30', '15', '13', '102', '17 inch VGA Monitor', '100', '25', '1', '0', '80', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('31', '12', '10', '102', '17 inch VGA Monitor', '100', '25', '1', '0', '80', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('32', '13', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('33', '16', '13', '102', '17 inch VGA Monitor', '11', '0', '1', '0', '80', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('34', '17', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('35', '14', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '80', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('36', '15', '10', '103', '32MB VGA Card', '40', '8', '1', '0', '20', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('37', '18', '13', '102', '17 inch VGA Monitor', '125', '25', '0', '0', '-3.4114285714283', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('38', '18', '13', 'AA101', 'olie 5w40', '125', '25', '1', '0', '5.0599509174312', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('39', '16', '10', '102', '17 inch VGA Monitor', '125', '25', '0', '0', '-3.4114285714283', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('40', '16', '10', 'AA101', 'olie 5w40', '125', '25', '1', '0', '5.0599509174312', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('41', '17', '10', '102', '17 inch VGA Monitor', '11', '0', '1', '0', '80', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('42', '19', '13', '102', '17 inch VGA Monitor', '0', '0', '1', '0', '-3.4114285714283', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('43', '18', '10', '102', '17 inch VGA Monitor', '0', '0', '1', '0', '-3.4114285714283', '0'); -INSERT INTO `0_debtor_trans_details` VALUES ('44', '20', '13', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '-3.4114285714283', '1'); -INSERT INTO `0_debtor_trans_details` VALUES ('45', '19', '10', '102', '17 inch VGA Monitor', '125', '25', '1', '0', '-3.4114285714283', '0'); - -### Data of table `0_debtor_trans_tax_details` ### - -INSERT INTO `0_debtor_trans_tax_details` VALUES ('1', '1', '13', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('2', '1', '10', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('3', '2', '13', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('4', '2', '10', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('5', '3', '13', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('6', '3', '10', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('7', '4', '13', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('8', '4', '10', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('9', '5', '13', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('10', '5', '10', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('11', '1', '11', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('12', '6', '13', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('13', '6', '10', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('14', '7', '13', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('15', '2', '11', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('16', '3', '11', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('17', '4', '11', '3', NULL, '25', '0', '25'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('18', '8', '13', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('19', '9', '13', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('20', '7', '10', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('21', '10', '13', '3', NULL, '25', '1', '27.5'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('22', '8', '10', '3', NULL, '25', '1', '27.5'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('23', '11', '13', '3', NULL, '25', '0', '27.5'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('24', '9', '10', '3', NULL, '25', '0', '27.5'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('25', '12', '13', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('26', '10', '10', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('27', '13', '13', '3', NULL, '25', '1', '8'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('28', '14', '13', '3', NULL, '25', '0', '25'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('29', '11', '10', '3', NULL, '25', '0', '25'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('30', '15', '13', '3', NULL, '25', '0', '25'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('31', '12', '10', '3', NULL, '25', '0', '25'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('32', '13', '10', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('33', '17', '13', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('34', '14', '10', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('35', '15', '10', '3', NULL, '25', '1', '8'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('36', '18', '13', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('37', '16', '10', '3', NULL, '25', '1', '27'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('38', '20', '13', '3', NULL, '25', '1', '25'); -INSERT INTO `0_debtor_trans_tax_details` VALUES ('39', '19', '10', '3', NULL, '25', '1', '25'); - -### Data of table `0_debtors_master` ### - -INSERT INTO `0_debtors_master` VALUES ('1', 'Lucky Luke Inc.', '35 Waldorf Street\r\nTown 19358, AR', 'joe@home.com', '12311231', 'USD', '2', '0', '0', '1', '1', '0', '0', '1000'); -INSERT INTO `0_debtors_master` VALUES ('2', 'Money Makers Ltd.', 'N/A', '', '9876543', 'GBP', '2', '0', '0', '1', '1', '0', '0', '1000'); -INSERT INTO `0_debtors_master` VALUES ('3', 'Junk Beer ApS', 'N/A', '', '123321123', 'DKK', '1', '0', '0', '1', '1', '0', '0', '1000'); -INSERT INTO `0_debtors_master` VALUES ('4', 'Retail clients', 'Never Mind 13', '', '', 'USD', '1', '0', '0', '1', '1', '0', '0', '1000'); - -### Data of table `0_dimensions` ### - -INSERT INTO `0_dimensions` VALUES ('1', '1', 'Development', '1', '0', '2006-01-18', '2006-02-07'); -INSERT INTO `0_dimensions` VALUES ('2', '2', 'Support', '1', '0', '2006-01-18', '2007-03-07'); -INSERT INTO `0_dimensions` VALUES ('3', '3', 'Training', '2', '0', '2006-01-18', '2007-03-07'); - -### Data of table `0_exchange_rates` ### - -INSERT INTO `0_exchange_rates` VALUES ('1', 'LE', '0.149', '0.149', '2006-01-18'); -INSERT INTO `0_exchange_rates` VALUES ('2', 'GBP', '1.2', '1.2', '2006-01-18'); -INSERT INTO `0_exchange_rates` VALUES ('3', 'SEK', '0.1667', '0.1667', '2007-01-29'); -INSERT INTO `0_exchange_rates` VALUES ('4', 'DKK', '0.2', '0.2', '2007-03-05'); -INSERT INTO `0_exchange_rates` VALUES ('5', 'EUR', '1.1', '1.1', '2007-03-05'); -INSERT INTO `0_exchange_rates` VALUES ('6', 'DKK', '0.20563796227935', '0.20563796227935', '2008-03-06'); -INSERT INTO `0_exchange_rates` VALUES ('7', 'EUR', '1.5561', '1.5561', '2008-03-15'); -INSERT INTO `0_exchange_rates` VALUES ('8', 'DKK', '0.20867920985932', '0.20867920985932', '2008-03-16'); -INSERT INTO `0_exchange_rates` VALUES ('9', 'GBP', '1.9816266221251', '1.9816266221251', '2008-03-24'); -INSERT INTO `0_exchange_rates` VALUES ('10', 'DKK', '0.20674817019223', '0.20674817019223', '2008-03-24'); -INSERT INTO `0_exchange_rates` VALUES ('11', 'EUR', '1.5569', '1.5569', '2008-03-25'); -INSERT INTO `0_exchange_rates` VALUES ('12', 'EUR', '1.5796', '1.5796', '2008-03-28'); - -### Data of table `0_fiscal_year` ### - -INSERT INTO `0_fiscal_year` VALUES ('1', '2006-01-01', '2006-12-31', '0'); -INSERT INTO `0_fiscal_year` VALUES ('2', '2007-01-01', '2007-12-31', '0'); -INSERT INTO `0_fiscal_year` VALUES ('5', '2005-01-01', '2005-12-31', '1'); -INSERT INTO `0_fiscal_year` VALUES ('6', '2008-01-01', '2008-12-31', '0'); - -### Data of table `0_gl_trans` ### +### Data of table `0_gl_trans` ### INSERT INTO `0_gl_trans` VALUES ('1', '13', '1', '2008-03-06', '4010', '', '80', '0', '0', '2', '4'); INSERT INTO `0_gl_trans` VALUES ('2', '13', '1', '2008-03-06', '1420', '', '-80', '0', '0', '2', '4'); @@ -1458,12 +876,12 @@ INSERT INTO `0_gl_trans` VALUES ('65', '12', '9', '2008-03-07', '1500', '', '-20 INSERT INTO `0_gl_trans` VALUES ('66', '11', '4', '2008-03-07', '3000', '', '100', '0', '0', '2', '1'); INSERT INTO `0_gl_trans` VALUES ('67', '11', '4', '2008-03-07', '1500', '', '-125', '0', '0', '2', '1'); INSERT INTO `0_gl_trans` VALUES ('68', '11', '4', '2008-03-07', '2664', '', '25', '0', '0', '2', '1'); -INSERT INTO `0_gl_trans` VALUES ('69', '26', '7', '2008-03-07', '1420', '', '-80', '0', '0', NULL, NULL); -INSERT INTO `0_gl_trans` VALUES ('70', '26', '7', '2008-03-07', '1420', '', '-20', '0', '0', NULL, NULL); -INSERT INTO `0_gl_trans` VALUES ('71', '26', '7', '2008-03-07', '1420', '', '-18', '0', '0', NULL, NULL); -INSERT INTO `0_gl_trans` VALUES ('72', '26', '7', '2008-03-07', '1420', '', '118', '0', '0', NULL, NULL); -INSERT INTO `0_gl_trans` VALUES ('73', '0', '18', '2008-03-07', '1400', '', '20', '0', '0', NULL, NULL); -INSERT INTO `0_gl_trans` VALUES ('74', '0', '18', '2008-03-07', '3010', '', '-20', '0', '0', NULL, NULL); +INSERT INTO `0_gl_trans` VALUES ('69', '26', '7', '2008-03-07', '1420', '', '-80', '0', '0', '0', ''); +INSERT INTO `0_gl_trans` VALUES ('70', '26', '7', '2008-03-07', '1420', '', '-20', '0', '0', '0', ''); +INSERT INTO `0_gl_trans` VALUES ('71', '26', '7', '2008-03-07', '1420', '', '-18', '0', '0', '0', ''); +INSERT INTO `0_gl_trans` VALUES ('72', '26', '7', '2008-03-07', '1420', '', '118', '0', '0', '0', ''); +INSERT INTO `0_gl_trans` VALUES ('73', '0', '18', '2008-03-07', '1400', '', '20', '0', '0', '0', ''); +INSERT INTO `0_gl_trans` VALUES ('74', '0', '18', '2008-03-07', '3010', '', '-20', '0', '0', '0', ''); INSERT INTO `0_gl_trans` VALUES ('75', '13', '8', '2008-03-07', '4010', '', '80', '0', '0', '2', '4'); INSERT INTO `0_gl_trans` VALUES ('76', '13', '8', '2008-03-07', '1420', '', '-80', '0', '0', '2', '4'); INSERT INTO `0_gl_trans` VALUES ('77', '13', '9', '2008-03-08', '4010', '', '80', '0', '0', '2', '4'); @@ -1541,6 +959,67 @@ INSERT INTO `0_gl_trans` VALUES ('166', '13', '20', '2008-03-29', '1420', '', '3 INSERT INTO `0_gl_trans` VALUES ('167', '10', '19', '2008-03-29', '3000', '', '-100', '0', '0', '2', '4'); INSERT INTO `0_gl_trans` VALUES ('168', '10', '19', '2008-03-29', '1500', '', '125', '0', '0', '2', '4'); INSERT INTO `0_gl_trans` VALUES ('169', '10', '19', '2008-03-29', '2664', '', '-25', '0', '0', '2', '4'); +INSERT INTO `0_gl_trans` VALUES ('170', '12', '10', '2009-01-10', '1700', '', '1000', '0', '0', '2', '1'); +INSERT INTO `0_gl_trans` VALUES ('171', '12', '10', '2009-01-10', '1500', '', '-1000', '0', '0', '2', '1'); +INSERT INTO `0_gl_trans` VALUES ('172', '12', '11', '2009-01-10', '1700', '', '183.6', '0', '0', '2', '3'); +INSERT INTO `0_gl_trans` VALUES ('173', '12', '11', '2009-01-10', '1500', '', '-183.6', '0', '0', '2', '3'); +INSERT INTO `0_gl_trans` VALUES ('174', '12', '11', '2009-01-10', '1500', 'Sales Invoice 17', '-0.24', '0', '0', '2', '3'); +INSERT INTO `0_gl_trans` VALUES ('175', '12', '11', '2009-01-10', '4260', 'Sales Invoice 17', '0.24', '0', '0', '2', '3'); +INSERT INTO `0_gl_trans` VALUES ('176', '10', '20', '2009-01-10', '3000', '', '-30', '0', '0', '2', '1'); +INSERT INTO `0_gl_trans` VALUES ('177', '10', '20', '2009-01-10', '1500', '', '37.5', '0', '0', '2', '1'); +INSERT INTO `0_gl_trans` VALUES ('178', '10', '20', '2009-01-10', '2664', '', '-7.5', '0', '0', '2', '1'); +INSERT INTO `0_gl_trans` VALUES ('179', '35', '6', '2009-01-10', '4210', 'Cost was -3.4114285714283 changed to 10 x quantity on hand of 12', '-160.94', '0', '0', '0', ''); +INSERT INTO `0_gl_trans` VALUES ('180', '35', '6', '2009-01-10', '1420', 'Cost was -3.4114285714283 changed to 10 x quantity on hand of 12', '160.94', '0', '0', '0', ''); +INSERT INTO `0_gl_trans` VALUES ('181', '20', '12', '2009-01-10', '2630', '', '-775', '0', '0', '3', '1'); +INSERT INTO `0_gl_trans` VALUES ('182', '20', '12', '2009-01-10', '1420', '', '200', '0', '0', '3', '1'); +INSERT INTO `0_gl_trans` VALUES ('183', '20', '12', '2009-01-10', '1420', '', '500', '0', '0', '3', '1'); +INSERT INTO `0_gl_trans` VALUES ('184', '20', '12', '2009-01-10', '2680', '', '25', '0', '0', '3', '1'); +INSERT INTO `0_gl_trans` VALUES ('185', '20', '12', '2009-01-10', '2682', '', '50', '0', '0', '3', '1'); +INSERT INTO `0_gl_trans` VALUES ('186', '22', '4', '2009-01-10', '2630', '', '200', '0', '0', '3', '1'); +INSERT INTO `0_gl_trans` VALUES ('187', '22', '4', '2009-01-10', '1700', '', '-200', '0', '0', '3', '1'); +INSERT INTO `0_gl_trans` VALUES ('188', '10', '21', '2009-01-29', '3000', '', '-14.07', '0', '0', '2', '3'); +INSERT INTO `0_gl_trans` VALUES ('189', '10', '21', '2009-01-29', '1500', '', '17.59', '0', '0', '2', '3'); +INSERT INTO `0_gl_trans` VALUES ('190', '10', '21', '2009-01-29', '2664', '', '-3.52', '0', '0', '2', '3'); +INSERT INTO `0_gl_trans` VALUES ('191', '10', '22', '2009-01-29', '3000', '', '-14.07', '0', '0', '2', '3'); +INSERT INTO `0_gl_trans` VALUES ('192', '10', '22', '2009-01-29', '1500', '', '17.59', '0', '0', '2', '3'); +INSERT INTO `0_gl_trans` VALUES ('193', '10', '22', '2009-01-29', '2664', '', '-3.52', '0', '0', '2', '3'); +INSERT INTO `0_gl_trans` VALUES ('194', '10', '23', '2009-01-29', '3000', '', '-14.07', '0', '0', '2', '3'); +INSERT INTO `0_gl_trans` VALUES ('195', '10', '23', '2009-01-29', '1500', '', '17.59', '0', '0', '2', '3'); +INSERT INTO `0_gl_trans` VALUES ('196', '10', '23', '2009-01-29', '2664', '', '-3.52', '0', '0', '2', '3'); +INSERT INTO `0_gl_trans` VALUES ('197', '10', '24', '2009-01-29', '3000', '', '-14.07', '0', '0', '2', '3'); +INSERT INTO `0_gl_trans` VALUES ('198', '10', '24', '2009-01-29', '1500', '', '17.59', '0', '0', '2', '3'); +INSERT INTO `0_gl_trans` VALUES ('199', '10', '24', '2009-01-29', '2664', '', '-3.52', '0', '0', '2', '3'); +INSERT INTO `0_gl_trans` VALUES ('200', '10', '25', '2009-01-29', '3000', '', '-17.59', '0', '0', '2', '3'); +INSERT INTO `0_gl_trans` VALUES ('201', '10', '25', '2009-01-29', '1500', '', '17.59', '0', '0', '2', '3'); +INSERT INTO `0_gl_trans` VALUES ('202', '10', '25', '2009-01-29', '1430', '', '0', '0', '0', '2', '3'); +INSERT INTO `0_gl_trans` VALUES ('203', '2', '5', '2009-01-29', '2664', 'Cash Sales', '-40', '0', '0', '4', '3'); +INSERT INTO `0_gl_trans` VALUES ('204', '2', '5', '2009-01-29', '3000', 'Cash Sales', '-160', '0', '0', '4', '3'); +INSERT INTO `0_gl_trans` VALUES ('205', '2', '5', '2009-01-29', '1700', '', '200', '0', '0', '4', '3'); +INSERT INTO `0_gl_trans` VALUES ('206', '1', '8', '2009-01-29', '2682', 'Maintenance', '10', '0', '0', '4', '1'); +INSERT INTO `0_gl_trans` VALUES ('207', '1', '8', '2009-01-29', '6600', 'Maintenance', '40', '0', '0', '4', '1'); +INSERT INTO `0_gl_trans` VALUES ('208', '1', '8', '2009-01-29', '1700', '', '-50', '0', '0', '4', '1'); +INSERT INTO `0_gl_trans` VALUES ('209', '20', '13', '2009-01-29', '2630', '', '-50', '0', '0', '3', '1'); +INSERT INTO `0_gl_trans` VALUES ('210', '20', '13', '2009-01-29', '2682', '', '10', '0', '0', '3', '1'); +INSERT INTO `0_gl_trans` VALUES ('211', '20', '13', '2009-01-29', '6730', '', '40', '0', '0', '3', '1'); +INSERT INTO `0_gl_trans` VALUES ('212', '2', '6', '2009-01-29', '2664', 'Cash Sales', '-10', '0', '0', '4', '3'); +INSERT INTO `0_gl_trans` VALUES ('213', '2', '6', '2009-01-29', '3000', 'Cash Sales', '-40', '0', '0', '4', '3'); +INSERT INTO `0_gl_trans` VALUES ('214', '2', '6', '2009-01-29', '1700', '', '50', '0', '0', '4', '3'); + + +### Structure of table `0_grn_batch` ### + +DROP TABLE IF EXISTS `0_grn_batch`; + +CREATE TABLE `0_grn_batch` ( + `id` int(11) NOT NULL auto_increment, + `supplier_id` int(11) NOT NULL default '0', + `purch_order_no` int(11) default NULL, + `reference` varchar(60) NOT NULL default '', + `delivery_date` date NOT NULL default '0000-00-00', + `loc_code` varchar(5) default NULL, + PRIMARY KEY (`id`) +) TYPE=InnoDB AUTO_INCREMENT=14 AUTO_INCREMENT=14 ; + ### Data of table `0_grn_batch` ### @@ -1556,6 +1035,24 @@ INSERT INTO `0_grn_batch` VALUES ('9', '4', '11', '9', '2008-03-25', 'DEF'); INSERT INTO `0_grn_batch` VALUES ('10', '4', '13', '10', '2008-03-25', 'DEF'); INSERT INTO `0_grn_batch` VALUES ('11', '4', '12', '11', '2008-03-25', 'DEF'); INSERT INTO `0_grn_batch` VALUES ('12', '4', '13', '12', '2008-03-28', 'DEF'); +INSERT INTO `0_grn_batch` VALUES ('13', '1', '14', '13', '2009-01-10', 'CWA'); + + +### Structure of table `0_grn_items` ### + +DROP TABLE IF EXISTS `0_grn_items`; + +CREATE TABLE `0_grn_items` ( + `id` int(11) NOT NULL auto_increment, + `grn_batch_id` int(11) default NULL, + `po_detail_item` int(11) NOT NULL default '0', + `item_code` varchar(20) NOT NULL default '', + `description` tinytext, + `qty_recd` double NOT NULL default '0', + `quantity_inv` double NOT NULL default '0', + PRIMARY KEY (`id`) +) TYPE=InnoDB AUTO_INCREMENT=18 AUTO_INCREMENT=18 ; + ### Data of table `0_grn_items` ### @@ -1565,8 +1062,8 @@ INSERT INTO `0_grn_items` VALUES ('3', '2', '3', '104', '52x CD Drive', '1', '1' INSERT INTO `0_grn_items` VALUES ('4', '3', '6', '104', '52x CD Drive (upgraded)', '3020', '302'); INSERT INTO `0_grn_items` VALUES ('5', '4', '7', '102', '17 inch VGA Monitor', '10', '10'); INSERT INTO `0_grn_items` VALUES ('6', '4', '8', '103', '32MB VGA Card', '10', '10'); -INSERT INTO `0_grn_items` VALUES ('7', '4', '9', '104', '52x CD Drive', '10', '0'); -INSERT INTO `0_grn_items` VALUES ('8', '4', '10', '202', 'Electric stimulator', '10', '0'); +INSERT INTO `0_grn_items` VALUES ('7', '4', '9', '104', '52x CD Drive', '10', '10'); +INSERT INTO `0_grn_items` VALUES ('8', '4', '10', '202', 'Electric stimulator', '10', '10'); INSERT INTO `0_grn_items` VALUES ('9', '5', '12', 'AA101', 'olie 5w40', '8', '8'); INSERT INTO `0_grn_items` VALUES ('10', '6', '12', 'AA101', 'olie 5w40', '408', '408'); INSERT INTO `0_grn_items` VALUES ('11', '7', '13', '102', '17 inch VGA Monitor', '5', '5'); @@ -1575,31 +1072,137 @@ INSERT INTO `0_grn_items` VALUES ('13', '9', '15', 'AA101', 'olie 5w40', '20', ' INSERT INTO `0_grn_items` VALUES ('14', '10', '17', '102', '17 inch VGA Monitor', '5', '0'); INSERT INTO `0_grn_items` VALUES ('15', '11', '16', '102', '17 inch VGA Monitor', '1', '0'); INSERT INTO `0_grn_items` VALUES ('16', '12', '17', '102', '17 inch VGA Monitor', '5', '0'); +INSERT INTO `0_grn_items` VALUES ('17', '13', '18', '102', '17 inch VGA Monitor', '1', '0'); + + +### Structure of table `0_groups` ### + +DROP TABLE IF EXISTS `0_groups`; + +CREATE TABLE `0_groups` ( + `id` smallint(6) unsigned NOT NULL auto_increment, + `description` varchar(60) NOT NULL default '', + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`id`), + UNIQUE KEY `description` (`description`) +) TYPE=MyISAM AUTO_INCREMENT=4 AUTO_INCREMENT=4 ; + + +### Data of table `0_groups` ### + +INSERT INTO `0_groups` VALUES ('1', 'Small', '0'); +INSERT INTO `0_groups` VALUES ('2', 'Medium', '0'); +INSERT INTO `0_groups` VALUES ('3', 'Large', '0'); + + +### Structure of table `0_item_codes` ### + +DROP TABLE IF EXISTS `0_item_codes`; + +CREATE TABLE `0_item_codes` ( + `id` int(11) unsigned NOT NULL auto_increment, + `item_code` varchar(20) NOT NULL, + `stock_id` varchar(20) NOT NULL, + `description` varchar(200) NOT NULL default '', + `category_id` smallint(6) unsigned NOT NULL, + `quantity` double NOT NULL default '1', + `is_foreign` tinyint(1) NOT NULL default '0', + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`id`), + UNIQUE KEY `stock_id` (`stock_id`,`item_code`) +) TYPE=MyISAM AUTO_INCREMENT=8 AUTO_INCREMENT=8 ; + + +### Data of table `0_item_codes` ### + +INSERT INTO `0_item_codes` VALUES ('1', '102', '102', '17 inch VGA Monitor', '1', '1', '0', '0'); +INSERT INTO `0_item_codes` VALUES ('2', '103', '103', '32MB VGA Card', '1', '1', '0', '0'); +INSERT INTO `0_item_codes` VALUES ('3', '104', '104', '52x CD Drive', '1', '1', '0', '0'); +INSERT INTO `0_item_codes` VALUES ('4', '201', '201', 'Assembly Labour', '2', '1', '0', '0'); +INSERT INTO `0_item_codes` VALUES ('5', '202', '202', 'Electric stimulator', '1', '1', '0', '0'); +INSERT INTO `0_item_codes` VALUES ('6', '3400', '3400', 'P4 Business System', '3', '1', '0', '0'); +INSERT INTO `0_item_codes` VALUES ('7', 'AA101', 'AA101', 'olie 5w40', '1', '1', '0', '0'); + + +### Structure of table `0_item_tax_type_exemptions` ### + +DROP TABLE IF EXISTS `0_item_tax_type_exemptions`; + +CREATE TABLE `0_item_tax_type_exemptions` ( + `item_tax_type_id` int(11) NOT NULL default '0', + `tax_type_id` int(11) NOT NULL default '0', + PRIMARY KEY (`item_tax_type_id`,`tax_type_id`) +) TYPE=InnoDB ; + ### Data of table `0_item_tax_type_exemptions` ### INSERT INTO `0_item_tax_type_exemptions` VALUES ('1', '1'); INSERT INTO `0_item_tax_type_exemptions` VALUES ('1', '2'); +INSERT INTO `0_item_tax_type_exemptions` VALUES ('1', '4'); INSERT INTO `0_item_tax_type_exemptions` VALUES ('2', '2'); INSERT INTO `0_item_tax_type_exemptions` VALUES ('2', '3'); + +### Structure of table `0_item_tax_types` ### + +DROP TABLE IF EXISTS `0_item_tax_types`; + +CREATE TABLE `0_item_tax_types` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(60) NOT NULL default '', + `exempt` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) TYPE=InnoDB AUTO_INCREMENT=3 AUTO_INCREMENT=3 ; + + ### Data of table `0_item_tax_types` ### INSERT INTO `0_item_tax_types` VALUES ('1', 'Regular', '0'); INSERT INTO `0_item_tax_types` VALUES ('2', 'Recovery equipment', '0'); + +### Structure of table `0_item_units` ### + +DROP TABLE IF EXISTS `0_item_units`; + +CREATE TABLE `0_item_units` ( + `abbr` varchar(20) NOT NULL default '', + `name` varchar(40) NOT NULL default '', + `decimals` tinyint(2) NOT NULL default '0', + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`abbr`), + UNIQUE KEY `name` (`name`) +) TYPE=MyISAM COMMENT='units of measure' ; + + ### Data of table `0_item_units` ### -INSERT INTO `0_item_units` VALUES ('each', 'each', '0'); -INSERT INTO `0_item_units` VALUES ('m', 'meters', '2'); -INSERT INTO `0_item_units` VALUES ('kgg', 'kilograms', '3'); -INSERT INTO `0_item_units` VALUES ('tons', 'tons', '2'); -INSERT INTO `0_item_units` VALUES ('lbs', 'pounds', '2'); -INSERT INTO `0_item_units` VALUES ('l', 'liters', '3'); -INSERT INTO `0_item_units` VALUES ('dozen', 'dozens', '0'); -INSERT INTO `0_item_units` VALUES ('pack', 'packs', '0'); -INSERT INTO `0_item_units` VALUES ('hrs', 'hours', '1'); -INSERT INTO `0_item_units` VALUES ('dz', 'dozijn', '0'); +INSERT INTO `0_item_units` VALUES ('each', 'each', '0', '0'); +INSERT INTO `0_item_units` VALUES ('m', 'meters', '2', '0'); +INSERT INTO `0_item_units` VALUES ('kgg', 'kilograms', '3', '0'); +INSERT INTO `0_item_units` VALUES ('tons', 'tons', '2', '0'); +INSERT INTO `0_item_units` VALUES ('lbs', 'pounds', '2', '0'); +INSERT INTO `0_item_units` VALUES ('l', 'liters', '3', '0'); +INSERT INTO `0_item_units` VALUES ('dozen', 'dozens', '0', '0'); +INSERT INTO `0_item_units` VALUES ('pack', 'packs', '0', '0'); +INSERT INTO `0_item_units` VALUES ('hrs', 'hours', '1', '0'); +INSERT INTO `0_item_units` VALUES ('dz', 'dozijn', '0', '0'); + + +### Structure of table `0_loc_stock` ### + +DROP TABLE IF EXISTS `0_loc_stock`; + +CREATE TABLE `0_loc_stock` ( + `loc_code` char(5) NOT NULL default '', + `stock_id` char(20) NOT NULL default '', + `reorder_level` bigint(20) NOT NULL default '0', + PRIMARY KEY (`loc_code`,`stock_id`), + KEY `stock_id` (`stock_id`) +) TYPE=InnoDB ; + ### Data of table `0_loc_stock` ### @@ -1618,68 +1221,332 @@ INSERT INTO `0_loc_stock` VALUES ('DEF', '202', '0'); INSERT INTO `0_loc_stock` VALUES ('DEF', '3400', '0'); INSERT INTO `0_loc_stock` VALUES ('DEF', 'AA101', '0'); -### Data of table `0_locations` ### -INSERT INTO `0_locations` VALUES ('DEF', 'Default', 'N/A', '', '', '', ''); -INSERT INTO `0_locations` VALUES ('CWA', 'Cool Warehouse', '', '', '', '', ''); +### Structure of table `0_locations` ### + +DROP TABLE IF EXISTS `0_locations`; + +CREATE TABLE `0_locations` ( + `loc_code` varchar(5) NOT NULL default '', + `location_name` varchar(60) NOT NULL default '', + `delivery_address` tinytext NOT NULL, + `phone` varchar(30) NOT NULL default '', + `fax` varchar(30) NOT NULL default '', + `email` varchar(100) NOT NULL default '', + `contact` varchar(30) NOT NULL default '', + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`loc_code`) +) TYPE=MyISAM ; + + +### Data of table `0_locations` ### + +INSERT INTO `0_locations` VALUES ('DEF', 'Default', 'N/A', '', '', '', '', '0'); +INSERT INTO `0_locations` VALUES ('CWA', 'Cool Warehouse', '', '', '', '', '', '0'); + + +### Structure of table `0_movement_types` ### + +DROP TABLE IF EXISTS `0_movement_types`; + +CREATE TABLE `0_movement_types` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(60) NOT NULL default '', + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) TYPE=MyISAM AUTO_INCREMENT=2 AUTO_INCREMENT=2 ; + + +### Data of table `0_movement_types` ### + +INSERT INTO `0_movement_types` VALUES ('1', 'Adjustment'); + + +### Structure of table `0_payment_terms` ### + +DROP TABLE IF EXISTS `0_payment_terms`; + +CREATE TABLE `0_payment_terms` ( + `terms_indicator` int(11) NOT NULL auto_increment, + `terms` char(80) NOT NULL default '', + `days_before_due` smallint(6) NOT NULL default '0', + `day_in_following_month` smallint(6) NOT NULL default '0', + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`terms_indicator`), + UNIQUE KEY `terms` (`terms`) +) TYPE=MyISAM AUTO_INCREMENT=5 AUTO_INCREMENT=5 ; + + +### Data of table `0_payment_terms` ### + +INSERT INTO `0_payment_terms` VALUES ('1', 'Due 15th Of the Following Month', '0', '17', '0'); +INSERT INTO `0_payment_terms` VALUES ('2', 'Due By End Of The Following Month', '0', '30', '0'); +INSERT INTO `0_payment_terms` VALUES ('3', 'Payment due within 10 days', '10', '0', '0'); +INSERT INTO `0_payment_terms` VALUES ('4', 'Cash Only', '1', '0', '0'); + + +### Structure of table `0_prices` ### + +DROP TABLE IF EXISTS `0_prices`; + +CREATE TABLE `0_prices` ( + `id` int(11) NOT NULL auto_increment, + `stock_id` varchar(20) NOT NULL default '', + `sales_type_id` int(11) NOT NULL default '0', + `curr_abrev` char(3) NOT NULL default '', + `price` double NOT NULL default '0', + PRIMARY KEY (`id`), + UNIQUE KEY `price` (`stock_id`,`sales_type_id`,`curr_abrev`) +) TYPE=MyISAM AUTO_INCREMENT=13 AUTO_INCREMENT=13 ; + + +### Data of table `0_prices` ### + +INSERT INTO `0_prices` VALUES ('1', '102', '1', 'USD', '125'); +INSERT INTO `0_prices` VALUES ('2', '103', '1', 'USD', '40'); +INSERT INTO `0_prices` VALUES ('3', '104', '1', 'USD', '34'); +INSERT INTO `0_prices` VALUES ('4', '201', '1', 'USD', '40'); +INSERT INTO `0_prices` VALUES ('5', '3400', '1', 'USD', '600'); +INSERT INTO `0_prices` VALUES ('6', '102', '2', 'USD', '100'); +INSERT INTO `0_prices` VALUES ('7', '202', '2', 'USD', '50'); +INSERT INTO `0_prices` VALUES ('8', '202', '1', 'USD', '52.5'); +INSERT INTO `0_prices` VALUES ('9', '103', '2', 'USD', '30'); +INSERT INTO `0_prices` VALUES ('10', '104', '2', 'USD', '25'); +INSERT INTO `0_prices` VALUES ('11', '201', '2', 'USD', '30'); +INSERT INTO `0_prices` VALUES ('12', '3400', '2', 'USD', '450'); + + +### Structure of table `0_print_profiles` ### + +DROP TABLE IF EXISTS `0_print_profiles`; + +CREATE TABLE `0_print_profiles` ( + `id` smallint(6) unsigned NOT NULL auto_increment, + `profile` varchar(30) NOT NULL, + `report` varchar(5) default NULL, + `printer` tinyint(3) unsigned default NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `profile` (`profile`,`report`) +) TYPE=MyISAM AUTO_INCREMENT=10 AUTO_INCREMENT=10 ; + + +### Data of table `0_print_profiles` ### + +INSERT INTO `0_print_profiles` VALUES ('1', 'Out of office', '', '0'); +INSERT INTO `0_print_profiles` VALUES ('2', 'Sales Department', '', '0'); +INSERT INTO `0_print_profiles` VALUES ('3', 'Central', '', '2'); +INSERT INTO `0_print_profiles` VALUES ('4', 'Sales Department', '104', '2'); +INSERT INTO `0_print_profiles` VALUES ('5', 'Sales Department', '105', '2'); +INSERT INTO `0_print_profiles` VALUES ('6', 'Sales Department', '107', '2'); +INSERT INTO `0_print_profiles` VALUES ('7', 'Sales Department', '109', '2'); +INSERT INTO `0_print_profiles` VALUES ('8', 'Sales Department', '110', '2'); +INSERT INTO `0_print_profiles` VALUES ('9', 'Sales Department', '201', '2'); + + +### Structure of table `0_printers` ### + +DROP TABLE IF EXISTS `0_printers`; + +CREATE TABLE `0_printers` ( + `id` tinyint(3) unsigned NOT NULL auto_increment, + `name` varchar(20) NOT NULL, + `description` varchar(60) NOT NULL, + `queue` varchar(20) NOT NULL, + `host` varchar(40) NOT NULL, + `port` smallint(11) unsigned NOT NULL, + `timeout` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) TYPE=MyISAM AUTO_INCREMENT=4 AUTO_INCREMENT=4 ; + + +### Data of table `0_printers` ### + +INSERT INTO `0_printers` VALUES ('1', 'QL500', 'Label printer', 'QL500', 'server', '127', '20'); +INSERT INTO `0_printers` VALUES ('2', 'Samsung', 'Main network printer', 'scx4521F', 'server', '515', '5'); +INSERT INTO `0_printers` VALUES ('3', 'Local', 'Local print server at user IP', 'lp', '', '515', '10'); + + +### Structure of table `0_purch_data` ### + +DROP TABLE IF EXISTS `0_purch_data`; + +CREATE TABLE `0_purch_data` ( + `supplier_id` int(11) NOT NULL default '0', + `stock_id` char(20) NOT NULL default '', + `price` double NOT NULL default '0', + `suppliers_uom` char(50) NOT NULL default '', + `conversion_factor` double NOT NULL default '1', + `supplier_description` char(50) NOT NULL default '', + PRIMARY KEY (`supplier_id`,`stock_id`) +) TYPE=MyISAM ; + + +### Data of table `0_purch_data` ### + +INSERT INTO `0_purch_data` VALUES ('1', '102', '10', '', '1', '17 inch VGA Monitor'); +INSERT INTO `0_purch_data` VALUES ('1', '104', '20', '', '1', ''); +INSERT INTO `0_purch_data` VALUES ('1', '202', '50', '', '1', ''); + + +### Structure of table `0_purch_order_details` ### + +DROP TABLE IF EXISTS `0_purch_order_details`; + +CREATE TABLE `0_purch_order_details` ( + `po_detail_item` int(11) NOT NULL auto_increment, + `order_no` int(11) NOT NULL default '0', + `item_code` varchar(20) NOT NULL default '', + `description` tinytext, + `delivery_date` date NOT NULL default '0000-00-00', + `qty_invoiced` double NOT NULL default '0', + `unit_price` double NOT NULL default '0', + `act_price` double NOT NULL default '0', + `std_cost_unit` double NOT NULL default '0', + `quantity_ordered` double NOT NULL default '0', + `quantity_received` double NOT NULL default '0', + PRIMARY KEY (`po_detail_item`) +) TYPE=InnoDB AUTO_INCREMENT=19 AUTO_INCREMENT=19 ; + + +### Data of table `0_purch_order_details` ### + +INSERT INTO `0_purch_order_details` VALUES ('1', '1', '102', '17 inch VGA Monitor', '2006-01-28', '10', '3020', '3020', '0', '3000', '10'); +INSERT INTO `0_purch_order_details` VALUES ('2', '1', '103', '32MB VGA Card', '2006-01-28', '50', '90', '90', '0', '300', '50'); +INSERT INTO `0_purch_order_details` VALUES ('3', '2', '104', '52x CD Drive', '2006-01-28', '1', '26', '26', '0', '1', '1'); +INSERT INTO `0_purch_order_details` VALUES ('4', '3', '104', '52x CD Drive', '2006-01-28', '0', '22', '0', '0', '1', '0'); +INSERT INTO `0_purch_order_details` VALUES ('6', '5', '104', '52x CD Drive', '2006-01-28', '302', '22', '22', '0', '330', '3020'); +INSERT INTO `0_purch_order_details` VALUES ('7', '6', '102', '17 inch VGA Monitor', '2008-03-16', '10', '25', '25', '80', '10', '10'); +INSERT INTO `0_purch_order_details` VALUES ('8', '6', '103', '32MB VGA Card', '2008-03-16', '10', '30', '30', '20', '10', '10'); +INSERT INTO `0_purch_order_details` VALUES ('9', '6', '104', '52x CD Drive', '2008-03-16', '10', '20', '20', '18', '10', '10'); +INSERT INTO `0_purch_order_details` VALUES ('10', '6', '202', 'Electric stimulator', '2008-03-16', '10', '50', '50', '30', '10', '10'); +INSERT INTO `0_purch_order_details` VALUES ('12', '8', 'AA101', 'olie 5w40', '2008-03-25', '416', '3.25', '3.25', '0', '416', '416'); +INSERT INTO `0_purch_order_details` VALUES ('13', '9', '102', '17 inch VGA Monitor', '2008-03-30', '5', '0', '0', '80', '5', '5'); +INSERT INTO `0_purch_order_details` VALUES ('14', '10', '102', '17 inch VGA Monitor', '2008-04-04', '1', '10', '10', '-120', '1', '1'); +INSERT INTO `0_purch_order_details` VALUES ('15', '11', 'AA101', 'olie 5w40', '2008-04-04', '0', '3.25', '0', '5.0599485576923', '20', '20'); +INSERT INTO `0_purch_order_details` VALUES ('16', '12', '102', '17 inch VGA Monitor', '2008-04-04', '0', '10', '0', '-17.79125', '1', '1'); +INSERT INTO `0_purch_order_details` VALUES ('17', '13', '102', '17 inch VGA Monitor', '2008-04-04', '0', '10', '0', '-73.393333333333', '10', '10'); +INSERT INTO `0_purch_order_details` VALUES ('18', '14', '102', '17 inch VGA Monitor', '2009-01-20', '0', '10', '10', '10', '1', '1'); + + +### Structure of table `0_purch_orders` ### + +DROP TABLE IF EXISTS `0_purch_orders`; + +CREATE TABLE `0_purch_orders` ( + `order_no` int(11) NOT NULL auto_increment, + `version` tinyint(1) unsigned NOT NULL default '0', + `supplier_id` int(11) NOT NULL default '0', + `comments` tinytext, + `ord_date` date NOT NULL default '0000-00-00', + `reference` tinytext NOT NULL, + `requisition_no` tinytext, + `into_stock_location` varchar(5) NOT NULL default '', + `delivery_address` tinytext NOT NULL, + PRIMARY KEY (`order_no`) +) TYPE=InnoDB AUTO_INCREMENT=15 AUTO_INCREMENT=15 ; + + +### Data of table `0_purch_orders` ### + +INSERT INTO `0_purch_orders` VALUES ('1', '0', '1', '', '2006-01-18', '3', '333', 'DEF', 'N/A'); +INSERT INTO `0_purch_orders` VALUES ('2', '0', '1', '', '2006-01-18', '4', '44', 'DEF', 'N/A'); +INSERT INTO `0_purch_orders` VALUES ('3', '0', '1', '', '2006-01-18', '5', '', 'DEF', 'N/A'); +INSERT INTO `0_purch_orders` VALUES ('5', '0', '1', '', '2006-01-18', '7', '', 'DEF', 'N/A'); +INSERT INTO `0_purch_orders` VALUES ('6', '0', '1', '', '2008-03-06', '8', '', 'DEF', 'N/A'); +INSERT INTO `0_purch_orders` VALUES ('8', '0', '4', '', '2008-03-15', '9', '', 'DEF', 'N/A'); +INSERT INTO `0_purch_orders` VALUES ('9', '0', '2', '', '2008-03-20', '10', '', 'DEF', 'N/A'); +INSERT INTO `0_purch_orders` VALUES ('10', '0', '2', '', '2008-03-25', '11', '', 'DEF', 'N/A'); +INSERT INTO `0_purch_orders` VALUES ('11', '0', '4', '', '2008-03-25', '12', '', 'DEF', 'N/A'); +INSERT INTO `0_purch_orders` VALUES ('12', '0', '4', '', '2008-03-25', '13', '', 'DEF', 'N/A'); +INSERT INTO `0_purch_orders` VALUES ('13', '0', '4', '', '2008-03-25', '14', '', 'DEF', 'N/A'); +INSERT INTO `0_purch_orders` VALUES ('14', '0', '1', '', '2009-01-10', '15', '', 'CWA', 'address'); + + +### Structure of table `0_quick_entries` ### + +DROP TABLE IF EXISTS `0_quick_entries`; + +CREATE TABLE `0_quick_entries` ( + `id` smallint(6) unsigned NOT NULL auto_increment, + `type` tinyint(1) NOT NULL default '0', + `description` varchar(60) NOT NULL, + `base_amount` double NOT NULL default '0', + `base_desc` varchar(60) default NULL, + PRIMARY KEY (`id`), + KEY `description` (`description`) +) TYPE=MyISAM AUTO_INCREMENT=4 AUTO_INCREMENT=4 ; + + +### Data of table `0_quick_entries` ### + +INSERT INTO `0_quick_entries` VALUES ('1', '1', 'Maintenance', '0', 'Amount'); +INSERT INTO `0_quick_entries` VALUES ('2', '4', 'Phone', '0', 'Amount'); +INSERT INTO `0_quick_entries` VALUES ('3', '2', 'Cash Sales', '0', 'Amount'); -### Data of table `0_movement_types` ### -INSERT INTO `0_movement_types` VALUES ('1', 'Adjustment'); +### Structure of table `0_quick_entry_lines` ### -### Data of table `0_payment_terms` ### +DROP TABLE IF EXISTS `0_quick_entry_lines`; -INSERT INTO `0_payment_terms` VALUES ('1', 'Due 15th Of the Following Month', '0', '17'); -INSERT INTO `0_payment_terms` VALUES ('2', 'Due By End Of The Following Month', '0', '30'); -INSERT INTO `0_payment_terms` VALUES ('3', 'Payment due within 10 days', '10', '0'); -INSERT INTO `0_payment_terms` VALUES ('4', 'Cash Only', '1', '0'); +CREATE TABLE `0_quick_entry_lines` ( + `id` smallint(6) unsigned NOT NULL auto_increment, + `qid` smallint(6) unsigned NOT NULL, + `amount` double default '0', + `action` varchar(2) NOT NULL, + `dest_id` varchar(11) NOT NULL, + `dimension_id` smallint(6) unsigned default NULL, + `dimension2_id` smallint(6) unsigned default NULL, + PRIMARY KEY (`id`), + KEY `qid` (`qid`) +) TYPE=MyISAM AUTO_INCREMENT=7 AUTO_INCREMENT=7 ; -### Data of table `0_prices` ### -INSERT INTO `0_prices` VALUES ('1', '102', '1', 'USD', '125'); -INSERT INTO `0_prices` VALUES ('2', '103', '1', 'USD', '40'); -INSERT INTO `0_prices` VALUES ('3', '104', '1', 'USD', '34'); -INSERT INTO `0_prices` VALUES ('4', '201', '1', 'USD', '40'); -INSERT INTO `0_prices` VALUES ('5', '3400', '1', 'USD', '600'); -INSERT INTO `0_prices` VALUES ('6', '102', '2', 'USD', '100'); -INSERT INTO `0_prices` VALUES ('7', '202', '2', 'USD', '50'); -INSERT INTO `0_prices` VALUES ('8', '202', '1', 'USD', '52.5'); -INSERT INTO `0_prices` VALUES ('9', '103', '2', 'USD', '30'); -INSERT INTO `0_prices` VALUES ('10', '104', '2', 'USD', '25'); -INSERT INTO `0_prices` VALUES ('11', '201', '2', 'USD', '30'); -INSERT INTO `0_prices` VALUES ('12', '3400', '2', 'USD', '450'); +### Data of table `0_quick_entry_lines` ### -### Data of table `0_purch_order_details` ### +INSERT INTO `0_quick_entry_lines` VALUES ('1', '1', '0', 't-', '1', '0', '0'); +INSERT INTO `0_quick_entry_lines` VALUES ('2', '2', '0', 't-', '1', '0', '0'); +INSERT INTO `0_quick_entry_lines` VALUES ('3', '3', '0', 't-', '1', '0', '0'); +INSERT INTO `0_quick_entry_lines` VALUES ('4', '3', '0', '=', '3000', '0', '0'); +INSERT INTO `0_quick_entry_lines` VALUES ('5', '1', '0', '=', '6600', '0', '0'); +INSERT INTO `0_quick_entry_lines` VALUES ('6', '2', '0', '=', '6730', '0', '0'); -INSERT INTO `0_purch_order_details` VALUES ('1', '1', '102', '17 inch VGA Monitor', '2006-01-28', '10', '3020', '3020', '0', '3000', '10'); -INSERT INTO `0_purch_order_details` VALUES ('2', '1', '103', '32MB VGA Card', '2006-01-28', '50', '90', '90', '0', '300', '50'); -INSERT INTO `0_purch_order_details` VALUES ('3', '2', '104', '52x CD Drive', '2006-01-28', '1', '26', '26', '0', '1', '1'); -INSERT INTO `0_purch_order_details` VALUES ('4', '3', '104', '52x CD Drive', '2006-01-28', '0', '22', '0', '0', '1', '0'); -INSERT INTO `0_purch_order_details` VALUES ('6', '5', '104', '52x CD Drive', '2006-01-28', '302', '22', '22', '0', '330', '3020'); -INSERT INTO `0_purch_order_details` VALUES ('7', '6', '102', '17 inch VGA Monitor', '2008-03-16', '10', '25', '25', '80', '10', '10'); -INSERT INTO `0_purch_order_details` VALUES ('8', '6', '103', '32MB VGA Card', '2008-03-16', '10', '30', '30', '20', '10', '10'); -INSERT INTO `0_purch_order_details` VALUES ('9', '6', '104', '52x CD Drive', '2008-03-16', '0', '20', '0', '18', '10', '10'); -INSERT INTO `0_purch_order_details` VALUES ('10', '6', '202', 'Electric stimulator', '2008-03-16', '0', '50', '0', '30', '10', '10'); -INSERT INTO `0_purch_order_details` VALUES ('12', '8', 'AA101', 'olie 5w40', '2008-03-25', '416', '3.25', '3.25', '0', '416', '416'); -INSERT INTO `0_purch_order_details` VALUES ('13', '9', '102', '17 inch VGA Monitor', '2008-03-30', '5', '0', '0', '80', '5', '5'); -INSERT INTO `0_purch_order_details` VALUES ('14', '10', '102', '17 inch VGA Monitor', '2008-04-04', '1', '10', '10', '-120', '1', '1'); -INSERT INTO `0_purch_order_details` VALUES ('15', '11', 'AA101', 'olie 5w40', '2008-04-04', '0', '3.25', '0', '5.0599485576923', '20', '20'); -INSERT INTO `0_purch_order_details` VALUES ('16', '12', '102', '17 inch VGA Monitor', '2008-04-04', '0', '10', '0', '-17.79125', '1', '1'); -INSERT INTO `0_purch_order_details` VALUES ('17', '13', '102', '17 inch VGA Monitor', '2008-04-04', '0', '10', '0', '-73.393333333333', '10', '10'); -### Data of table `0_purch_orders` ### +### Structure of table `0_recurrent_invoices` ### + +DROP TABLE IF EXISTS `0_recurrent_invoices`; + +CREATE TABLE `0_recurrent_invoices` ( + `id` smallint(6) unsigned NOT NULL auto_increment, + `description` varchar(60) NOT NULL default '', + `order_no` int(11) unsigned NOT NULL, + `debtor_no` int(11) unsigned default NULL, + `group_no` smallint(6) unsigned default NULL, + `days` int(11) NOT NULL default '0', + `monthly` int(11) NOT NULL default '0', + `begin` date NOT NULL default '0000-00-00', + `end` date NOT NULL default '0000-00-00', + `last_sent` date NOT NULL default '0000-00-00', + PRIMARY KEY (`id`), + UNIQUE KEY `description` (`description`) +) TYPE=InnoDB AUTO_INCREMENT=1 ; + + +### Data of table `0_recurrent_invoices` ### + + + +### Structure of table `0_refs` ### + +DROP TABLE IF EXISTS `0_refs`; + +CREATE TABLE `0_refs` ( + `id` int(11) NOT NULL default '0', + `type` int(11) NOT NULL default '0', + `reference` varchar(100) NOT NULL default '', + PRIMARY KEY (`id`,`type`) +) TYPE=InnoDB ; -INSERT INTO `0_purch_orders` VALUES ('1', '0', '1', NULL, '2006-01-18', '3', '333', 'DEF', 'N/A'); -INSERT INTO `0_purch_orders` VALUES ('2', '0', '1', NULL, '2006-01-18', '4', '44', 'DEF', 'N/A'); -INSERT INTO `0_purch_orders` VALUES ('3', '0', '1', NULL, '2006-01-18', '5', NULL, 'DEF', 'N/A'); -INSERT INTO `0_purch_orders` VALUES ('5', '0', '1', NULL, '2006-01-18', '7', NULL, 'DEF', 'N/A'); -INSERT INTO `0_purch_orders` VALUES ('6', '0', '1', NULL, '2008-03-06', '8', NULL, 'DEF', 'N/A'); -INSERT INTO `0_purch_orders` VALUES ('8', '0', '4', NULL, '2008-03-15', '9', NULL, 'DEF', 'N/A'); -INSERT INTO `0_purch_orders` VALUES ('9', '0', '2', NULL, '2008-03-20', '10', NULL, 'DEF', 'N/A'); -INSERT INTO `0_purch_orders` VALUES ('10', '0', '2', NULL, '2008-03-25', '11', NULL, 'DEF', 'N/A'); -INSERT INTO `0_purch_orders` VALUES ('11', '0', '4', NULL, '2008-03-25', '12', NULL, 'DEF', 'N/A'); -INSERT INTO `0_purch_orders` VALUES ('12', '0', '4', NULL, '2008-03-25', '13', NULL, 'DEF', 'N/A'); -INSERT INTO `0_purch_orders` VALUES ('13', '0', '4', NULL, '2008-03-25', '14', NULL, 'DEF', 'N/A'); ### Data of table `0_refs` ### @@ -1701,6 +1568,24 @@ INSERT INTO `0_refs` VALUES ('16', '0', '31'); INSERT INTO `0_refs` VALUES ('17', '0', '32'); INSERT INTO `0_refs` VALUES ('18', '0', '33'); + +### Structure of table `0_sales_order_details` ### + +DROP TABLE IF EXISTS `0_sales_order_details`; + +CREATE TABLE `0_sales_order_details` ( + `id` int(11) NOT NULL auto_increment, + `order_no` int(11) NOT NULL default '0', + `stk_code` varchar(20) NOT NULL default '', + `description` tinytext, + `qty_sent` double NOT NULL default '0', + `unit_price` double NOT NULL default '0', + `quantity` double NOT NULL default '0', + `discount_percent` double NOT NULL default '0', + PRIMARY KEY (`id`) +) TYPE=InnoDB AUTO_INCREMENT=31 AUTO_INCREMENT=31 ; + + ### Data of table `0_sales_order_details` ### INSERT INTO `0_sales_order_details` VALUES ('1', '1', '102', '17 inch VGA Monitor', '1', '125', '1', '0'); @@ -1725,62 +1610,267 @@ INSERT INTO `0_sales_order_details` VALUES ('20', '19', '102', '17 inch VGA Moni INSERT INTO `0_sales_order_details` VALUES ('21', '19', 'AA101', 'olie 5w40', '1', '125', '1', '0'); INSERT INTO `0_sales_order_details` VALUES ('22', '20', '102', '17 inch VGA Monitor', '1', '0', '1', '0'); INSERT INTO `0_sales_order_details` VALUES ('23', '21', '102', '17 inch VGA Monitor', '1', '125', '1', '0'); +INSERT INTO `0_sales_order_details` VALUES ('24', '22', '201', 'Assembly Labour', '1', '30', '1', '0'); +INSERT INTO `0_sales_order_details` VALUES ('25', '23', '201', 'Assembly Labour', '1', '100', '1', '0'); +INSERT INTO `0_sales_order_details` VALUES ('26', '24', '201', 'Assembly Labour', '1', '100', '1', '0'); +INSERT INTO `0_sales_order_details` VALUES ('27', '25', '201', 'Assembly Labour', '1', '100', '1', '0'); +INSERT INTO `0_sales_order_details` VALUES ('28', '26', '201', 'Assembly Labour', '1', '100', '1', '0'); +INSERT INTO `0_sales_order_details` VALUES ('29', '27', '201', 'Assembly Labour', '1', '100', '1', '0'); +INSERT INTO `0_sales_order_details` VALUES ('30', '28', '201', 'Assembly Labour', '1', '110', '1', '0'); + + +### Structure of table `0_sales_orders` ### + +DROP TABLE IF EXISTS `0_sales_orders`; + +CREATE TABLE `0_sales_orders` ( + `order_no` int(11) NOT NULL auto_increment, + `version` tinyint(1) unsigned NOT NULL default '0', + `type` tinyint(1) NOT NULL default '0', + `debtor_no` int(11) NOT NULL default '0', + `branch_code` int(11) NOT NULL default '0', + `customer_ref` tinytext NOT NULL, + `comments` tinytext, + `ord_date` date NOT NULL default '0000-00-00', + `order_type` int(11) NOT NULL default '0', + `ship_via` int(11) NOT NULL default '0', + `delivery_address` tinytext NOT NULL, + `contact_phone` varchar(30) default NULL, + `contact_email` varchar(100) default NULL, + `deliver_to` tinytext NOT NULL, + `freight_cost` double NOT NULL default '0', + `from_stk_loc` varchar(5) NOT NULL default '', + `delivery_date` date NOT NULL default '0000-00-00', + PRIMARY KEY (`order_no`) +) TYPE=InnoDB AUTO_INCREMENT=29 AUTO_INCREMENT=29 ; + ### Data of table `0_sales_orders` ### -INSERT INTO `0_sales_orders` VALUES ('1', '1', '1', '4', '6', '', NULL, '2008-03-06', '1', '1', 'Never Mind 13', '123', NULL, 'Johny Bravo', '10', 'DEF', '2008-03-16'); -INSERT INTO `0_sales_orders` VALUES ('2', '1', '0', '4', '6', '', NULL, '2008-03-06', '1', '1', 'Never Mind 13', '123', NULL, 'Johny Bravo', '10', 'DEF', '2008-03-06'); -INSERT INTO `0_sales_orders` VALUES ('3', '1', '0', '4', '6', '', NULL, '2008-03-06', '1', '1', 'Never Mind 13', '123', NULL, 'Johny Bravo', '10', 'DEF', '2008-03-06'); -INSERT INTO `0_sales_orders` VALUES ('4', '1', '0', '4', '6', '', NULL, '2008-03-06', '1', '1', 'Never Mind 13', '123', NULL, 'Johny Bravo', '10', 'DEF', '2008-03-06'); -INSERT INTO `0_sales_orders` VALUES ('5', '1', '1', '4', '6', '', NULL, '2008-03-06', '1', '1', 'Never Mind 13', '123', NULL, 'Johny Bravo', '10', 'DEF', '2008-03-06'); -INSERT INTO `0_sales_orders` VALUES ('6', '1', '0', '4', '6', '', NULL, '2008-03-06', '1', '1', 'Never Mind 13', '123', NULL, 'Johny Bravo', '10', 'DEF', '2008-03-06'); -INSERT INTO `0_sales_orders` VALUES ('7', '1', '0', '4', '6', '', NULL, '2008-03-06', '1', '1', 'Never Mind 13', '123', NULL, 'Johny Bravo', '10', 'DEF', '2008-03-06'); -INSERT INTO `0_sales_orders` VALUES ('8', '1', '0', '4', '6', '', NULL, '2008-03-07', '1', '1', 'Never Mind 13', '123', NULL, 'Johny Bravo', '10', 'DEF', '2008-03-07'); -INSERT INTO `0_sales_orders` VALUES ('9', '1', '0', '4', '6', '', NULL, '2008-03-08', '1', '1', 'Never Mind 13', '123', NULL, 'Johny Bravo', '10', 'DEF', '2008-03-08'); -INSERT INTO `0_sales_orders` VALUES ('10', '1', '0', '4', '6', '', NULL, '2008-03-09', '1', '1', 'Never Mind 13', '123', NULL, 'Johny Bravo', '12.5', 'DEF', '2008-03-09'); -INSERT INTO `0_sales_orders` VALUES ('11', '1', '0', '1', '1', '', NULL, '2008-03-09', '2', '1', 'The Road', NULL, NULL, 'Main', '10', 'DEF', '2008-03-09'); -INSERT INTO `0_sales_orders` VALUES ('12', '1', '0', '4', '6', '', NULL, '2008-03-09', '1', '1', 'Never Mind 13', '123', NULL, 'Johny Bravo', '10', 'DEF', '2008-03-09'); -INSERT INTO `0_sales_orders` VALUES ('13', '0', '0', '4', '6', '', NULL, '2008-03-10', '1', '1', 'Never Mind 13', '123', NULL, 'Johny Bravo', '0', 'DEF', '2008-03-20'); -INSERT INTO `0_sales_orders` VALUES ('14', '1', '0', '4', '6', '', NULL, '2008-03-10', '1', '1', 'Never Mind 13', '123', NULL, 'Johny Bravo', '0', 'DEF', '2008-03-20'); -INSERT INTO `0_sales_orders` VALUES ('15', '1', '0', '1', '1', '', NULL, '2008-03-10', '2', '1', 'The Road', NULL, NULL, 'Main', '0', 'DEF', '2008-03-20'); -INSERT INTO `0_sales_orders` VALUES ('16', '1', '0', '1', '1', '', NULL, '2008-03-10', '2', '1', 'The Road', NULL, NULL, 'Main', '0', 'DEF', '2008-03-20'); -INSERT INTO `0_sales_orders` VALUES ('17', '1', '0', '3', '5', '', NULL, '2008-03-10', '1', '1', 'N/A', NULL, NULL, 'Main', '0', 'CWA', '2008-03-20'); -INSERT INTO `0_sales_orders` VALUES ('18', '1', '0', '4', '6', '', NULL, '2008-03-10', '1', '1', 'Never Mind 13', '123', NULL, 'Johny Bravo', '10', 'DEF', '2008-03-10'); -INSERT INTO `0_sales_orders` VALUES ('19', '2', '0', '4', '6', '', NULL, '2008-03-17', '1', '1', 'Never Mind 13', '123', NULL, 'Johny Bravo', '10', 'DEF', '2008-03-27'); -INSERT INTO `0_sales_orders` VALUES ('20', '1', '0', '3', '5', '', NULL, '2008-03-29', '1', '1', 'N/A', NULL, NULL, 'Main', '0', 'CWA', '2008-04-17'); -INSERT INTO `0_sales_orders` VALUES ('21', '1', '0', '4', '6', '', NULL, '2008-03-29', '1', '1', 'Never Mind 13', '123', NULL, 'Johny Bravo', '0', 'DEF', '2008-04-08'); +INSERT INTO `0_sales_orders` VALUES ('1', '1', '1', '4', '6', '', '', '2008-03-06', '1', '1', 'Never Mind 13', '123', '', 'Johny Bravo', '10', 'DEF', '2008-03-16'); +INSERT INTO `0_sales_orders` VALUES ('2', '1', '0', '4', '6', '', '', '2008-03-06', '1', '1', 'Never Mind 13', '123', '', 'Johny Bravo', '10', 'DEF', '2008-03-06'); +INSERT INTO `0_sales_orders` VALUES ('3', '1', '0', '4', '6', '', '', '2008-03-06', '1', '1', 'Never Mind 13', '123', '', 'Johny Bravo', '10', 'DEF', '2008-03-06'); +INSERT INTO `0_sales_orders` VALUES ('4', '1', '0', '4', '6', '', '', '2008-03-06', '1', '1', 'Never Mind 13', '123', '', 'Johny Bravo', '10', 'DEF', '2008-03-06'); +INSERT INTO `0_sales_orders` VALUES ('5', '1', '1', '4', '6', '', '', '2008-03-06', '1', '1', 'Never Mind 13', '123', '', 'Johny Bravo', '10', 'DEF', '2008-03-06'); +INSERT INTO `0_sales_orders` VALUES ('6', '1', '0', '4', '6', '', '', '2008-03-06', '1', '1', 'Never Mind 13', '123', '', 'Johny Bravo', '10', 'DEF', '2008-03-06'); +INSERT INTO `0_sales_orders` VALUES ('7', '1', '0', '4', '6', '', '', '2008-03-06', '1', '1', 'Never Mind 13', '123', '', 'Johny Bravo', '10', 'DEF', '2008-03-06'); +INSERT INTO `0_sales_orders` VALUES ('8', '1', '0', '4', '6', '', '', '2008-03-07', '1', '1', 'Never Mind 13', '123', '', 'Johny Bravo', '10', 'DEF', '2008-03-07'); +INSERT INTO `0_sales_orders` VALUES ('9', '1', '0', '4', '6', '', '', '2008-03-08', '1', '1', 'Never Mind 13', '123', '', 'Johny Bravo', '10', 'DEF', '2008-03-08'); +INSERT INTO `0_sales_orders` VALUES ('10', '1', '0', '4', '6', '', '', '2008-03-09', '1', '1', 'Never Mind 13', '123', '', 'Johny Bravo', '12.5', 'DEF', '2008-03-09'); +INSERT INTO `0_sales_orders` VALUES ('11', '1', '0', '1', '1', '', '', '2008-03-09', '2', '1', 'The Road', '', '', 'Main', '10', 'DEF', '2008-03-09'); +INSERT INTO `0_sales_orders` VALUES ('12', '1', '0', '4', '6', '', '', '2008-03-09', '1', '1', 'Never Mind 13', '123', '', 'Johny Bravo', '10', 'DEF', '2008-03-09'); +INSERT INTO `0_sales_orders` VALUES ('13', '0', '0', '4', '6', '', '', '2008-03-10', '1', '1', 'Never Mind 13', '123', '', 'Johny Bravo', '0', 'DEF', '2008-03-20'); +INSERT INTO `0_sales_orders` VALUES ('14', '1', '0', '4', '6', '', '', '2008-03-10', '1', '1', 'Never Mind 13', '123', '', 'Johny Bravo', '0', 'DEF', '2008-03-20'); +INSERT INTO `0_sales_orders` VALUES ('15', '1', '0', '1', '1', '', '', '2008-03-10', '2', '1', 'The Road', '', '', 'Main', '0', 'DEF', '2008-03-20'); +INSERT INTO `0_sales_orders` VALUES ('16', '1', '0', '1', '1', '', '', '2008-03-10', '2', '1', 'The Road', '', '', 'Main', '0', 'DEF', '2008-03-20'); +INSERT INTO `0_sales_orders` VALUES ('17', '1', '0', '3', '5', '', '', '2008-03-10', '1', '1', 'N/A', '', '', 'Main', '0', 'CWA', '2008-03-20'); +INSERT INTO `0_sales_orders` VALUES ('18', '1', '0', '4', '6', '', '', '2008-03-10', '1', '1', 'Never Mind 13', '123', '', 'Johny Bravo', '10', 'DEF', '2008-03-10'); +INSERT INTO `0_sales_orders` VALUES ('19', '2', '0', '4', '6', '', '', '2008-03-17', '1', '1', 'Never Mind 13', '123', '', 'Johny Bravo', '10', 'DEF', '2008-03-27'); +INSERT INTO `0_sales_orders` VALUES ('20', '1', '0', '3', '5', '', '', '2008-03-29', '1', '1', 'N/A', '', '', 'Main', '0', 'CWA', '2008-04-17'); +INSERT INTO `0_sales_orders` VALUES ('21', '1', '0', '4', '6', '', '', '2008-03-29', '1', '1', 'Never Mind 13', '123', '', 'Johny Bravo', '0', 'DEF', '2008-04-08'); +INSERT INTO `0_sales_orders` VALUES ('22', '1', '0', '1', '1', '', '', '2009-01-10', '2', '1', 'The Road', '', '', 'Main', '0', 'DEF', '2009-02-17'); +INSERT INTO `0_sales_orders` VALUES ('23', '1', '0', '3', '7', '', '', '2009-01-29', '1', '1', 'N/A', '1223123', '', 'Junk Beer ApS', '0', 'DEF', '2009-01-29'); +INSERT INTO `0_sales_orders` VALUES ('24', '1', '0', '3', '7', '', '', '2009-01-29', '1', '1', 'N/A', '1223123', '', 'Junk Beer ApS', '0', 'DEF', '2009-02-17'); +INSERT INTO `0_sales_orders` VALUES ('25', '1', '0', '3', '7', '', '', '2009-01-29', '1', '1', 'N/A', '1223123', '', 'Junk Beer ApS', '0', 'DEF', '2009-02-17'); +INSERT INTO `0_sales_orders` VALUES ('26', '1', '0', '3', '7', '', '', '2009-01-29', '1', '1', 'N/A', '1223123', '', 'Junk Beer ApS', '0', 'DEF', '2009-02-17'); +INSERT INTO `0_sales_orders` VALUES ('27', '1', '0', '3', '7', '', '', '2009-01-29', '1', '1', 'N/A', '1223123', '', 'Junk Beer ApS', '0', 'DEF', '2009-02-17'); +INSERT INTO `0_sales_orders` VALUES ('28', '1', '0', '3', '7', '', '', '2009-01-30', '1', '1', 'N/A', '1223123', '', 'Junk Beer ApS', '0', 'DEF', '2009-01-31'); + + +### Structure of table `0_sales_pos` ### + +DROP TABLE IF EXISTS `0_sales_pos`; + +CREATE TABLE `0_sales_pos` ( + `id` smallint(6) unsigned NOT NULL auto_increment, + `pos_name` varchar(30) NOT NULL, + `cash_sale` tinyint(1) NOT NULL, + `credit_sale` tinyint(1) NOT NULL, + `pos_location` varchar(5) NOT NULL, + `pos_account` smallint(6) unsigned NOT NULL, + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`id`), + UNIQUE KEY `pos_name` (`pos_name`) +) TYPE=MyISAM AUTO_INCREMENT=2 AUTO_INCREMENT=2 ; + + +### Data of table `0_sales_pos` ### + +INSERT INTO `0_sales_pos` VALUES ('1', 'Default', '1', '1', 'DEF', '2', '0'); + + +### Structure of table `0_sales_types` ### + +DROP TABLE IF EXISTS `0_sales_types`; + +CREATE TABLE `0_sales_types` ( + `id` int(11) NOT NULL auto_increment, + `sales_type` char(50) NOT NULL default '', + `tax_included` int(1) NOT NULL default '0', + `factor` double NOT NULL default '1', + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`id`), + UNIQUE KEY `sales_type` (`sales_type`) +) TYPE=MyISAM AUTO_INCREMENT=3 AUTO_INCREMENT=3 ; + ### Data of table `0_sales_types` ### -INSERT INTO `0_sales_types` VALUES ('1', 'Retail', '1', 1); -INSERT INTO `0_sales_types` VALUES ('2', 'Wholesale', '0', 1); +INSERT INTO `0_sales_types` VALUES ('1', 'Retail', '1', '1', '0'); +INSERT INTO `0_sales_types` VALUES ('2', 'Wholesale', '0', '1', '0'); + + +### Structure of table `0_salesman` ### + +DROP TABLE IF EXISTS `0_salesman`; + +CREATE TABLE `0_salesman` ( + `salesman_code` int(11) NOT NULL auto_increment, + `salesman_name` varchar(60) NOT NULL default '', + `salesman_phone` varchar(30) NOT NULL default '', + `salesman_fax` varchar(30) NOT NULL default '', + `salesman_email` varchar(100) NOT NULL default '', + `provision` double NOT NULL default '0', + `break_pt` double NOT NULL default '0', + `provision2` double NOT NULL default '0', + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`salesman_code`), + UNIQUE KEY `salesman_name` (`salesman_name`) +) TYPE=MyISAM AUTO_INCREMENT=3 AUTO_INCREMENT=3 ; + ### Data of table `0_salesman` ### -INSERT INTO `0_salesman` VALUES ('1', 'Sparc Menser', '', '', '', '5', '1000', '4'); -INSERT INTO `0_salesman` VALUES ('2', 'Joe Hunt', '', '', '', '4', '500', '3'); +INSERT INTO `0_salesman` VALUES ('1', 'Sparc Menser', '', '', '', '5', '1000', '4', '0'); +INSERT INTO `0_salesman` VALUES ('2', 'Joe Hunt', '', '', '', '4', '500', '3', '0'); + + +### Structure of table `0_shippers` ### + +DROP TABLE IF EXISTS `0_shippers`; + +CREATE TABLE `0_shippers` ( + `shipper_id` int(11) NOT NULL auto_increment, + `shipper_name` varchar(60) NOT NULL default '', + `phone` varchar(30) NOT NULL default '', + `contact` tinytext NOT NULL, + `address` tinytext NOT NULL, + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`shipper_id`), + UNIQUE KEY `name` (`shipper_name`) +) TYPE=MyISAM AUTO_INCREMENT=3 AUTO_INCREMENT=3 ; + ### Data of table `0_shippers` ### -INSERT INTO `0_shippers` VALUES ('1', 'UPS', '', '', ''); -INSERT INTO `0_shippers` VALUES ('2', 'Internet', '', '', ''); +INSERT INTO `0_shippers` VALUES ('1', 'UPS', '', '', '', '0'); +INSERT INTO `0_shippers` VALUES ('2', 'Internet', '', '', '', '0'); + + +### Structure of table `0_sql_trail` ### + +DROP TABLE IF EXISTS `0_sql_trail`; + +CREATE TABLE `0_sql_trail` ( + `id` int(11) unsigned NOT NULL auto_increment, + `sql` text NOT NULL, + `result` tinyint(1) NOT NULL, + `msg` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) TYPE=MyISAM AUTO_INCREMENT=1 ; + + +### Data of table `0_sql_trail` ### + + + +### Structure of table `0_stock_category` ### + +DROP TABLE IF EXISTS `0_stock_category`; + +CREATE TABLE `0_stock_category` ( + `category_id` int(11) NOT NULL auto_increment, + `description` varchar(60) NOT NULL default '', + `stock_act` varchar(11) default NULL, + `cogs_act` varchar(11) default NULL, + `adj_gl_act` varchar(11) default NULL, + `purch_price_var_act` varchar(11) default NULL, + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`category_id`), + UNIQUE KEY `description` (`description`) +) TYPE=MyISAM AUTO_INCREMENT=5 AUTO_INCREMENT=5 ; + ### Data of table `0_stock_category` ### -INSERT INTO `0_stock_category` VALUES ('1', 'Components', NULL, NULL, NULL, NULL); -INSERT INTO `0_stock_category` VALUES ('2', 'Charges', NULL, NULL, NULL, NULL); -INSERT INTO `0_stock_category` VALUES ('3', 'Systems', NULL, NULL, NULL, NULL); -INSERT INTO `0_stock_category` VALUES ('4', 'Services', NULL, NULL, NULL, NULL); +INSERT INTO `0_stock_category` VALUES ('1', 'Components', '', '', '', '', '0'); +INSERT INTO `0_stock_category` VALUES ('2', 'Charges', '', '', '', '', '0'); +INSERT INTO `0_stock_category` VALUES ('3', 'Systems', '', '', '', '', '0'); +INSERT INTO `0_stock_category` VALUES ('4', 'Services', '', '', '', '', '0'); + + +### Structure of table `0_stock_master` ### + +DROP TABLE IF EXISTS `0_stock_master`; + +CREATE TABLE `0_stock_master` ( + `stock_id` varchar(20) NOT NULL default '', + `category_id` int(11) NOT NULL default '0', + `tax_type_id` int(11) NOT NULL default '0', + `description` varchar(200) NOT NULL default '', + `long_description` tinytext NOT NULL, + `units` varchar(20) NOT NULL default 'each', + `mb_flag` char(1) NOT NULL default 'B', + `sales_account` varchar(11) NOT NULL default '', + `cogs_account` varchar(11) NOT NULL default '', + `inventory_account` varchar(11) NOT NULL default '', + `adjustment_account` varchar(11) NOT NULL default '', + `assembly_account` varchar(11) NOT NULL default '', + `dimension_id` int(11) default NULL, + `dimension2_id` int(11) default NULL, + `actual_cost` double NOT NULL default '0', + `last_cost` double NOT NULL default '0', + `material_cost` double NOT NULL default '0', + `labour_cost` double NOT NULL default '0', + `overhead_cost` double NOT NULL default '0', + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`stock_id`) +) TYPE=InnoDB ; + ### Data of table `0_stock_master` ### -INSERT INTO `0_stock_master` VALUES ('102', '1', '1', '17 inch VGA Monitor', '', 'each', 'B', '3000', '4010', '1420', '4210', '0', NULL, NULL, '0', '0', '-3.4114285714283', '0', '0'); -INSERT INTO `0_stock_master` VALUES ('103', '1', '1', '32MB VGA Card', '', 'each', 'B', '3000', '4010', '1420', '4210', '0', NULL, NULL, '0', '0', '20', '0', '0'); -INSERT INTO `0_stock_master` VALUES ('104', '1', '1', '52x CD Drive', '', 'each', 'B', '3000', '4010', '1420', '4210', '0', NULL, NULL, '0', '0', '18', '0', '0'); -INSERT INTO `0_stock_master` VALUES ('201', '2', '1', 'Assembly Labour', '', 'each', 'D', '3000', '4010', '1420', '4210', '0', NULL, NULL, '0', '0', '0', '0', '0'); -INSERT INTO `0_stock_master` VALUES ('202', '1', '2', 'Electric stimulator', '', 'ea.', 'B', '3000', '4010', '1420', '4210', '1410', '0', '0', '0', '0', '30', '0', '0'); -INSERT INTO `0_stock_master` VALUES ('3400', '3', '1', 'P4 Business System', '', 'each', 'M', '3000', '4010', '1420', '4210', '1400', NULL, NULL, '0', '160', '100', '30', '10'); -INSERT INTO `0_stock_master` VALUES ('AA101', '1', '1', 'olie 5w40', 'Shell Helix 5w40', 'l', 'B', '3000', '4010', '1420', '4210', '1410', '0', '0', '0', '0', '5.0599509174312', '0', '0'); +INSERT INTO `0_stock_master` VALUES ('102', '1', '1', '17 inch VGA Monitor', '', 'each', 'B', '3000', '4010', '1420', '4210', '0', '0', '0', '0', '-3.4114285714283', '10', '0', '0', '0'); +INSERT INTO `0_stock_master` VALUES ('103', '1', '1', '32MB VGA Card', '', 'each', 'B', '3000', '4010', '1420', '4210', '0', '0', '0', '0', '0', '20', '0', '0', '0'); +INSERT INTO `0_stock_master` VALUES ('104', '1', '1', '52x CD Drive', '', 'each', 'B', '3000', '4010', '1420', '4210', '0', '0', '0', '0', '0', '18', '0', '0', '0'); +INSERT INTO `0_stock_master` VALUES ('201', '2', '1', 'Assembly Labour', '', 'each', 'D', '3000', '4010', '1420', '4210', '0', '0', '0', '0', '0', '0', '0', '0', '0'); +INSERT INTO `0_stock_master` VALUES ('202', '1', '2', 'Electric stimulator', '', 'each', 'B', '3000', '4010', '1420', '4210', '1410', '0', '0', '0', '0', '30', '0', '0', '0'); +INSERT INTO `0_stock_master` VALUES ('3400', '3', '1', 'P4 Business System', '', 'each', 'M', '3000', '4010', '1420', '4210', '1400', '0', '0', '0', '160', '100', '30', '10', '0'); +INSERT INTO `0_stock_master` VALUES ('AA101', '1', '1', 'olie 5w40', 'Shell Helix 5w40', 'l', 'B', '3000', '4010', '1420', '4210', '1410', '0', '0', '0', '0', '5.0599509174312', '0', '0', '0'); + + +### Structure of table `0_stock_moves` ### + +DROP TABLE IF EXISTS `0_stock_moves`; + +CREATE TABLE `0_stock_moves` ( + `trans_id` int(11) NOT NULL auto_increment, + `trans_no` int(11) NOT NULL default '0', + `stock_id` char(20) NOT NULL default '', + `type` smallint(6) NOT NULL default '0', + `loc_code` char(5) NOT NULL default '', + `tran_date` date NOT NULL default '0000-00-00', + `person_id` int(11) default NULL, + `price` double NOT NULL default '0', + `reference` char(40) NOT NULL default '', + `qty` double NOT NULL default '1', + `discount_percent` double NOT NULL default '0', + `standard_cost` double NOT NULL default '0', + `visible` tinyint(1) NOT NULL default '1', + PRIMARY KEY (`trans_id`), + KEY `type` (`type`,`trans_no`) +) TYPE=InnoDB AUTO_INCREMENT=43 AUTO_INCREMENT=43 ; + ### Data of table `0_stock_moves` ### @@ -1824,119 +1914,466 @@ INSERT INTO `0_stock_moves` VALUES ('38', '12', '102', '25', 'DEF', '2008-03-28' INSERT INTO `0_stock_moves` VALUES ('39', '18', 'AA101', '13', 'DEF', '2008-03-17', '0', '125', '7', '-1', '0', '5.0599509174312', '1'); INSERT INTO `0_stock_moves` VALUES ('40', '19', '102', '13', 'CWA', '2008-03-29', '0', '0', 'auto', '-1', '0', '-3.4114285714283', '1'); INSERT INTO `0_stock_moves` VALUES ('41', '20', '102', '13', 'DEF', '2008-03-29', '0', '125', '8', '-1', '0', '-3.4114285714283', '1'); +INSERT INTO `0_stock_moves` VALUES ('42', '13', '102', '25', 'CWA', '2009-01-10', '1', '10', '', '1', '0', '10', '1'); + + +### Structure of table `0_supp_allocations` ### + +DROP TABLE IF EXISTS `0_supp_allocations`; + +CREATE TABLE `0_supp_allocations` ( + `id` int(11) NOT NULL auto_increment, + `amt` double unsigned default NULL, + `date_alloc` date NOT NULL default '0000-00-00', + `trans_no_from` int(11) default NULL, + `trans_type_from` int(11) default NULL, + `trans_no_to` int(11) default NULL, + `trans_type_to` int(11) default NULL, + PRIMARY KEY (`id`) +) TYPE=InnoDB AUTO_INCREMENT=11 AUTO_INCREMENT=11 ; + ### Data of table `0_supp_allocations` ### -INSERT INTO `0_supp_allocations` VALUES ('7', '1529', '2007-01-30', '2', '22', '4', '20'); -INSERT INTO `0_supp_allocations` VALUES ('8', '3445', '2007-01-30', '2', '22', '2', '20'); -INSERT INTO `0_supp_allocations` VALUES ('9', '26', '2007-01-30', '2', '22', '3', '20'); +INSERT INTO `0_supp_allocations` VALUES ('10', '200', '2009-01-10', '4', '22', '7', '20'); + + +### Structure of table `0_supp_invoice_items` ### + +DROP TABLE IF EXISTS `0_supp_invoice_items`; + +CREATE TABLE `0_supp_invoice_items` ( + `id` int(11) NOT NULL auto_increment, + `supp_trans_no` int(11) default NULL, + `supp_trans_type` int(11) default NULL, + `gl_code` varchar(11) NOT NULL default '0', + `grn_item_id` int(11) default NULL, + `po_detail_item_id` int(11) default NULL, + `stock_id` varchar(20) NOT NULL default '', + `description` tinytext, + `quantity` double NOT NULL default '0', + `unit_price` double NOT NULL default '0', + `unit_tax` double NOT NULL default '0', + `memo_` tinytext, + PRIMARY KEY (`id`) +) TYPE=InnoDB AUTO_INCREMENT=26 AUTO_INCREMENT=26 ; + ### Data of table `0_supp_invoice_items` ### -INSERT INTO `0_supp_invoice_items` VALUES ('1', '2', '20', '0', '1', '1', '102', '17 inch VGA Monitor', '5', '3020', '0', NULL); -INSERT INTO `0_supp_invoice_items` VALUES ('2', '2', '20', '0', '2', '2', '103', '32MB VGA Card', '25', '90', '0', NULL); -INSERT INTO `0_supp_invoice_items` VALUES ('3', '3', '20', '0', '3', '3', '104', '52x CD Drive', '1', '26', '0', NULL); -INSERT INTO `0_supp_invoice_items` VALUES ('4', '4', '20', '0', '1', '1', '102', '17 inch VGA Monitor', '5', '3020', '0', NULL); -INSERT INTO `0_supp_invoice_items` VALUES ('5', '4', '20', '0', '2', '2', '103', '32MB VGA Card', '25', '90', '0', NULL); -INSERT INTO `0_supp_invoice_items` VALUES ('6', '5', '20', '0', '4', '6', '104', '52x CD Drive (upgraded)', '302', '22', '0', NULL); -INSERT INTO `0_supp_invoice_items` VALUES ('7', '6', '20', '6730', '0', '0', '', NULL, '0', '200', '0', 'yes'); -INSERT INTO `0_supp_invoice_items` VALUES ('8', '7', '20', '0', '5', '7', '102', '17 inch VGA Monitor', '10', '25', '0', NULL); -INSERT INTO `0_supp_invoice_items` VALUES ('9', '7', '20', '0', '6', '8', '103', '32MB VGA Card', '10', '30', '0', NULL); -INSERT INTO `0_supp_invoice_items` VALUES ('12', '8', '20', '0', '11', '13', '102', '17 inch VGA Monitor', '5', '0', '0', NULL); -INSERT INTO `0_supp_invoice_items` VALUES ('13', '9', '20', '0', '12', '14', '102', '17 inch VGA Monitor', '1', '10', '0', NULL); -INSERT INTO `0_supp_invoice_items` VALUES ('20', '10', '20', '0', '9', '12', 'AA101', 'olie 5w40', '8', '3.25', '0', NULL); -INSERT INTO `0_supp_invoice_items` VALUES ('21', '11', '20', '0', '10', '12', 'AA101', 'olie 5w40', '408', '3.25', '0.81', NULL); - -### Data of table `0_supp_invoice_tax_items` ### - -INSERT INTO `0_supp_invoice_tax_items` VALUES ('1', '2', '20', '1', NULL, '5', '0', '162.5'); -INSERT INTO `0_supp_invoice_tax_items` VALUES ('2', '2', '20', '2', NULL, '1', '0', '32.5'); -INSERT INTO `0_supp_invoice_tax_items` VALUES ('3', '10', '20', '3', NULL, '25', '0', '5.2'); -INSERT INTO `0_supp_invoice_tax_items` VALUES ('4', '11', '20', '3', NULL, '25', '0', '331.5'); +INSERT INTO `0_supp_invoice_items` VALUES ('4', '4', '20', '0', '1', '1', '102', '17 inch VGA Monitor', '5', '3020', '0', ''); +INSERT INTO `0_supp_invoice_items` VALUES ('5', '4', '20', '0', '2', '2', '103', '32MB VGA Card', '25', '90', '0', ''); +INSERT INTO `0_supp_invoice_items` VALUES ('8', '7', '20', '0', '5', '7', '102', '17 inch VGA Monitor', '10', '25', '0', ''); +INSERT INTO `0_supp_invoice_items` VALUES ('9', '7', '20', '0', '6', '8', '103', '32MB VGA Card', '10', '30', '0', ''); +INSERT INTO `0_supp_invoice_items` VALUES ('12', '8', '20', '0', '11', '13', '102', '17 inch VGA Monitor', '5', '0', '0', ''); +INSERT INTO `0_supp_invoice_items` VALUES ('13', '9', '20', '0', '12', '14', '102', '17 inch VGA Monitor', '1', '10', '0', ''); +INSERT INTO `0_supp_invoice_items` VALUES ('20', '10', '20', '0', '9', '12', 'AA101', 'olie 5w40', '8', '3.25', '0', ''); +INSERT INTO `0_supp_invoice_items` VALUES ('21', '11', '20', '0', '10', '12', 'AA101', 'olie 5w40', '408', '3.25', '0.81', ''); +INSERT INTO `0_supp_invoice_items` VALUES ('22', '12', '20', '0', '7', '9', '104', '52x CD Drive', '10', '20', '5', ''); +INSERT INTO `0_supp_invoice_items` VALUES ('23', '12', '20', '0', '8', '10', '202', 'Electric stimulator', '10', '50', '2.5', ''); +INSERT INTO `0_supp_invoice_items` VALUES ('24', '13', '20', '2682', '0', '0', '', '', '0', '10', '0', 'Phone'); +INSERT INTO `0_supp_invoice_items` VALUES ('25', '13', '20', '6730', '0', '0', '', '', '0', '40', '0', 'Phone'); + + +### Structure of table `0_supp_trans` ### + +DROP TABLE IF EXISTS `0_supp_trans`; + +CREATE TABLE `0_supp_trans` ( + `trans_no` int(11) unsigned NOT NULL default '0', + `type` smallint(6) unsigned NOT NULL default '0', + `supplier_id` int(11) unsigned default NULL, + `reference` tinytext NOT NULL, + `supp_reference` varchar(60) NOT NULL default '', + `tran_date` date NOT NULL default '0000-00-00', + `due_date` date NOT NULL default '0000-00-00', + `ov_amount` double NOT NULL default '0', + `ov_discount` double NOT NULL default '0', + `ov_gst` double NOT NULL default '0', + `rate` double NOT NULL default '1', + `alloc` double NOT NULL default '0', + PRIMARY KEY (`trans_no`,`type`), + KEY `supplier_id` (`supplier_id`), + KEY `SupplierID_2` (`supplier_id`,`supp_reference`), + KEY `type` (`type`) +) TYPE=InnoDB ; + ### Data of table `0_supp_trans` ### -INSERT INTO `0_supp_trans` VALUES ('2', '20', '1', '22', '22', '2006-01-18', '2006-02-22', '3250', '0', '195', '1', '3445'); -INSERT INTO `0_supp_trans` VALUES ('2', '22', '1', '1', '', '2006-01-18', '2006-01-18', '-5000', '0', '0', '1', '5000'); -INSERT INTO `0_supp_trans` VALUES ('3', '20', '1', '23', 'asdf', '2006-01-18', '2006-02-22', '26', '0', '0', '1', '26'); -INSERT INTO `0_supp_trans` VALUES ('3', '22', '2', '2', '', '2006-01-18', '2006-01-18', '-3300', '0', '0', '1.2', '0'); -INSERT INTO `0_supp_trans` VALUES ('4', '20', '1', '24', 'Himself', '2007-01-30', '2007-02-22', '17350', '0', '0', '1', '1529'); -INSERT INTO `0_supp_trans` VALUES ('5', '20', '1', '25', '6789', '2007-02-03', '2007-03-22', '6644', '0', '0', '1', '0'); -INSERT INTO `0_supp_trans` VALUES ('6', '1', '1', '5', '', '2007-03-22', '0000-00-00', '-200', '0', '0', '1', '0'); -INSERT INTO `0_supp_trans` VALUES ('6', '20', '3', '26', '333333', '2007-03-05', '2007-03-12', '200', '0', '0', '0.2', '0'); -INSERT INTO `0_supp_trans` VALUES ('7', '20', '1', '27', 'eee', '2008-03-06', '2008-04-17', '550', '0', '0', '1', '0'); +INSERT INTO `0_supp_trans` VALUES ('4', '22', '1', '3', '', '2009-01-10', '2009-01-10', '-200', '0', '0', '1', '200'); +INSERT INTO `0_supp_trans` VALUES ('7', '20', '1', '27', 'eee', '2008-03-06', '2008-04-17', '550', '0', '0', '1', '200'); INSERT INTO `0_supp_trans` VALUES ('8', '20', '2', '28', '213', '2008-03-20', '2008-04-17', '0', '0', '0', '1.2', '0'); INSERT INTO `0_supp_trans` VALUES ('9', '20', '2', '29', 'aaa', '2008-03-25', '2008-04-17', '10', '0', '0', '1.9816266221251', '0'); INSERT INTO `0_supp_trans` VALUES ('10', '20', '4', '30', '12w', '2008-03-25', '2008-04-17', '20.8', '0', '5.2', '1.5569', '0'); INSERT INTO `0_supp_trans` VALUES ('11', '20', '4', '31', 'jan', '2008-03-28', '2008-04-17', '1326', '0', '331.5', '1.5796', '0'); +INSERT INTO `0_supp_trans` VALUES ('12', '20', '1', '32', 'ga', '2009-01-10', '2009-02-17', '700', '0', '75', '1', '0'); +INSERT INTO `0_supp_trans` VALUES ('13', '20', '1', '33', 'gg', '2009-01-29', '2009-02-17', '50', '0', '0', '1', '0'); + + +### Structure of table `0_suppliers` ### + +DROP TABLE IF EXISTS `0_suppliers`; + +CREATE TABLE `0_suppliers` ( + `supplier_id` int(11) NOT NULL auto_increment, + `supp_name` varchar(60) NOT NULL default '', + `address` tinytext NOT NULL, + `supp_address` tinytext NOT NULL, + `phone` varchar(30) NOT NULL default '', + `fax` varchar(30) NOT NULL default '', + `gst_no` varchar(25) NOT NULL default '', + `contact` varchar(60) NOT NULL default '', + `supp_account_no` varchar(40) NOT NULL default '', + `email` varchar(100) NOT NULL default '', + `website` varchar(100) NOT NULL default '', + `bank_account` varchar(60) NOT NULL default '', + `curr_code` char(3) default NULL, + `payment_terms` int(11) default NULL, + `dimension_id` int(11) default '0', + `dimension2_id` int(11) default '0', + `tax_group_id` int(11) default NULL, + `credit_limit` double NOT NULL default '0', + `purchase_account` varchar(11) default NULL, + `payable_account` varchar(11) default NULL, + `payment_discount_account` varchar(11) default NULL, + `notes` tinytext NOT NULL, + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`supplier_id`) +) TYPE=MyISAM AUTO_INCREMENT=5 AUTO_INCREMENT=5 ; + ### Data of table `0_suppliers` ### -INSERT INTO `0_suppliers` VALUES ('1', 'Ghostbusters Corp.', '', '', '123456789', 'USD', '1', '0', '0', '1', '4000', '2630', '4250'); -INSERT INTO `0_suppliers` VALUES ('2', 'Beefeater Ltd.', '', '', '987654321', 'GBP', '1', '0', '0', '2', '4000', '2630', '4250'); -INSERT INTO `0_suppliers` VALUES ('3', 'Super Trooper AB', 'Adress', 'sven@sven.sve', '123456', 'SEK', '3', '0', '0', '2', '4000', '2630', '4250'); -INSERT INTO `0_suppliers` VALUES ('4', 'Brezan', 'N/A', 'info@brezan.tv', '', 'EUR', '1', '0', '0', '1', '4010', '2630', '4250'); +INSERT INTO `0_suppliers` VALUES ('1', 'Ghostbusters Corp.', '', '', '', '', '', '', '', '', '', '123456789', 'USD', '1', '0', '0', '1', '0', '4000', '2630', '4250', '', '0'); +INSERT INTO `0_suppliers` VALUES ('2', 'Beefeater Ltd.', '', '', '', '', '', '', '', '', '', '987654321', 'GBP', '1', '0', '0', '2', '0', '4000', '2630', '4250', '', '0'); +INSERT INTO `0_suppliers` VALUES ('3', 'Super Trooper AB', 'Adress', '', '', '', '', '', '', 'sven@sven.sve', '', '123456', 'SEK', '3', '0', '0', '2', '0', '4000', '2630', '4250', '', '0'); +INSERT INTO `0_suppliers` VALUES ('4', 'Brezan', 'N/A', '', '', '', '', '', '', 'info@brezan.tv', '', '', 'EUR', '1', '0', '0', '1', '0', '4010', '2630', '4250', '', '0'); + + +### Structure of table `0_sys_types` ### + +DROP TABLE IF EXISTS `0_sys_types`; + +CREATE TABLE `0_sys_types` ( + `type_id` smallint(6) NOT NULL default '0', + `type_name` varchar(60) NOT NULL default '', + `type_no` int(11) NOT NULL default '1', + `next_reference` varchar(100) NOT NULL default '', + PRIMARY KEY (`type_id`) +) TYPE=InnoDB ; + ### Data of table `0_sys_types` ### INSERT INTO `0_sys_types` VALUES ('0', 'Journal - GL', '18', '34'); -INSERT INTO `0_sys_types` VALUES ('1', 'Payment - GL', '7', '7'); -INSERT INTO `0_sys_types` VALUES ('2', 'Receipt - GL', '4', '14'); +INSERT INTO `0_sys_types` VALUES ('1', 'Payment - GL', '8', '8'); +INSERT INTO `0_sys_types` VALUES ('2', 'Receipt - GL', '6', '16'); INSERT INTO `0_sys_types` VALUES ('4', 'Funds Transfer', '3', '6'); -INSERT INTO `0_sys_types` VALUES ('10', 'Sales Invoice', '19', '19'); +INSERT INTO `0_sys_types` VALUES ('10', 'Sales Invoice', '25', '25'); INSERT INTO `0_sys_types` VALUES ('11', 'Credit Note', '4', '4'); -INSERT INTO `0_sys_types` VALUES ('12', 'Receipt', '9', '9'); -INSERT INTO `0_sys_types` VALUES ('13', 'Delivery', '20', '9'); +INSERT INTO `0_sys_types` VALUES ('12', 'Receipt', '11', '11'); +INSERT INTO `0_sys_types` VALUES ('13', 'Delivery', '27', '10'); INSERT INTO `0_sys_types` VALUES ('16', 'Location Transfer', '2', '2'); INSERT INTO `0_sys_types` VALUES ('17', 'Inventory Adjustment', '2', '2'); -INSERT INTO `0_sys_types` VALUES ('18', 'Purchase Order', '1', '15'); -INSERT INTO `0_sys_types` VALUES ('20', 'Supplier Invoice', '11', '32'); +INSERT INTO `0_sys_types` VALUES ('18', 'Purchase Order', '1', '16'); +INSERT INTO `0_sys_types` VALUES ('20', 'Supplier Invoice', '13', '34'); INSERT INTO `0_sys_types` VALUES ('21', 'Supplier Credit Note', '1', '2'); -INSERT INTO `0_sys_types` VALUES ('22', 'Supplier Payment', '3', '3'); -INSERT INTO `0_sys_types` VALUES ('25', 'Purchase Order Delivery', '1', '13'); +INSERT INTO `0_sys_types` VALUES ('22', 'Supplier Payment', '4', '4'); +INSERT INTO `0_sys_types` VALUES ('25', 'Purchase Order Delivery', '1', '14'); INSERT INTO `0_sys_types` VALUES ('26', 'Work Order', '1', '8'); INSERT INTO `0_sys_types` VALUES ('28', 'Work Order Issue', '1', '2'); INSERT INTO `0_sys_types` VALUES ('29', 'Work Order Production', '1', '201'); INSERT INTO `0_sys_types` VALUES ('30', 'Sales Order', '1', '1'); -INSERT INTO `0_sys_types` VALUES ('35', 'Cost Update', '5', '1'); +INSERT INTO `0_sys_types` VALUES ('35', 'Cost Update', '6', '1'); INSERT INTO `0_sys_types` VALUES ('40', 'Dimension', '1', '3'); + +### Structure of table `0_tax_group_items` ### + +DROP TABLE IF EXISTS `0_tax_group_items`; + +CREATE TABLE `0_tax_group_items` ( + `tax_group_id` int(11) NOT NULL default '0', + `tax_type_id` int(11) NOT NULL default '0', + `rate` double NOT NULL default '0', + `included_in_price` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`tax_group_id`,`tax_type_id`) +) TYPE=InnoDB ; + + ### Data of table `0_tax_group_items` ### INSERT INTO `0_tax_group_items` VALUES ('1', '1', '5', '0'); INSERT INTO `0_tax_group_items` VALUES ('1', '3', '25', '0'); INSERT INTO `0_tax_group_items` VALUES ('4', '3', '25', '0'); +INSERT INTO `0_tax_group_items` VALUES ('5', '4', '0', '0'); + + +### Structure of table `0_tax_groups` ### + +DROP TABLE IF EXISTS `0_tax_groups`; + +CREATE TABLE `0_tax_groups` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(60) NOT NULL default '', + `tax_shipping` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) TYPE=InnoDB AUTO_INCREMENT=6 AUTO_INCREMENT=6 ; + ### Data of table `0_tax_groups` ### INSERT INTO `0_tax_groups` VALUES ('1', 'VAT', '0'); INSERT INTO `0_tax_groups` VALUES ('2', 'Tax-Free', '0'); INSERT INTO `0_tax_groups` VALUES ('4', 'Shipping', '1'); +INSERT INTO `0_tax_groups` VALUES ('5', 'Export', '0'); + + +### Structure of table `0_tax_types` ### + +DROP TABLE IF EXISTS `0_tax_types`; + +CREATE TABLE `0_tax_types` ( + `id` int(11) NOT NULL auto_increment, + `rate` double NOT NULL default '0', + `sales_gl_code` varchar(11) NOT NULL default '', + `purchasing_gl_code` varchar(11) NOT NULL default '', + `name` varchar(60) NOT NULL default '', + PRIMARY KEY (`id`) +) TYPE=InnoDB AUTO_INCREMENT=5 AUTO_INCREMENT=5 ; + ### Data of table `0_tax_types` ### -INSERT INTO `0_tax_types` VALUES ('1', '5', '2660', '2680', 'VAT', '1'); -INSERT INTO `0_tax_types` VALUES ('2', '1', '2662', '2680', 'Manufact tax 1', '1'); -INSERT INTO `0_tax_types` VALUES ('3', '25', '2664', '2682', 'VAT', '1'); +INSERT INTO `0_tax_types` VALUES ('1', '5', '2660', '2680', 'VAT'); +INSERT INTO `0_tax_types` VALUES ('2', '1', '2662', '2680', 'Manufact tax 1'); +INSERT INTO `0_tax_types` VALUES ('3', '25', '2664', '2682', 'VAT'); +INSERT INTO `0_tax_types` VALUES ('4', '0', '2660', '2680', 'Export'); + + +### Structure of table `0_trans_tax_details` ### + +DROP TABLE IF EXISTS `0_trans_tax_details`; + +CREATE TABLE `0_trans_tax_details` ( + `id` int(11) NOT NULL auto_increment, + `trans_type` smallint(6) default NULL, + `trans_no` int(11) default NULL, + `tran_date` date NOT NULL, + `tax_type_id` int(11) NOT NULL default '0', + `rate` double NOT NULL default '0', + `ex_rate` double NOT NULL default '1', + `included_in_price` tinyint(1) NOT NULL default '0', + `net_amount` double NOT NULL default '0', + `amount` double NOT NULL default '0', + `memo` tinytext, + PRIMARY KEY (`id`) +) TYPE=InnoDB AUTO_INCREMENT=60 AUTO_INCREMENT=60 ; + + +### Data of table `0_trans_tax_details` ### + +INSERT INTO `0_trans_tax_details` VALUES ('1', '13', '1', '2008-03-06', '3', '25', '1', '1', '81', '27', '0'); +INSERT INTO `0_trans_tax_details` VALUES ('2', '10', '1', '2008-03-06', '3', '25', '1', '1', '81', '27', '0'); +INSERT INTO `0_trans_tax_details` VALUES ('3', '13', '2', '2008-03-06', '3', '25', '1', '1', '81', '27', 'auto'); +INSERT INTO `0_trans_tax_details` VALUES ('4', '10', '2', '2008-03-06', '3', '25', '1', '1', '81', '27', '1'); +INSERT INTO `0_trans_tax_details` VALUES ('5', '13', '3', '2008-03-06', '3', '25', '1', '1', '81', '27', 'auto'); +INSERT INTO `0_trans_tax_details` VALUES ('6', '10', '3', '2008-03-06', '3', '25', '1', '1', '81', '27', '2'); +INSERT INTO `0_trans_tax_details` VALUES ('7', '13', '4', '2008-03-06', '3', '25', '1', '1', '81', '27', 'auto'); +INSERT INTO `0_trans_tax_details` VALUES ('8', '10', '4', '2008-03-06', '3', '25', '1', '1', '81', '27', '3'); +INSERT INTO `0_trans_tax_details` VALUES ('9', '13', '5', '2008-03-06', '3', '25', '1', '1', '81', '27', 'auto'); +INSERT INTO `0_trans_tax_details` VALUES ('10', '10', '5', '2008-03-06', '3', '25', '1', '1', '81', '27', '4'); +INSERT INTO `0_trans_tax_details` VALUES ('11', '11', '1', '2008-03-06', '3', '25', '1', '1', '81', '27', '0'); +INSERT INTO `0_trans_tax_details` VALUES ('12', '13', '6', '2008-03-06', '3', '25', '1', '1', '81', '27', 'auto'); +INSERT INTO `0_trans_tax_details` VALUES ('13', '10', '6', '2008-03-06', '3', '25', '1', '1', '81', '27', '5'); +INSERT INTO `0_trans_tax_details` VALUES ('14', '13', '7', '2008-03-06', '3', '25', '1', '1', '81', '27', '1'); +INSERT INTO `0_trans_tax_details` VALUES ('15', '11', '2', '2008-03-06', '3', '25', '1', '1', '81', '27', '1'); +INSERT INTO `0_trans_tax_details` VALUES ('16', '11', '3', '2008-03-06', '3', '25', '1', '1', '81', '27', '2'); +INSERT INTO `0_trans_tax_details` VALUES ('17', '11', '4', '2008-03-07', '3', '25', '1', '0', '100', '25', '3'); +INSERT INTO `0_trans_tax_details` VALUES ('18', '13', '8', '2008-03-07', '3', '25', '1', '1', '81', '27', '2'); +INSERT INTO `0_trans_tax_details` VALUES ('19', '13', '9', '2008-03-08', '3', '25', '1', '1', '81', '27', 'auto'); +INSERT INTO `0_trans_tax_details` VALUES ('20', '10', '7', '2008-03-08', '3', '25', '1', '1', '81', '27', '6'); +INSERT INTO `0_trans_tax_details` VALUES ('21', '13', '10', '2008-03-09', '3', '25', '1', '1', '82.5', '27.5', 'auto'); +INSERT INTO `0_trans_tax_details` VALUES ('22', '10', '8', '2008-03-09', '3', '25', '1', '1', '82.5', '27.5', '7'); +INSERT INTO `0_trans_tax_details` VALUES ('23', '13', '11', '2008-03-09', '3', '25', '1', '0', '110', '27.5', 'auto'); +INSERT INTO `0_trans_tax_details` VALUES ('24', '10', '9', '2008-03-09', '3', '25', '1', '0', '110', '27.5', '8'); +INSERT INTO `0_trans_tax_details` VALUES ('25', '13', '12', '2008-03-09', '3', '25', '1', '1', '81', '27', 'auto'); +INSERT INTO `0_trans_tax_details` VALUES ('26', '10', '10', '2008-03-09', '3', '25', '1', '1', '81', '27', '9'); +INSERT INTO `0_trans_tax_details` VALUES ('27', '13', '13', '2008-03-10', '3', '25', '1', '1', '24', '8', '3'); +INSERT INTO `0_trans_tax_details` VALUES ('28', '13', '14', '2008-03-10', '3', '25', '1', '0', '100', '25', '4'); +INSERT INTO `0_trans_tax_details` VALUES ('29', '10', '11', '2008-03-10', '3', '25', '1', '0', '100', '25', '10'); +INSERT INTO `0_trans_tax_details` VALUES ('30', '13', '15', '2008-03-10', '3', '25', '1', '0', '100', '25', '5'); +INSERT INTO `0_trans_tax_details` VALUES ('31', '10', '12', '2008-03-10', '3', '25', '1', '0', '100', '25', '11'); +INSERT INTO `0_trans_tax_details` VALUES ('32', '10', '13', '2008-03-07', '3', '25', '1', '1', '81', '27', '12'); +INSERT INTO `0_trans_tax_details` VALUES ('33', '13', '17', '2008-03-10', '3', '25', '1', '1', '81', '27', 'auto'); +INSERT INTO `0_trans_tax_details` VALUES ('34', '10', '14', '2008-03-10', '3', '25', '1', '1', '81', '27', '13'); +INSERT INTO `0_trans_tax_details` VALUES ('35', '10', '15', '2008-03-10', '3', '25', '1', '1', '24', '8', '14'); +INSERT INTO `0_trans_tax_details` VALUES ('36', '13', '18', '2008-03-17', '3', '25', '1', '1', '81', '27', '7'); +INSERT INTO `0_trans_tax_details` VALUES ('37', '10', '16', '2008-03-17', '3', '25', '1', '1', '81', '27', '15'); +INSERT INTO `0_trans_tax_details` VALUES ('38', '13', '20', '2008-03-29', '3', '25', '1', '1', '75', '25', '8'); +INSERT INTO `0_trans_tax_details` VALUES ('39', '10', '19', '2008-03-29', '3', '25', '1', '1', '75', '25', '18'); +INSERT INTO `0_trans_tax_details` VALUES ('40', '13', '21', '2009-01-10', '3', '25', '1', '0', '30', '7.5', 'auto'); +INSERT INTO `0_trans_tax_details` VALUES ('41', '10', '20', '2009-01-10', '3', '25', '1', '0', '30', '7.5', '19'); +INSERT INTO `0_trans_tax_details` VALUES ('42', '20', '10', '2008-03-25', '3', '25', '1.5569', '0', '20.8', '5.2', '12w'); +INSERT INTO `0_trans_tax_details` VALUES ('43', '20', '11', '2008-03-28', '3', '25', '1.5796', '0', '1326', '331.5', 'jan'); +INSERT INTO `0_trans_tax_details` VALUES ('44', '20', '12', '2009-01-10', '1', '5', '1', '0', '500', '25', 'ga'); +INSERT INTO `0_trans_tax_details` VALUES ('45', '20', '12', '2009-01-10', '3', '25', '1', '0', '200', '50', 'ga'); +INSERT INTO `0_trans_tax_details` VALUES ('46', '13', '22', '0000-00-00', '3', '25', '1.7164140368342e-005', '1', '80', '20', ''); +INSERT INTO `0_trans_tax_details` VALUES ('47', '10', '21', '0000-00-00', '3', '25', '1.7164140368342e-005', '1', '80', '20', ''); +INSERT INTO `0_trans_tax_details` VALUES ('48', '13', '23', '0000-00-00', '3', '25', '1.7164140368342e-005', '1', '80', '20', ''); +INSERT INTO `0_trans_tax_details` VALUES ('49', '10', '22', '2009-01-29', '3', '25', '0.17593462333271', '1', '80', '20', '21'); +INSERT INTO `0_trans_tax_details` VALUES ('50', '13', '24', '2009-01-29', '3', '25', '1', '1', '80', '20', 'auto'); +INSERT INTO `0_trans_tax_details` VALUES ('51', '10', '23', '2009-01-29', '3', '25', '0.17593462333271', '1', '80', '20', '22'); +INSERT INTO `0_trans_tax_details` VALUES ('52', '13', '25', '2009-01-29', '3', '25', '0.17593462333271', '1', '80', '20', 'auto'); +INSERT INTO `0_trans_tax_details` VALUES ('53', '10', '24', '2009-01-29', '3', '25', '0.17593462333271', '1', '80', '20', '23'); +INSERT INTO `0_trans_tax_details` VALUES ('54', '13', '26', '2009-01-29', '4', '0', '0.17593462333271', '1', '100', '0', 'auto'); +INSERT INTO `0_trans_tax_details` VALUES ('55', '10', '25', '2009-01-29', '4', '0', '0.17593462333271', '1', '100', '0', '24'); +INSERT INTO `0_trans_tax_details` VALUES ('56', '2', '5', '2009-01-29', '3', '25', '1', '0', '160', '40', ''); +INSERT INTO `0_trans_tax_details` VALUES ('57', '1', '8', '2009-01-29', '3', '25', '1', '0', '40', '10', ''); +INSERT INTO `0_trans_tax_details` VALUES ('58', '20', '13', '2009-01-29', '3', '25', '1', '0', '40', '10', 'gg'); +INSERT INTO `0_trans_tax_details` VALUES ('59', '2', '6', '2009-01-29', '3', '25', '1', '0', '40', '10', ''); + + +### Structure of table `0_users` ### + +DROP TABLE IF EXISTS `0_users`; + +CREATE TABLE `0_users` ( + `user_id` varchar(60) NOT NULL default '', + `password` varchar(100) NOT NULL default '', + `real_name` varchar(100) NOT NULL default '', + `full_access` int(11) NOT NULL default '1', + `phone` varchar(30) NOT NULL default '', + `email` varchar(100) default NULL, + `language` varchar(20) default NULL, + `date_format` tinyint(1) NOT NULL default '0', + `date_sep` tinyint(1) NOT NULL default '0', + `tho_sep` tinyint(1) NOT NULL default '0', + `dec_sep` tinyint(1) NOT NULL default '0', + `theme` varchar(20) NOT NULL default 'default', + `page_size` varchar(20) NOT NULL default 'A4', + `prices_dec` smallint(6) NOT NULL default '2', + `qty_dec` smallint(6) NOT NULL default '2', + `rates_dec` smallint(6) NOT NULL default '4', + `percent_dec` smallint(6) NOT NULL default '1', + `show_gl` tinyint(1) NOT NULL default '1', + `show_codes` tinyint(1) NOT NULL default '0', + `show_hints` tinyint(1) NOT NULL default '0', + `last_visit_date` datetime default NULL, + `query_size` tinyint(1) default '10', + `graphic_links` tinyint(1) default '1', + `pos` smallint(6) default '1', + `print_profile` varchar(30) NOT NULL default '1', + `rep_popup` tinyint(1) default '1', + PRIMARY KEY (`user_id`) +) TYPE=MyISAM ; + ### Data of table `0_users` ### -INSERT INTO `0_users` VALUES('demouser', '5f4dcc3b5aa765d61d8327deb882cf99', 'Demo User', 1, '999-999-999', 'demo@demo.nu', 'en_US', 0, 0, 0, 0, 'default', 'Letter', 2, 2, 3, 1, 1, 0, 0, '2008-02-06 19:02:35'); -INSERT INTO `0_users` VALUES('admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', 2, '', 'adm@adm.com', 'en_US', 0, 0, 0, 0, 'default', 'Letter', 2, 2, 4, 1, 1, 0, 0, '2008-03-20 10:52:46'); +INSERT INTO `0_users` VALUES ('demouser', '5f4dcc3b5aa765d61d8327deb882cf99', 'Demo User', '1', '999-999-999', 'demo@demo.nu', 'en_US', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '3', '1', '1', '0', '0', '2008-02-06 19:02:35', '10', '1', '1', '1', '1'); +INSERT INTO `0_users` VALUES ('admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', '2', '', 'adm@adm.com', 'en_US', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '4', '1', '1', '0', '0', '2009-01-30 09:39:03', '10', '1', '1', '', '1'); + + +### Structure of table `0_voided` ### + +DROP TABLE IF EXISTS `0_voided`; + +CREATE TABLE `0_voided` ( + `type` int(11) NOT NULL default '0', + `id` int(11) NOT NULL default '0', + `date_` date NOT NULL default '0000-00-00', + `memo_` tinytext NOT NULL, + UNIQUE KEY `id` (`type`,`id`) +) TYPE=InnoDB ; + + +### Data of table `0_voided` ### + +INSERT INTO `0_voided` VALUES ('1', '2', '2009-01-10', ''); +INSERT INTO `0_voided` VALUES ('1', '3', '2009-01-10', ''); +INSERT INTO `0_voided` VALUES ('1', '4', '2009-01-10', ''); +INSERT INTO `0_voided` VALUES ('1', '5', '2009-01-10', ''); +INSERT INTO `0_voided` VALUES ('1', '6', '2009-01-10', ''); + + +### Structure of table `0_wo_issue_items` ### + +DROP TABLE IF EXISTS `0_wo_issue_items`; + +CREATE TABLE `0_wo_issue_items` ( + `id` int(11) NOT NULL auto_increment, + `stock_id` varchar(40) default NULL, + `issue_id` int(11) default NULL, + `qty_issued` double default NULL, + PRIMARY KEY (`id`) +) TYPE=InnoDB AUTO_INCREMENT=2 AUTO_INCREMENT=2 ; + ### Data of table `0_wo_issue_items` ### INSERT INTO `0_wo_issue_items` VALUES ('1', '102', '1', '10'); + +### Structure of table `0_wo_issues` ### + +DROP TABLE IF EXISTS `0_wo_issues`; + +CREATE TABLE `0_wo_issues` ( + `issue_no` int(11) NOT NULL auto_increment, + `workorder_id` int(11) NOT NULL default '0', + `reference` varchar(100) default NULL, + `issue_date` date default NULL, + `loc_code` varchar(5) default NULL, + `workcentre_id` int(11) default NULL, + PRIMARY KEY (`issue_no`) +) TYPE=InnoDB AUTO_INCREMENT=2 AUTO_INCREMENT=2 ; + + ### Data of table `0_wo_issues` ### INSERT INTO `0_wo_issues` VALUES ('1', '3', '1', '2006-01-20', 'DEF', '1'); + +### Structure of table `0_wo_manufacture` ### + +DROP TABLE IF EXISTS `0_wo_manufacture`; + +CREATE TABLE `0_wo_manufacture` ( + `id` int(11) NOT NULL auto_increment, + `reference` varchar(100) default NULL, + `workorder_id` int(11) NOT NULL default '0', + `quantity` double NOT NULL default '0', + `date_` date NOT NULL default '0000-00-00', + PRIMARY KEY (`id`) +) TYPE=InnoDB AUTO_INCREMENT=3 AUTO_INCREMENT=3 ; + + ### Data of table `0_wo_manufacture` ### INSERT INTO `0_wo_manufacture` VALUES ('1', 'ab200', '3', '50', '2007-01-30'); INSERT INTO `0_wo_manufacture` VALUES ('2', 'ab201', '5', '20', '2007-01-30'); + +### Structure of table `0_wo_requirements` ### + +DROP TABLE IF EXISTS `0_wo_requirements`; + +CREATE TABLE `0_wo_requirements` ( + `id` int(11) NOT NULL auto_increment, + `workorder_id` int(11) NOT NULL default '0', + `stock_id` char(20) NOT NULL default '', + `workcentre` int(11) NOT NULL default '0', + `units_req` double NOT NULL default '1', + `std_cost` double NOT NULL default '0', + `loc_code` char(5) NOT NULL default '', + `units_issued` double NOT NULL default '0', + PRIMARY KEY (`id`) +) TYPE=InnoDB AUTO_INCREMENT=29 AUTO_INCREMENT=29 ; + + ### Data of table `0_wo_requirements` ### INSERT INTO `0_wo_requirements` VALUES ('1', '1', '102', '1', '1', '0', 'DEF', '20'); @@ -1968,9 +2405,48 @@ INSERT INTO `0_wo_requirements` VALUES ('26', '7', '103', '1', '1', '0', 'DEF', INSERT INTO `0_wo_requirements` VALUES ('27', '7', '104', '1', '1', '0', 'DEF', '1'); INSERT INTO `0_wo_requirements` VALUES ('28', '7', '201', '1', '1', '0', 'DEF', '1'); + +### Structure of table `0_workcentres` ### + +DROP TABLE IF EXISTS `0_workcentres`; + +CREATE TABLE `0_workcentres` ( + `id` int(11) NOT NULL auto_increment, + `name` char(40) NOT NULL default '', + `description` char(50) NOT NULL default '', + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) TYPE=MyISAM AUTO_INCREMENT=2 AUTO_INCREMENT=2 ; + + ### Data of table `0_workcentres` ### -INSERT INTO `0_workcentres` VALUES ('1', 'work centre', ''); +INSERT INTO `0_workcentres` VALUES ('1', 'work centre', '', '0'); + + +### Structure of table `0_workorders` ### + +DROP TABLE IF EXISTS `0_workorders`; + +CREATE TABLE `0_workorders` ( + `id` int(11) NOT NULL auto_increment, + `wo_ref` varchar(60) NOT NULL default '', + `loc_code` varchar(5) NOT NULL default '', + `units_reqd` double NOT NULL default '1', + `stock_id` varchar(20) NOT NULL default '', + `date_` date NOT NULL default '0000-00-00', + `type` tinyint(4) NOT NULL default '0', + `required_by` date NOT NULL default '0000-00-00', + `released_date` date NOT NULL default '0000-00-00', + `units_issued` double NOT NULL default '0', + `closed` tinyint(1) NOT NULL default '0', + `released` tinyint(1) NOT NULL default '0', + `additional_costs` double NOT NULL default '0', + PRIMARY KEY (`id`), + UNIQUE KEY `wo_ref` (`wo_ref`) +) TYPE=InnoDB AUTO_INCREMENT=8 AUTO_INCREMENT=8 ; + ### Data of table `0_workorders` ### diff --git a/sql/en_US-new.sql b/sql/en_US-new.sql index 9cd561fa..cda5540a 100644 --- a/sql/en_US-new.sql +++ b/sql/en_US-new.sql @@ -1,38 +1,58 @@ --- phpMyAdmin SQL Dump --- version 2.11.4 --- http://www.phpmyadmin.net --- --- Host: localhost --- Generation Time: Apr 04, 2008 at 12:35 PM --- Server version: 5.0.45 --- PHP Version: 5.2.4 +# MySQL dump of database 'fa' on host 'localhost' +# Backup Date and Time: 2009-01-30 11:03 +# Built by FrontAccounting 2.1.0 CVS +# http://frontaccounting.net +# Company: Company name +# User: Administrator +# Database: en_US-new.sql release 2.1 --- --- Database: `en_US-new.sql, release 2.0` --- --- -------------------------------------------------------- - --- --- Table structure for table `0_areas` --- +### Structure of table `0_areas` ### DROP TABLE IF EXISTS `0_areas`; -CREATE TABLE IF NOT EXISTS `0_areas` ( + +CREATE TABLE `0_areas` ( `area_code` int(11) NOT NULL auto_increment, `description` varchar(60) NOT NULL default '', + `inactive` tinyint(1) NOT NULL default '0', PRIMARY KEY (`area_code`), UNIQUE KEY `description` (`description`) -) TYPE=MyISAM AUTO_INCREMENT=2 ; +) TYPE=MyISAM AUTO_INCREMENT=2 AUTO_INCREMENT=2 ; + + +### Data of table `0_areas` ### + +INSERT INTO `0_areas` VALUES ('1', 'USA', '0'); + + +### Structure of table `0_attachments` ### + +DROP TABLE IF EXISTS `0_attachments`; + +CREATE TABLE `0_attachments` ( + `id` int(11) unsigned NOT NULL auto_increment, + `description` varchar(60) NOT NULL default '', + `type_no` int(11) NOT NULL default '0', + `trans_no` int(11) NOT NULL default '0', + `unique_name` varchar(60) NOT NULL default '', + `tran_date` date NOT NULL default '0000-00-00', + `filename` varchar(60) NOT NULL default '', + `filesize` int(11) NOT NULL default '0', + `filetype` varchar(60) NOT NULL default '', + PRIMARY KEY (`id`), + KEY `type_no` (`type_no`,`trans_no`) +) TYPE=MyISAM AUTO_INCREMENT=1 ; + + +### Data of table `0_attachments` ### + --- -------------------------------------------------------- --- --- Table structure for table `0_bank_accounts` --- +### Structure of table `0_bank_accounts` ### DROP TABLE IF EXISTS `0_bank_accounts`; -CREATE TABLE IF NOT EXISTS `0_bank_accounts` ( + +CREATE TABLE `0_bank_accounts` ( `account_code` varchar(11) NOT NULL default '', `account_type` smallint(6) NOT NULL default '0', `bank_account_name` varchar(60) NOT NULL default '', @@ -40,58 +60,54 @@ CREATE TABLE IF NOT EXISTS `0_bank_accounts` ( `bank_name` varchar(60) NOT NULL default '', `bank_address` tinytext, `bank_curr_code` char(3) NOT NULL default '', - PRIMARY KEY (`account_code`), + `id` smallint(6) NOT NULL auto_increment, + `last_reconciled_date` timestamp NOT NULL default '0000-00-00 00:00:00', + `ending_reconcile_balance` double NOT NULL default '0', + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`id`), KEY `bank_account_name` (`bank_account_name`), KEY `bank_account_number` (`bank_account_number`) -) TYPE=MyISAM; +) TYPE=MyISAM AUTO_INCREMENT=3 AUTO_INCREMENT=3 ; + --- -------------------------------------------------------- +### Data of table `0_bank_accounts` ### --- --- Table structure for table `0_bank_trans` --- +INSERT INTO `0_bank_accounts` VALUES ('1700', '0', 'Current account', 'N/A', 'N/A', '', 'USD', '1', '0000-00-00 00:00:00', '0', '0'); +INSERT INTO `0_bank_accounts` VALUES ('1705', '0', 'Petty Cash account', 'N/A', 'N/A', '', 'USD', '2', '0000-00-00 00:00:00', '0', '0'); + + +### Structure of table `0_bank_trans` ### DROP TABLE IF EXISTS `0_bank_trans`; -CREATE TABLE IF NOT EXISTS `0_bank_trans` ( + +CREATE TABLE `0_bank_trans` ( `id` int(11) NOT NULL auto_increment, `type` smallint(6) default NULL, `trans_no` int(11) default NULL, `bank_act` varchar(11) default NULL, `ref` varchar(40) default NULL, `trans_date` date NOT NULL default '0000-00-00', - `bank_trans_type_id` int(10) unsigned default NULL, `amount` double default NULL, `dimension_id` int(11) NOT NULL default '0', `dimension2_id` int(11) NOT NULL default '0', `person_type_id` int(11) NOT NULL default '0', `person_id` tinyblob, + `reconciled` date default NULL, PRIMARY KEY (`id`), KEY `bank_act` (`bank_act`,`ref`), KEY `type` (`type`,`trans_no`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; +) TYPE=InnoDB AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_bank_trans_types` --- +### Data of table `0_bank_trans` ### -DROP TABLE IF EXISTS `0_bank_trans_types`; -CREATE TABLE IF NOT EXISTS `0_bank_trans_types` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(60) NOT NULL default '', - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) TYPE=MyISAM AUTO_INCREMENT=3 ; --- -------------------------------------------------------- --- --- Table structure for table `0_bom` --- +### Structure of table `0_bom` ### DROP TABLE IF EXISTS `0_bom`; -CREATE TABLE IF NOT EXISTS `0_bom` ( + +CREATE TABLE `0_bom` ( `id` int(11) NOT NULL auto_increment, `parent` char(20) NOT NULL default '', `component` char(20) NOT NULL default '', @@ -105,16 +121,18 @@ CREATE TABLE IF NOT EXISTS `0_bom` ( KEY `parent` (`parent`,`loc_code`), KEY `Parent_2` (`parent`), KEY `workcentre_added` (`workcentre_added`) -) TYPE=MyISAM AUTO_INCREMENT=1 ; +) TYPE=MyISAM AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_budget_trans` --- +### Data of table `0_bom` ### + + + +### Structure of table `0_budget_trans` ### DROP TABLE IF EXISTS `0_budget_trans`; -CREATE TABLE IF NOT EXISTS `0_budget_trans` ( + +CREATE TABLE `0_budget_trans` ( `counter` int(11) NOT NULL auto_increment, `type` smallint(6) NOT NULL default '0', `type_no` bigint(16) NOT NULL default '1', @@ -128,78 +146,148 @@ CREATE TABLE IF NOT EXISTS `0_budget_trans` ( `person_id` tinyblob, PRIMARY KEY (`counter`), KEY `Type_and_Number` (`type`,`type_no`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; +) TYPE=InnoDB AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_chart_class` --- +### Data of table `0_budget_trans` ### + + + +### Structure of table `0_chart_class` ### DROP TABLE IF EXISTS `0_chart_class`; -CREATE TABLE IF NOT EXISTS `0_chart_class` ( + +CREATE TABLE `0_chart_class` ( `cid` int(11) NOT NULL default '0', `class_name` varchar(60) NOT NULL default '', `balance_sheet` tinyint(1) NOT NULL default '0', PRIMARY KEY (`cid`) -) TYPE=MyISAM; +) TYPE=MyISAM ; --- -------------------------------------------------------- --- --- Table structure for table `0_chart_master` --- +### Data of table `0_chart_class` ### + +INSERT INTO `0_chart_class` VALUES ('1', 'Assets', '1'); +INSERT INTO `0_chart_class` VALUES ('2', 'Liabilities', '1'); +INSERT INTO `0_chart_class` VALUES ('3', 'Income', '0'); +INSERT INTO `0_chart_class` VALUES ('4', 'Costs', '0'); + + +### Structure of table `0_chart_master` ### DROP TABLE IF EXISTS `0_chart_master`; -CREATE TABLE IF NOT EXISTS `0_chart_master` ( + +CREATE TABLE `0_chart_master` ( `account_code` varchar(11) NOT NULL default '', `account_code2` varchar(11) default '', `account_name` varchar(60) NOT NULL default '', `account_type` int(11) NOT NULL default '0', - `tax_code` int(11) NOT NULL default '0', + `inactive` tinyint(1) NOT NULL default '0', PRIMARY KEY (`account_code`), KEY `account_code` (`account_code`), KEY `account_name` (`account_name`) -) TYPE=MyISAM; - --- -------------------------------------------------------- - --- --- Table structure for table `0_chart_types` --- +) TYPE=MyISAM ; + + +### Data of table `0_chart_master` ### + +INSERT INTO `0_chart_master` VALUES ('3000', '', 'Sales', '1', '0'); +INSERT INTO `0_chart_master` VALUES ('3010', '', 'Sales - Wholesale', '1', '0'); +INSERT INTO `0_chart_master` VALUES ('3020', '', 'Sales of Other items', '1', '0'); +INSERT INTO `0_chart_master` VALUES ('3400', '', 'Difference On Exchange', '1', '0'); +INSERT INTO `0_chart_master` VALUES ('5000', '', 'Direct Labour', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('5050', '', 'Direct Labour Recovery', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('4200', '', 'Material Usage Varaiance', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('4210', '', 'Consumable Materials', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('4220', '', 'Purchase price Variance', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('4000', '', 'Purchases of materials', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('4250', '', 'Discounts Received', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('4260', '', 'Exchange Variation', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('4300', '', 'Freight Inwards', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('4010', '', 'Cost of Goods Sold - Retail', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('6790', '', 'Bank Charges', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('6800', '', 'Entertainments', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('6810', '', 'Legal Expenses', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('6600', '', 'Repairs and Maintenance Office', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('6730', '', 'phone', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('8200', '', 'Bank Interest', '52', '0'); +INSERT INTO `0_chart_master` VALUES ('6840', '', 'Credit Control', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('7040', '', 'Depreciation Office Equipment', '51', '0'); +INSERT INTO `0_chart_master` VALUES ('3800', '', 'Freight Outwards', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('4500', '', 'Packaging', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('6400', '', 'Commissions', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('3200', '', 'Prompt Payment Discounts', '1', '0'); +INSERT INTO `0_chart_master` VALUES ('6700', '', 'General Expenses', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('5200', '', 'Indirect Labour', '2', '0'); +INSERT INTO `0_chart_master` VALUES ('5210', '', 'Overhead Recovery', '5', '0'); +INSERT INTO `0_chart_master` VALUES ('1700', '', 'Bank account', '10', '0'); +INSERT INTO `0_chart_master` VALUES ('1705', '', 'Petty Cash', '10', '0'); +INSERT INTO `0_chart_master` VALUES ('1710', '', 'Foreign currency account', '10', '0'); +INSERT INTO `0_chart_master` VALUES ('1500', '', 'Accounts Receivable', '20', '0'); +INSERT INTO `0_chart_master` VALUES ('1400', '', 'Stocks of Raw Materials', '45', '0'); +INSERT INTO `0_chart_master` VALUES ('1410', '', 'Stocks of Work In Progress', '45', '0'); +INSERT INTO `0_chart_master` VALUES ('1420', '', 'Stocks of Finsihed Goods', '45', '0'); +INSERT INTO `0_chart_master` VALUES ('1430', '', 'Goods Received Clearing account', '30', '0'); +INSERT INTO `0_chart_master` VALUES ('2630', '', 'Accounts Payable', '30', '0'); +INSERT INTO `0_chart_master` VALUES ('2660', '', 'VAT out 5', '30', '0'); +INSERT INTO `0_chart_master` VALUES ('2662', '', 'VAT out 1', '30', '0'); +INSERT INTO `0_chart_master` VALUES ('2664', '', 'VAT out 25', '30', '0'); +INSERT INTO `0_chart_master` VALUES ('2680', '', 'VAT In 5', '30', '0'); +INSERT INTO `0_chart_master` VALUES ('2682', '', 'VAT In 25', '30', '0'); +INSERT INTO `0_chart_master` VALUES ('2050', '', 'Retained Earnings', '50', '0'); +INSERT INTO `0_chart_master` VALUES ('2000', '', 'Share Capital', '50', '0'); + + +### Structure of table `0_chart_types` ### DROP TABLE IF EXISTS `0_chart_types`; -CREATE TABLE IF NOT EXISTS `0_chart_types` ( + +CREATE TABLE `0_chart_types` ( `id` int(11) NOT NULL auto_increment, `name` varchar(60) NOT NULL default '', `class_id` tinyint(1) NOT NULL default '0', `parent` int(11) NOT NULL default '-1', PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) TYPE=MyISAM AUTO_INCREMENT=53 ; + KEY `name` (`name`) +) TYPE=MyISAM AUTO_INCREMENT=53 AUTO_INCREMENT=53 ; --- -------------------------------------------------------- --- --- Table structure for table `0_comments` --- +### Data of table `0_chart_types` ### + +INSERT INTO `0_chart_types` VALUES ('1', 'Sales', '3', '-1'); +INSERT INTO `0_chart_types` VALUES ('2', 'Cost of Sales', '4', '-1'); +INSERT INTO `0_chart_types` VALUES ('5', 'Expenses', '4', '-1'); +INSERT INTO `0_chart_types` VALUES ('10', 'Cash/Bank', '1', '-1'); +INSERT INTO `0_chart_types` VALUES ('20', 'Accounts Receivable', '1', '-1'); +INSERT INTO `0_chart_types` VALUES ('30', 'Accounts Payable', '2', '-1'); +INSERT INTO `0_chart_types` VALUES ('40', 'Fixed Assets', '1', '-1'); +INSERT INTO `0_chart_types` VALUES ('45', 'Inventory', '1', '-1'); +INSERT INTO `0_chart_types` VALUES ('50', 'Equity', '2', '-1'); +INSERT INTO `0_chart_types` VALUES ('51', 'Depreciations', '4', '-1'); +INSERT INTO `0_chart_types` VALUES ('52', 'Financials', '4', '-1'); + + +### Structure of table `0_comments` ### DROP TABLE IF EXISTS `0_comments`; -CREATE TABLE IF NOT EXISTS `0_comments` ( + +CREATE TABLE `0_comments` ( `type` int(11) NOT NULL default '0', `id` int(11) NOT NULL default '0', `date_` date default '0000-00-00', `memo_` tinytext -) TYPE=InnoDB; +) TYPE=InnoDB ; --- -------------------------------------------------------- --- --- Table structure for table `0_company` --- +### Data of table `0_comments` ### + + + +### Structure of table `0_company` ### DROP TABLE IF EXISTS `0_company`; -CREATE TABLE IF NOT EXISTS `0_company` ( + +CREATE TABLE `0_company` ( `coy_code` int(11) NOT NULL default '1', `coy_name` varchar(60) NOT NULL default '', `gst_no` varchar(25) NOT NULL default '', @@ -249,48 +337,66 @@ CREATE TABLE IF NOT EXISTS `0_company` ( `no_customer_list` tinyint(1) NOT NULL default '0', `no_supplier_list` tinyint(1) NOT NULL default '0', `base_sales` int(11) NOT NULL default '-1', + `foreign_codes` tinyint(1) NOT NULL default '0', + `accumulate_shipping` tinyint(1) NOT NULL default '0', + `legal_text` tinytext NOT NULL, PRIMARY KEY (`coy_code`) -) TYPE=MyISAM; +) TYPE=MyISAM ; --- -------------------------------------------------------- --- --- Table structure for table `0_credit_status` --- +### Data of table `0_company` ### + +INSERT INTO `0_company` VALUES ('1', 'Company name', '', '', '1', '1', 'N/A', '', '', '', '', '', 'USD', '1500', '4250', '2630', '1430', '4260', '4220', '2050', '3800', '3000', '3000', '3200', '1420', '4010', '4210', '3000', '1410', '5000', '', '', '', '', '', '', '0', '10', '10', '1000', '20', '20', '30', '1', '1', '0', '0', '0', '-1', '0', '0', ''); + + +### Structure of table `0_credit_status` ### DROP TABLE IF EXISTS `0_credit_status`; -CREATE TABLE IF NOT EXISTS `0_credit_status` ( + +CREATE TABLE `0_credit_status` ( `id` int(11) NOT NULL auto_increment, `reason_description` char(100) NOT NULL default '', `dissallow_invoices` tinyint(1) NOT NULL default '0', + `inactive` tinyint(1) NOT NULL default '0', PRIMARY KEY (`id`), UNIQUE KEY `reason_description` (`reason_description`) -) TYPE=MyISAM AUTO_INCREMENT=5 ; +) TYPE=MyISAM AUTO_INCREMENT=5 AUTO_INCREMENT=5 ; --- -------------------------------------------------------- --- --- Table structure for table `0_currencies` --- +### Data of table `0_credit_status` ### + +INSERT INTO `0_credit_status` VALUES ('1', 'Good History', '0', '0'); +INSERT INTO `0_credit_status` VALUES ('3', 'No more work until payment received', '1', '0'); +INSERT INTO `0_credit_status` VALUES ('4', 'In liquidation', '1', '0'); + + +### Structure of table `0_currencies` ### DROP TABLE IF EXISTS `0_currencies`; -CREATE TABLE IF NOT EXISTS `0_currencies` ( + +CREATE TABLE `0_currencies` ( `currency` varchar(60) NOT NULL default '', `curr_abrev` char(3) NOT NULL default '', `curr_symbol` varchar(10) NOT NULL default '', `country` varchar(100) NOT NULL default '', `hundreds_name` varchar(15) NOT NULL default '', + `inactive` tinyint(1) NOT NULL default '0', PRIMARY KEY (`curr_abrev`) -) TYPE=MyISAM; +) TYPE=MyISAM ; --- -------------------------------------------------------- --- --- Table structure for table `0_cust_allocations` --- +### Data of table `0_currencies` ### + +INSERT INTO `0_currencies` VALUES ('Euro', 'EUR', '?', 'Europe', 'Cents', '0'); +INSERT INTO `0_currencies` VALUES ('Pounds', 'GBP', '?', 'England', 'Pence', '0'); +INSERT INTO `0_currencies` VALUES ('US Dollars', 'USD', '$', 'United States', 'Cents', '0'); + + +### Structure of table `0_cust_allocations` ### DROP TABLE IF EXISTS `0_cust_allocations`; -CREATE TABLE IF NOT EXISTS `0_cust_allocations` ( + +CREATE TABLE `0_cust_allocations` ( `id` int(11) NOT NULL auto_increment, `amt` double unsigned default NULL, `date_alloc` date NOT NULL default '0000-00-00', @@ -299,16 +405,18 @@ CREATE TABLE IF NOT EXISTS `0_cust_allocations` ( `trans_no_to` int(11) default NULL, `trans_type_to` int(11) default NULL, PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; +) TYPE=InnoDB AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_cust_branch` --- +### Data of table `0_cust_allocations` ### + + + +### Structure of table `0_cust_branch` ### DROP TABLE IF EXISTS `0_cust_branch`; -CREATE TABLE IF NOT EXISTS `0_cust_branch` ( + +CREATE TABLE `0_cust_branch` ( `branch_code` int(11) NOT NULL auto_increment, `debtor_no` int(11) NOT NULL default '0', `br_name` varchar(60) NOT NULL default '', @@ -328,45 +436,22 @@ CREATE TABLE IF NOT EXISTS `0_cust_branch` ( `default_ship_via` int(11) NOT NULL default '1', `disable_trans` tinyint(4) NOT NULL default '0', `br_post_address` tinytext NOT NULL, + `group_no` int(11) NOT NULL default '0', PRIMARY KEY (`branch_code`,`debtor_no`), KEY `branch_code` (`branch_code`), KEY `br_name` (`br_name`) -) TYPE=MyISAM AUTO_INCREMENT=1 ; +) TYPE=MyISAM AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_debtors_master` --- +### Data of table `0_cust_branch` ### -DROP TABLE IF EXISTS `0_debtors_master`; -CREATE TABLE IF NOT EXISTS `0_debtors_master` ( - `debtor_no` int(11) NOT NULL auto_increment, - `name` varchar(60) NOT NULL default '', - `address` tinytext, - `email` varchar(100) NOT NULL default '', - `tax_id` varchar(55) NOT NULL default '', - `curr_code` char(3) NOT NULL default '', - `sales_type` int(11) NOT NULL default '1', - `dimension_id` int(11) NOT NULL default '0', - `dimension2_id` int(11) NOT NULL default '0', - `credit_status` int(11) NOT NULL default '0', - `payment_terms` int(11) default NULL, - `discount` double NOT NULL default '0', - `pymt_discount` double NOT NULL default '0', - `credit_limit` float NOT NULL default '1000', - PRIMARY KEY (`debtor_no`), - UNIQUE KEY `name` (`name`) -) TYPE=MyISAM AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_debtor_trans` --- +### Structure of table `0_debtor_trans` ### DROP TABLE IF EXISTS `0_debtor_trans`; -CREATE TABLE IF NOT EXISTS `0_debtor_trans` ( + +CREATE TABLE `0_debtor_trans` ( `trans_no` int(11) unsigned NOT NULL default '0', `type` smallint(6) unsigned NOT NULL default '0', `version` tinyint(1) unsigned NOT NULL default '0', @@ -386,18 +471,22 @@ CREATE TABLE IF NOT EXISTS `0_debtor_trans` ( `rate` double NOT NULL default '1', `ship_via` int(11) default NULL, `trans_link` int(11) NOT NULL default '0', + `dimension_id` int(11) NOT NULL default '0', + `dimension2_id` int(11) NOT NULL default '0', PRIMARY KEY (`trans_no`,`type`), KEY `debtor_no` (`debtor_no`,`branch_code`) -) TYPE=InnoDB; +) TYPE=InnoDB ; --- -------------------------------------------------------- --- --- Table structure for table `0_debtor_trans_details` --- +### Data of table `0_debtor_trans` ### + + + +### Structure of table `0_debtor_trans_details` ### DROP TABLE IF EXISTS `0_debtor_trans_details`; -CREATE TABLE IF NOT EXISTS `0_debtor_trans_details` ( + +CREATE TABLE `0_debtor_trans_details` ( `id` int(11) NOT NULL auto_increment, `debtor_trans_no` int(11) default NULL, `debtor_trans_type` int(11) default NULL, @@ -410,35 +499,47 @@ CREATE TABLE IF NOT EXISTS `0_debtor_trans_details` ( `standard_cost` double NOT NULL default '0', `qty_done` double NOT NULL default '0', PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; +) TYPE=InnoDB AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_debtor_trans_tax_details` --- +### Data of table `0_debtor_trans_details` ### + + + +### Structure of table `0_debtors_master` ### + +DROP TABLE IF EXISTS `0_debtors_master`; + +CREATE TABLE `0_debtors_master` ( + `debtor_no` int(11) NOT NULL auto_increment, + `name` varchar(60) NOT NULL default '', + `address` tinytext, + `email` varchar(100) NOT NULL default '', + `tax_id` varchar(55) NOT NULL default '', + `curr_code` char(3) NOT NULL default '', + `sales_type` int(11) NOT NULL default '1', + `dimension_id` int(11) NOT NULL default '0', + `dimension2_id` int(11) NOT NULL default '0', + `credit_status` int(11) NOT NULL default '0', + `payment_terms` int(11) default NULL, + `discount` double NOT NULL default '0', + `pymt_discount` double NOT NULL default '0', + `credit_limit` float NOT NULL default '1000', + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`debtor_no`), + UNIQUE KEY `name` (`name`) +) TYPE=MyISAM AUTO_INCREMENT=1 ; + + +### Data of table `0_debtors_master` ### -DROP TABLE IF EXISTS `0_debtor_trans_tax_details`; -CREATE TABLE IF NOT EXISTS `0_debtor_trans_tax_details` ( - `id` int(11) NOT NULL auto_increment, - `debtor_trans_no` int(11) default NULL, - `debtor_trans_type` int(11) default NULL, - `tax_type_id` int(11) NOT NULL default '0', - `tax_type_name` varchar(60) default NULL, - `rate` double NOT NULL default '0', - `included_in_price` tinyint(1) NOT NULL default '0', - `amount` double NOT NULL default '0', - PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_dimensions` --- +### Structure of table `0_dimensions` ### DROP TABLE IF EXISTS `0_dimensions`; -CREATE TABLE IF NOT EXISTS `0_dimensions` ( + +CREATE TABLE `0_dimensions` ( `id` int(11) NOT NULL auto_increment, `reference` varchar(60) NOT NULL default '', `name` varchar(60) NOT NULL default '', @@ -448,16 +549,18 @@ CREATE TABLE IF NOT EXISTS `0_dimensions` ( `due_date` date NOT NULL default '0000-00-00', PRIMARY KEY (`id`), UNIQUE KEY `reference` (`reference`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; +) TYPE=InnoDB AUTO_INCREMENT=1 ; + + +### Data of table `0_dimensions` ### + --- -------------------------------------------------------- --- --- Table structure for table `0_exchange_rates` --- +### Structure of table `0_exchange_rates` ### DROP TABLE IF EXISTS `0_exchange_rates`; -CREATE TABLE IF NOT EXISTS `0_exchange_rates` ( + +CREATE TABLE `0_exchange_rates` ( `id` int(11) NOT NULL auto_increment, `curr_code` char(3) NOT NULL default '', `rate_buy` double NOT NULL default '0', @@ -465,31 +568,36 @@ CREATE TABLE IF NOT EXISTS `0_exchange_rates` ( `date_` date NOT NULL default '0000-00-00', PRIMARY KEY (`id`), UNIQUE KEY `curr_code` (`curr_code`,`date_`) -) TYPE=MyISAM AUTO_INCREMENT=1 ; +) TYPE=MyISAM AUTO_INCREMENT=1 ; + + +### Data of table `0_exchange_rates` ### + --- -------------------------------------------------------- --- --- Table structure for table `0_fiscal_year` --- +### Structure of table `0_fiscal_year` ### DROP TABLE IF EXISTS `0_fiscal_year`; -CREATE TABLE IF NOT EXISTS `0_fiscal_year` ( + +CREATE TABLE `0_fiscal_year` ( `id` int(11) NOT NULL auto_increment, `begin` date default '0000-00-00', `end` date default '0000-00-00', `closed` tinyint(1) NOT NULL default '0', PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=2 ; +) TYPE=InnoDB AUTO_INCREMENT=2 AUTO_INCREMENT=2 ; + + +### Data of table `0_fiscal_year` ### + +INSERT INTO `0_fiscal_year` VALUES ('1', '2008-01-01', '2008-12-31', '0'); --- -------------------------------------------------------- --- --- Table structure for table `0_gl_trans` --- +### Structure of table `0_gl_trans` ### DROP TABLE IF EXISTS `0_gl_trans`; -CREATE TABLE IF NOT EXISTS `0_gl_trans` ( + +CREATE TABLE `0_gl_trans` ( `counter` int(11) NOT NULL auto_increment, `type` smallint(6) NOT NULL default '0', `type_no` bigint(16) NOT NULL default '1', @@ -503,16 +611,18 @@ CREATE TABLE IF NOT EXISTS `0_gl_trans` ( `person_id` tinyblob, PRIMARY KEY (`counter`), KEY `Type_and_Number` (`type`,`type_no`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; +) TYPE=InnoDB AUTO_INCREMENT=1 ; + + +### Data of table `0_gl_trans` ### + --- -------------------------------------------------------- --- --- Table structure for table `0_grn_batch` --- +### Structure of table `0_grn_batch` ### DROP TABLE IF EXISTS `0_grn_batch`; -CREATE TABLE IF NOT EXISTS `0_grn_batch` ( + +CREATE TABLE `0_grn_batch` ( `id` int(11) NOT NULL auto_increment, `supplier_id` int(11) NOT NULL default '0', `purch_order_no` int(11) default NULL, @@ -520,16 +630,18 @@ CREATE TABLE IF NOT EXISTS `0_grn_batch` ( `delivery_date` date NOT NULL default '0000-00-00', `loc_code` varchar(5) default NULL, PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; +) TYPE=InnoDB AUTO_INCREMENT=1 ; + + +### Data of table `0_grn_batch` ### + --- -------------------------------------------------------- --- --- Table structure for table `0_grn_items` --- +### Structure of table `0_grn_items` ### DROP TABLE IF EXISTS `0_grn_items`; -CREATE TABLE IF NOT EXISTS `0_grn_items` ( + +CREATE TABLE `0_grn_items` ( `id` int(11) NOT NULL auto_increment, `grn_batch_id` int(11) default NULL, `po_detail_item` int(11) NOT NULL default '0', @@ -538,59 +650,128 @@ CREATE TABLE IF NOT EXISTS `0_grn_items` ( `qty_recd` double NOT NULL default '0', `quantity_inv` double NOT NULL default '0', PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; +) TYPE=InnoDB AUTO_INCREMENT=1 ; + + +### Data of table `0_grn_items` ### + + + +### Structure of table `0_groups` ### + +DROP TABLE IF EXISTS `0_groups`; + +CREATE TABLE `0_groups` ( + `id` smallint(6) unsigned NOT NULL auto_increment, + `description` varchar(60) NOT NULL default '', + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`id`), + UNIQUE KEY `description` (`description`) +) TYPE=MyISAM AUTO_INCREMENT=4 AUTO_INCREMENT=4 ; + + +### Data of table `0_groups` ### + +INSERT INTO `0_groups` VALUES ('1', 'Small', '0'); +INSERT INTO `0_groups` VALUES ('2', 'Medium', '0'); +INSERT INTO `0_groups` VALUES ('3', 'Large', '0'); + + +### Structure of table `0_item_codes` ### --- -------------------------------------------------------- +DROP TABLE IF EXISTS `0_item_codes`; --- --- Table structure for table `0_item_tax_types` --- +CREATE TABLE `0_item_codes` ( + `id` int(11) unsigned NOT NULL auto_increment, + `item_code` varchar(20) NOT NULL, + `stock_id` varchar(20) NOT NULL, + `description` varchar(200) NOT NULL default '', + `category_id` smallint(6) unsigned NOT NULL, + `quantity` double NOT NULL default '1', + `is_foreign` tinyint(1) NOT NULL default '0', + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`id`), + UNIQUE KEY `stock_id` (`stock_id`,`item_code`) +) TYPE=MyISAM AUTO_INCREMENT=1 ; + + +### Data of table `0_item_codes` ### + + + +### Structure of table `0_item_tax_type_exemptions` ### + +DROP TABLE IF EXISTS `0_item_tax_type_exemptions`; + +CREATE TABLE `0_item_tax_type_exemptions` ( + `item_tax_type_id` int(11) NOT NULL default '0', + `tax_type_id` int(11) NOT NULL default '0', + PRIMARY KEY (`item_tax_type_id`,`tax_type_id`) +) TYPE=InnoDB ; + + +### Data of table `0_item_tax_type_exemptions` ### + + + +### Structure of table `0_item_tax_types` ### DROP TABLE IF EXISTS `0_item_tax_types`; -CREATE TABLE IF NOT EXISTS `0_item_tax_types` ( + +CREATE TABLE `0_item_tax_types` ( `id` int(11) NOT NULL auto_increment, `name` varchar(60) NOT NULL default '', `exempt` tinyint(1) NOT NULL default '0', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; +) TYPE=InnoDB AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_item_tax_type_exemptions` --- +### Data of table `0_item_tax_types` ### -DROP TABLE IF EXISTS `0_item_tax_type_exemptions`; -CREATE TABLE IF NOT EXISTS `0_item_tax_type_exemptions` ( - `item_tax_type_id` int(11) NOT NULL default '0', - `tax_type_id` int(11) NOT NULL default '0', - PRIMARY KEY (`item_tax_type_id`,`tax_type_id`) -) TYPE=InnoDB; --- -------------------------------------------------------- --- --- Table structure for table `0_item_units` --- +### Structure of table `0_item_units` ### DROP TABLE IF EXISTS `0_item_units`; -CREATE TABLE IF NOT EXISTS `0_item_units` ( + +CREATE TABLE `0_item_units` ( `abbr` varchar(20) NOT NULL, `name` varchar(40) NOT NULL, `decimals` tinyint(2) NOT NULL, + `inactive` tinyint(1) NOT NULL default '0', PRIMARY KEY (`abbr`), UNIQUE KEY `name` (`name`) -) TYPE=MyISAM; +) TYPE=MyISAM ; + + +### Data of table `0_item_units` ### + +INSERT INTO `0_item_units` VALUES ('ea.', 'Each', '0', '0'); + + +### Structure of table `0_loc_stock` ### + +DROP TABLE IF EXISTS `0_loc_stock`; + +CREATE TABLE `0_loc_stock` ( + `loc_code` char(5) NOT NULL default '', + `stock_id` char(20) NOT NULL default '', + `reorder_level` bigint(20) NOT NULL default '0', + PRIMARY KEY (`loc_code`,`stock_id`), + KEY `stock_id` (`stock_id`) +) TYPE=InnoDB ; + + +### Data of table `0_loc_stock` ### --- -------------------------------------------------------- --- --- Table structure for table `0_locations` --- + +### Structure of table `0_locations` ### DROP TABLE IF EXISTS `0_locations`; -CREATE TABLE IF NOT EXISTS `0_locations` ( + +CREATE TABLE `0_locations` ( `loc_code` varchar(5) NOT NULL default '', `location_name` varchar(60) NOT NULL default '', `delivery_address` tinytext NOT NULL, @@ -598,62 +779,61 @@ CREATE TABLE IF NOT EXISTS `0_locations` ( `fax` varchar(30) NOT NULL default '', `email` varchar(100) NOT NULL default '', `contact` varchar(30) NOT NULL default '', + `inactive` tinyint(1) NOT NULL default '0', PRIMARY KEY (`loc_code`) -) TYPE=MyISAM; +) TYPE=MyISAM ; --- -------------------------------------------------------- --- --- Table structure for table `0_loc_stock` --- +### Data of table `0_locations` ### -DROP TABLE IF EXISTS `0_loc_stock`; -CREATE TABLE IF NOT EXISTS `0_loc_stock` ( - `loc_code` char(5) NOT NULL default '', - `stock_id` char(20) NOT NULL default '', - `reorder_level` bigint(20) NOT NULL default '0', - PRIMARY KEY (`loc_code`,`stock_id`), - KEY `stock_id` (`stock_id`) -) TYPE=InnoDB; +INSERT INTO `0_locations` VALUES ('DEF', 'Default', 'N/A', '', '', '', '', '0'); --- -------------------------------------------------------- --- --- Table structure for table `0_movement_types` --- +### Structure of table `0_movement_types` ### DROP TABLE IF EXISTS `0_movement_types`; -CREATE TABLE IF NOT EXISTS `0_movement_types` ( + +CREATE TABLE `0_movement_types` ( `id` int(11) NOT NULL auto_increment, `name` varchar(60) NOT NULL default '', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) TYPE=MyISAM AUTO_INCREMENT=2 ; +) TYPE=MyISAM AUTO_INCREMENT=2 AUTO_INCREMENT=2 ; + + +### Data of table `0_movement_types` ### + +INSERT INTO `0_movement_types` VALUES ('1', 'Adjustment'); --- -------------------------------------------------------- --- --- Table structure for table `0_payment_terms` --- +### Structure of table `0_payment_terms` ### DROP TABLE IF EXISTS `0_payment_terms`; -CREATE TABLE IF NOT EXISTS `0_payment_terms` ( + +CREATE TABLE `0_payment_terms` ( `terms_indicator` int(11) NOT NULL auto_increment, `terms` char(80) NOT NULL default '', `days_before_due` smallint(6) NOT NULL default '0', `day_in_following_month` smallint(6) NOT NULL default '0', + `inactive` tinyint(1) NOT NULL default '0', PRIMARY KEY (`terms_indicator`), UNIQUE KEY `terms` (`terms`) -) TYPE=MyISAM AUTO_INCREMENT=5 ; +) TYPE=MyISAM AUTO_INCREMENT=5 AUTO_INCREMENT=5 ; + + +### Data of table `0_payment_terms` ### + +INSERT INTO `0_payment_terms` VALUES ('1', 'Due 15th Of the Following Month', '0', '17', '0'); +INSERT INTO `0_payment_terms` VALUES ('2', 'Due By End Of The Following Month', '0', '30', '0'); +INSERT INTO `0_payment_terms` VALUES ('3', 'Payment due within 10 days', '10', '0', '0'); +INSERT INTO `0_payment_terms` VALUES ('4', 'Cash Only', '1', '0', '0'); --- -------------------------------------------------------- --- --- Table structure for table `0_prices` --- +### Structure of table `0_prices` ### DROP TABLE IF EXISTS `0_prices`; -CREATE TABLE IF NOT EXISTS `0_prices` ( + +CREATE TABLE `0_prices` ( `id` int(11) NOT NULL auto_increment, `stock_id` varchar(20) NOT NULL default '', `sales_type_id` int(11) NOT NULL default '0', @@ -661,16 +841,69 @@ CREATE TABLE IF NOT EXISTS `0_prices` ( `price` double NOT NULL default '0', PRIMARY KEY (`id`), UNIQUE KEY `price` (`stock_id`,`sales_type_id`,`curr_abrev`) -) TYPE=MyISAM AUTO_INCREMENT=1 ; +) TYPE=MyISAM AUTO_INCREMENT=1 ; + + +### Data of table `0_prices` ### + + + +### Structure of table `0_print_profiles` ### + +DROP TABLE IF EXISTS `0_print_profiles`; + +CREATE TABLE `0_print_profiles` ( + `id` smallint(6) unsigned NOT NULL auto_increment, + `profile` varchar(30) NOT NULL, + `report` varchar(5) default NULL, + `printer` tinyint(3) unsigned default NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `profile` (`profile`,`report`) +) TYPE=MyISAM AUTO_INCREMENT=10 AUTO_INCREMENT=10 ; + + +### Data of table `0_print_profiles` ### + +INSERT INTO `0_print_profiles` VALUES ('1', 'Out of office', '', '0'); +INSERT INTO `0_print_profiles` VALUES ('2', 'Sales Department', '', '0'); +INSERT INTO `0_print_profiles` VALUES ('3', 'Central', '', '2'); +INSERT INTO `0_print_profiles` VALUES ('4', 'Sales Department', '104', '2'); +INSERT INTO `0_print_profiles` VALUES ('5', 'Sales Department', '105', '2'); +INSERT INTO `0_print_profiles` VALUES ('6', 'Sales Department', '107', '2'); +INSERT INTO `0_print_profiles` VALUES ('7', 'Sales Department', '109', '2'); +INSERT INTO `0_print_profiles` VALUES ('8', 'Sales Department', '110', '2'); +INSERT INTO `0_print_profiles` VALUES ('9', 'Sales Department', '201', '2'); + + +### Structure of table `0_printers` ### + +DROP TABLE IF EXISTS `0_printers`; + +CREATE TABLE `0_printers` ( + `id` tinyint(3) unsigned NOT NULL auto_increment, + `name` varchar(20) NOT NULL, + `description` varchar(60) NOT NULL, + `queue` varchar(20) NOT NULL, + `host` varchar(40) NOT NULL, + `port` smallint(11) unsigned NOT NULL, + `timeout` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) TYPE=MyISAM AUTO_INCREMENT=4 AUTO_INCREMENT=4 ; + + +### Data of table `0_printers` ### --- -------------------------------------------------------- +INSERT INTO `0_printers` VALUES ('1', 'QL500', 'Label printer', 'QL500', 'server', '127', '20'); +INSERT INTO `0_printers` VALUES ('2', 'Samsung', 'Main network printer', 'scx4521F', 'server', '515', '5'); +INSERT INTO `0_printers` VALUES ('3', 'Local', 'Local print server at user IP', 'lp', '', '515', '10'); --- --- Table structure for table `0_purch_data` --- + +### Structure of table `0_purch_data` ### DROP TABLE IF EXISTS `0_purch_data`; -CREATE TABLE IF NOT EXISTS `0_purch_data` ( + +CREATE TABLE `0_purch_data` ( `supplier_id` int(11) NOT NULL default '0', `stock_id` char(20) NOT NULL default '', `price` double NOT NULL default '0', @@ -678,35 +911,18 @@ CREATE TABLE IF NOT EXISTS `0_purch_data` ( `conversion_factor` double NOT NULL default '1', `supplier_description` char(50) NOT NULL default '', PRIMARY KEY (`supplier_id`,`stock_id`) -) TYPE=MyISAM; +) TYPE=MyISAM ; --- -------------------------------------------------------- --- --- Table structure for table `0_purch_orders` --- +### Data of table `0_purch_data` ### -DROP TABLE IF EXISTS `0_purch_orders`; -CREATE TABLE IF NOT EXISTS `0_purch_orders` ( - `order_no` int(11) NOT NULL auto_increment, - `supplier_id` int(11) NOT NULL default '0', - `comments` tinytext, - `ord_date` date NOT NULL default '0000-00-00', - `reference` tinytext NOT NULL, - `requisition_no` tinytext, - `into_stock_location` varchar(5) NOT NULL default '', - `delivery_address` tinytext NOT NULL, - PRIMARY KEY (`order_no`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_purch_order_details` --- +### Structure of table `0_purch_order_details` ### DROP TABLE IF EXISTS `0_purch_order_details`; -CREATE TABLE IF NOT EXISTS `0_purch_order_details` ( + +CREATE TABLE `0_purch_order_details` ( `po_detail_item` int(11) NOT NULL auto_increment, `order_no` int(11) NOT NULL default '0', `item_code` varchar(20) NOT NULL default '', @@ -719,50 +935,146 @@ CREATE TABLE IF NOT EXISTS `0_purch_order_details` ( `quantity_ordered` double NOT NULL default '0', `quantity_received` double NOT NULL default '0', PRIMARY KEY (`po_detail_item`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; +) TYPE=InnoDB AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_refs` --- +### Data of table `0_purch_order_details` ### -DROP TABLE IF EXISTS `0_refs`; -CREATE TABLE IF NOT EXISTS `0_refs` ( - `id` int(11) NOT NULL default '0', - `type` int(11) NOT NULL default '0', - `reference` varchar(100) NOT NULL default '', - PRIMARY KEY (`id`,`type`) -) TYPE=InnoDB; --- -------------------------------------------------------- --- --- Table structure for table `0_salesman` --- +### Structure of table `0_purch_orders` ### + +DROP TABLE IF EXISTS `0_purch_orders`; + +CREATE TABLE `0_purch_orders` ( + `order_no` int(11) NOT NULL auto_increment, + `supplier_id` int(11) NOT NULL default '0', + `comments` tinytext, + `ord_date` date NOT NULL default '0000-00-00', + `reference` tinytext NOT NULL, + `requisition_no` tinytext, + `into_stock_location` varchar(5) NOT NULL default '', + `delivery_address` tinytext NOT NULL, + PRIMARY KEY (`order_no`) +) TYPE=InnoDB AUTO_INCREMENT=1 ; + + +### Data of table `0_purch_orders` ### + + + +### Structure of table `0_quick_entries` ### + +DROP TABLE IF EXISTS `0_quick_entries`; + +CREATE TABLE `0_quick_entries` ( + `id` smallint(6) unsigned NOT NULL auto_increment, + `type` tinyint(1) NOT NULL default '0', + `description` varchar(60) NOT NULL, + `base_amount` double NOT NULL default '0', + `base_desc` varchar(60) default NULL, + PRIMARY KEY (`id`), + KEY `description` (`description`) +) TYPE=MyISAM AUTO_INCREMENT=4 AUTO_INCREMENT=4 ; + + +### Data of table `0_quick_entries` ### + +INSERT INTO `0_quick_entries` VALUES ('1', '1', 'Maintenance', '0', 'Amount'); +INSERT INTO `0_quick_entries` VALUES ('2', '1', 'Phone', '0', 'Amount'); +INSERT INTO `0_quick_entries` VALUES ('3', '2', 'Cash Sales', '0', 'Amount'); + + +### Structure of table `0_quick_entry_lines` ### + +DROP TABLE IF EXISTS `0_quick_entry_lines`; + +CREATE TABLE `0_quick_entry_lines` ( + `id` smallint(6) unsigned NOT NULL auto_increment, + `qid` smallint(6) unsigned NOT NULL, + `amount` double default '0', + `action` varchar(2) NOT NULL, + `dest_id` varchar(11) NOT NULL, + `dimension_id` smallint(6) unsigned default NULL, + `dimension2_id` smallint(6) unsigned default NULL, + PRIMARY KEY (`id`), + KEY `qid` (`qid`) +) TYPE=MyISAM AUTO_INCREMENT=4 AUTO_INCREMENT=4 ; + + +### Data of table `0_quick_entry_lines` ### + +INSERT INTO `0_quick_entry_lines` VALUES ('1', '1', '0', '=', '6600', '0', '0'); +INSERT INTO `0_quick_entry_lines` VALUES ('2', '2', '0', '=', '6730', '0', '0'); +INSERT INTO `0_quick_entry_lines` VALUES ('3', '3', '0', '=', '3000', '0', '0'); + + +### Structure of table `0_recurrent_invoices` ### + +DROP TABLE IF EXISTS `0_recurrent_invoices`; + +CREATE TABLE `0_recurrent_invoices` ( + `id` smallint(6) unsigned NOT NULL auto_increment, + `description` varchar(60) NOT NULL default '', + `order_no` int(11) unsigned NOT NULL, + `debtor_no` int(11) unsigned default NULL, + `group_no` smallint(6) unsigned default NULL, + `days` int(11) NOT NULL default '0', + `monthly` int(11) NOT NULL default '0', + `begin` date NOT NULL default '0000-00-00', + `end` date NOT NULL default '0000-00-00', + `last_sent` date NOT NULL default '0000-00-00', + PRIMARY KEY (`id`), + UNIQUE KEY `description` (`description`) +) TYPE=InnoDB AUTO_INCREMENT=1 ; + + +### Data of table `0_recurrent_invoices` ### + + + +### Structure of table `0_refs` ### + +DROP TABLE IF EXISTS `0_refs`; + +CREATE TABLE `0_refs` ( + `id` int(11) NOT NULL default '0', + `type` int(11) NOT NULL default '0', + `reference` varchar(100) NOT NULL default '', + PRIMARY KEY (`id`,`type`) +) TYPE=InnoDB ; + + +### Data of table `0_refs` ### + + + +### Structure of table `0_sales_order_details` ### + +DROP TABLE IF EXISTS `0_sales_order_details`; + +CREATE TABLE `0_sales_order_details` ( + `id` int(11) NOT NULL auto_increment, + `order_no` int(11) NOT NULL default '0', + `stk_code` varchar(20) NOT NULL default '', + `description` tinytext, + `qty_sent` double NOT NULL default '0', + `unit_price` double NOT NULL default '0', + `quantity` double NOT NULL default '0', + `discount_percent` double NOT NULL default '0', + PRIMARY KEY (`id`) +) TYPE=InnoDB AUTO_INCREMENT=1 ; + + +### Data of table `0_sales_order_details` ### -DROP TABLE IF EXISTS `0_salesman`; -CREATE TABLE IF NOT EXISTS `0_salesman` ( - `salesman_code` int(11) NOT NULL auto_increment, - `salesman_name` char(60) NOT NULL default '', - `salesman_phone` char(30) NOT NULL default '', - `salesman_fax` char(30) NOT NULL default '', - `salesman_email` varchar(100) NOT NULL default '', - `provision` double NOT NULL default '0', - `break_pt` double NOT NULL default '0', - `provision2` double NOT NULL default '0', - PRIMARY KEY (`salesman_code`), - UNIQUE KEY `salesman_name` (`salesman_name`) -) TYPE=MyISAM AUTO_INCREMENT=2 ; --- -------------------------------------------------------- --- --- Table structure for table `0_sales_orders` --- +### Structure of table `0_sales_orders` ### DROP TABLE IF EXISTS `0_sales_orders`; -CREATE TABLE IF NOT EXISTS `0_sales_orders` ( + +CREATE TABLE `0_sales_orders` ( `order_no` int(11) NOT NULL auto_increment, `version` tinyint(1) unsigned NOT NULL default '0', `type` tinyint(1) NOT NULL default '0', @@ -781,86 +1093,148 @@ CREATE TABLE IF NOT EXISTS `0_sales_orders` ( `from_stk_loc` varchar(5) NOT NULL default '', `delivery_date` date NOT NULL default '0000-00-00', PRIMARY KEY (`order_no`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; +) TYPE=InnoDB AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_sales_order_details` --- +### Data of table `0_sales_orders` ### -DROP TABLE IF EXISTS `0_sales_order_details`; -CREATE TABLE IF NOT EXISTS `0_sales_order_details` ( - `id` int(11) NOT NULL auto_increment, - `order_no` int(11) NOT NULL default '0', - `stk_code` varchar(20) NOT NULL default '', - `description` tinytext, - `qty_sent` double NOT NULL default '0', - `unit_price` double NOT NULL default '0', - `quantity` double NOT NULL default '0', - `discount_percent` double NOT NULL default '0', - PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_sales_types` --- +### Structure of table `0_sales_pos` ### + +DROP TABLE IF EXISTS `0_sales_pos`; + +CREATE TABLE `0_sales_pos` ( + `id` smallint(6) unsigned NOT NULL auto_increment, + `pos_name` varchar(30) NOT NULL, + `cash_sale` tinyint(1) NOT NULL, + `credit_sale` tinyint(1) NOT NULL, + `pos_location` varchar(5) NOT NULL, + `pos_account` smallint(6) unsigned NOT NULL, + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`id`), + UNIQUE KEY `pos_name` (`pos_name`) +) TYPE=MyISAM AUTO_INCREMENT=2 AUTO_INCREMENT=2 ; + + +### Data of table `0_sales_pos` ### + +INSERT INTO `0_sales_pos` VALUES ('1', 'Default', '1', '1', 'DEF', '1', '0'); + + +### Structure of table `0_sales_types` ### DROP TABLE IF EXISTS `0_sales_types`; -CREATE TABLE IF NOT EXISTS `0_sales_types` ( + +CREATE TABLE `0_sales_types` ( `id` int(11) NOT NULL auto_increment, `sales_type` char(50) NOT NULL default '', `tax_included` int(1) NOT NULL default '0', `factor` double NOT NULL default '1', + `inactive` tinyint(1) NOT NULL default '0', PRIMARY KEY (`id`), UNIQUE KEY `sales_type` (`sales_type`) -) TYPE=MyISAM AUTO_INCREMENT=3 ; +) TYPE=MyISAM AUTO_INCREMENT=3 AUTO_INCREMENT=3 ; + + +### Data of table `0_sales_types` ### + +INSERT INTO `0_sales_types` VALUES ('1', 'Retail', '0', '1', '0'); +INSERT INTO `0_sales_types` VALUES ('2', 'Wholesale', '0', '1', '0'); + + +### Structure of table `0_salesman` ### + +DROP TABLE IF EXISTS `0_salesman`; + +CREATE TABLE `0_salesman` ( + `salesman_code` int(11) NOT NULL auto_increment, + `salesman_name` char(60) NOT NULL default '', + `salesman_phone` char(30) NOT NULL default '', + `salesman_fax` char(30) NOT NULL default '', + `salesman_email` varchar(100) NOT NULL default '', + `provision` double NOT NULL default '0', + `break_pt` double NOT NULL default '0', + `provision2` double NOT NULL default '0', + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`salesman_code`), + UNIQUE KEY `salesman_name` (`salesman_name`) +) TYPE=MyISAM AUTO_INCREMENT=2 AUTO_INCREMENT=2 ; + + +### Data of table `0_salesman` ### --- -------------------------------------------------------- +INSERT INTO `0_salesman` VALUES ('1', 'Sales Person', '', '', '', '5', '1000', '4', '0'); --- --- Table structure for table `0_shippers` --- + +### Structure of table `0_shippers` ### DROP TABLE IF EXISTS `0_shippers`; -CREATE TABLE IF NOT EXISTS `0_shippers` ( + +CREATE TABLE `0_shippers` ( `shipper_id` int(11) NOT NULL auto_increment, `shipper_name` varchar(60) NOT NULL default '', `phone` varchar(30) NOT NULL default '', `contact` tinytext NOT NULL, `address` tinytext NOT NULL, + `inactive` tinyint(1) NOT NULL default '0', PRIMARY KEY (`shipper_id`), UNIQUE KEY `name` (`shipper_name`) -) TYPE=MyISAM AUTO_INCREMENT=2 ; +) TYPE=MyISAM AUTO_INCREMENT=2 AUTO_INCREMENT=2 ; + + +### Data of table `0_shippers` ### + +INSERT INTO `0_shippers` VALUES ('1', 'Default', '', '', '', '0'); + + +### Structure of table `0_sql_trail` ### + +DROP TABLE IF EXISTS `0_sql_trail`; + +CREATE TABLE `0_sql_trail` ( + `id` int(11) unsigned NOT NULL auto_increment, + `sql` text NOT NULL, + `result` tinyint(1) NOT NULL, + `msg` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) TYPE=MyISAM AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_stock_category` --- +### Data of table `0_sql_trail` ### + + + +### Structure of table `0_stock_category` ### DROP TABLE IF EXISTS `0_stock_category`; -CREATE TABLE IF NOT EXISTS `0_stock_category` ( + +CREATE TABLE `0_stock_category` ( `category_id` int(11) NOT NULL auto_increment, `description` varchar(60) NOT NULL default '', `stock_act` varchar(11) default NULL, `cogs_act` varchar(11) default NULL, `adj_gl_act` varchar(11) default NULL, `purch_price_var_act` varchar(11) default NULL, + `inactive` tinyint(1) NOT NULL default '0', PRIMARY KEY (`category_id`), UNIQUE KEY `description` (`description`) -) TYPE=MyISAM AUTO_INCREMENT=5 ; +) TYPE=MyISAM AUTO_INCREMENT=5 AUTO_INCREMENT=5 ; + --- -------------------------------------------------------- +### Data of table `0_stock_category` ### --- --- Table structure for table `0_stock_master` --- +INSERT INTO `0_stock_category` VALUES ('1', 'Components', '', '', '', '', '0'); +INSERT INTO `0_stock_category` VALUES ('2', 'Charges', '', '', '', '', '0'); +INSERT INTO `0_stock_category` VALUES ('3', 'Systems', '', '', '', '', '0'); +INSERT INTO `0_stock_category` VALUES ('4', 'Services', '', '', '', '', '0'); + + +### Structure of table `0_stock_master` ### DROP TABLE IF EXISTS `0_stock_master`; -CREATE TABLE IF NOT EXISTS `0_stock_master` ( + +CREATE TABLE `0_stock_master` ( `stock_id` varchar(20) NOT NULL default '', `category_id` int(11) NOT NULL default '0', `tax_type_id` int(11) NOT NULL default '0', @@ -880,17 +1254,20 @@ CREATE TABLE IF NOT EXISTS `0_stock_master` ( `material_cost` double NOT NULL default '0', `labour_cost` double NOT NULL default '0', `overhead_cost` double NOT NULL default '0', + `inactive` tinyint(1) NOT NULL default '0', PRIMARY KEY (`stock_id`) -) TYPE=InnoDB; +) TYPE=InnoDB ; + + +### Data of table `0_stock_master` ### --- -------------------------------------------------------- --- --- Table structure for table `0_stock_moves` --- + +### Structure of table `0_stock_moves` ### DROP TABLE IF EXISTS `0_stock_moves`; -CREATE TABLE IF NOT EXISTS `0_stock_moves` ( + +CREATE TABLE `0_stock_moves` ( `trans_id` int(11) NOT NULL auto_increment, `trans_no` int(11) NOT NULL default '0', `stock_id` char(20) NOT NULL default '', @@ -906,40 +1283,18 @@ CREATE TABLE IF NOT EXISTS `0_stock_moves` ( `visible` tinyint(1) NOT NULL default '1', PRIMARY KEY (`trans_id`), KEY `type` (`type`,`trans_no`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; +) TYPE=InnoDB AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_suppliers` --- +### Data of table `0_stock_moves` ### -DROP TABLE IF EXISTS `0_suppliers`; -CREATE TABLE IF NOT EXISTS `0_suppliers` ( - `supplier_id` int(11) NOT NULL auto_increment, - `supp_name` varchar(60) NOT NULL default '', - `address` tinytext NOT NULL, - `email` varchar(100) NOT NULL default '', - `bank_account` varchar(60) NOT NULL default '', - `curr_code` char(3) default NULL, - `payment_terms` int(11) default NULL, - `dimension_id` int(11) default '0', - `dimension2_id` int(11) default '0', - `tax_group_id` int(11) default NULL, - `purchase_account` varchar(11) default NULL, - `payable_account` varchar(11) default NULL, - `payment_discount_account` varchar(11) default NULL, - PRIMARY KEY (`supplier_id`) -) TYPE=MyISAM AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_supp_allocations` --- +### Structure of table `0_supp_allocations` ### DROP TABLE IF EXISTS `0_supp_allocations`; -CREATE TABLE IF NOT EXISTS `0_supp_allocations` ( + +CREATE TABLE `0_supp_allocations` ( `id` int(11) NOT NULL auto_increment, `amt` double unsigned default NULL, `date_alloc` date NOT NULL default '0000-00-00', @@ -948,16 +1303,18 @@ CREATE TABLE IF NOT EXISTS `0_supp_allocations` ( `trans_no_to` int(11) default NULL, `trans_type_to` int(11) default NULL, PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; +) TYPE=InnoDB AUTO_INCREMENT=1 ; + + +### Data of table `0_supp_allocations` ### --- -------------------------------------------------------- --- --- Table structure for table `0_supp_invoice_items` --- + +### Structure of table `0_supp_invoice_items` ### DROP TABLE IF EXISTS `0_supp_invoice_items`; -CREATE TABLE IF NOT EXISTS `0_supp_invoice_items` ( + +CREATE TABLE `0_supp_invoice_items` ( `id` int(11) NOT NULL auto_increment, `supp_trans_no` int(11) default NULL, `supp_trans_type` int(11) default NULL, @@ -971,35 +1328,18 @@ CREATE TABLE IF NOT EXISTS `0_supp_invoice_items` ( `unit_tax` double NOT NULL default '0', `memo_` tinytext, PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; +) TYPE=InnoDB AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_supp_invoice_tax_items` --- +### Data of table `0_supp_invoice_items` ### -DROP TABLE IF EXISTS `0_supp_invoice_tax_items`; -CREATE TABLE IF NOT EXISTS `0_supp_invoice_tax_items` ( - `id` int(11) NOT NULL auto_increment, - `supp_trans_no` int(11) default NULL, - `supp_trans_type` int(11) default NULL, - `tax_type_id` int(11) NOT NULL default '0', - `tax_type_name` varchar(60) default NULL, - `rate` double NOT NULL default '0', - `included_in_price` tinyint(1) NOT NULL default '0', - `amount` double NOT NULL default '0', - PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_supp_trans` --- +### Structure of table `0_supp_trans` ### DROP TABLE IF EXISTS `0_supp_trans`; -CREATE TABLE IF NOT EXISTS `0_supp_trans` ( + +CREATE TABLE `0_supp_trans` ( `trans_no` int(11) unsigned NOT NULL default '0', `type` smallint(6) unsigned NOT NULL default '0', `supplier_id` int(11) unsigned default NULL, @@ -1016,60 +1356,125 @@ CREATE TABLE IF NOT EXISTS `0_supp_trans` ( KEY `supplier_id` (`supplier_id`), KEY `SupplierID_2` (`supplier_id`,`supp_reference`), KEY `type` (`type`) -) TYPE=InnoDB; +) TYPE=InnoDB ; + + +### Data of table `0_supp_trans` ### + + + +### Structure of table `0_suppliers` ### + +DROP TABLE IF EXISTS `0_suppliers`; + +CREATE TABLE `0_suppliers` ( + `supplier_id` int(11) NOT NULL auto_increment, + `supp_name` varchar(60) NOT NULL default '', + `address` tinytext NOT NULL, + `supp_address` tinytext NOT NULL, + `phone` varchar(30) NOT NULL default '', + `fax` varchar(30) NOT NULL default '', + `gst_no` varchar(25) NOT NULL default '', + `contact` varchar(60) NOT NULL default '', + `supp_account_no` varchar(40) NOT NULL default '', + `email` varchar(100) NOT NULL default '', + `website` varchar(100) NOT NULL default '', + `bank_account` varchar(60) NOT NULL default '', + `curr_code` char(3) default NULL, + `payment_terms` int(11) default NULL, + `dimension_id` int(11) default '0', + `dimension2_id` int(11) default '0', + `tax_group_id` int(11) default NULL, + `credit_limit` double NOT NULL default '0', + `purchase_account` varchar(11) default NULL, + `payable_account` varchar(11) default NULL, + `payment_discount_account` varchar(11) default NULL, + `notes` tinytext NOT NULL, + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`supplier_id`) +) TYPE=MyISAM AUTO_INCREMENT=1 ; + + +### Data of table `0_suppliers` ### --- -------------------------------------------------------- --- --- Table structure for table `0_sys_types` --- + +### Structure of table `0_sys_types` ### DROP TABLE IF EXISTS `0_sys_types`; -CREATE TABLE IF NOT EXISTS `0_sys_types` ( + +CREATE TABLE `0_sys_types` ( `type_id` smallint(6) NOT NULL default '0', `type_name` varchar(60) NOT NULL default '', `type_no` int(11) NOT NULL default '1', `next_reference` varchar(100) NOT NULL default '', PRIMARY KEY (`type_id`) -) TYPE=InnoDB; +) TYPE=InnoDB ; + + +### Data of table `0_sys_types` ### + +INSERT INTO `0_sys_types` VALUES ('0', 'Journal - GL', '17', '1'); +INSERT INTO `0_sys_types` VALUES ('1', 'Payment - GL', '7', '1'); +INSERT INTO `0_sys_types` VALUES ('2', 'Receipt - GL', '4', '1'); +INSERT INTO `0_sys_types` VALUES ('4', 'Funds Transfer', '3', '1'); +INSERT INTO `0_sys_types` VALUES ('10', 'Sales Invoice', '16', '1'); +INSERT INTO `0_sys_types` VALUES ('11', 'Credit Note', '2', '1'); +INSERT INTO `0_sys_types` VALUES ('12', 'Receipt', '6', '1'); +INSERT INTO `0_sys_types` VALUES ('13', 'Delivery', '1', '1'); +INSERT INTO `0_sys_types` VALUES ('16', 'Location Transfer', '2', '1'); +INSERT INTO `0_sys_types` VALUES ('17', 'Inventory Adjustment', '2', '1'); +INSERT INTO `0_sys_types` VALUES ('18', 'Purchase Order', '1', '1'); +INSERT INTO `0_sys_types` VALUES ('20', 'Supplier Invoice', '6', '1'); +INSERT INTO `0_sys_types` VALUES ('21', 'Supplier Credit Note', '1', '1'); +INSERT INTO `0_sys_types` VALUES ('22', 'Supplier Payment', '3', '1'); +INSERT INTO `0_sys_types` VALUES ('25', 'Purchase Order Delivery', '1', '1'); +INSERT INTO `0_sys_types` VALUES ('26', 'Work Order', '1', '1'); +INSERT INTO `0_sys_types` VALUES ('28', 'Work Order Issue', '1', '1'); +INSERT INTO `0_sys_types` VALUES ('29', 'Work Order Production', '1', '1'); +INSERT INTO `0_sys_types` VALUES ('30', 'Sales Order', '1', '1'); +INSERT INTO `0_sys_types` VALUES ('35', 'Cost Update', '1', '1'); +INSERT INTO `0_sys_types` VALUES ('40', 'Dimension', '1', '1'); + + +### Structure of table `0_tax_group_items` ### + +DROP TABLE IF EXISTS `0_tax_group_items`; + +CREATE TABLE `0_tax_group_items` ( + `tax_group_id` int(11) NOT NULL default '0', + `tax_type_id` int(11) NOT NULL default '0', + `rate` double NOT NULL default '0', + PRIMARY KEY (`tax_group_id`,`tax_type_id`) +) TYPE=InnoDB ; + + +### Data of table `0_tax_group_items` ### + --- -------------------------------------------------------- --- --- Table structure for table `0_tax_groups` --- +### Structure of table `0_tax_groups` ### DROP TABLE IF EXISTS `0_tax_groups`; -CREATE TABLE IF NOT EXISTS `0_tax_groups` ( + +CREATE TABLE `0_tax_groups` ( `id` int(11) NOT NULL auto_increment, `name` varchar(60) NOT NULL default '', `tax_shipping` tinyint(1) NOT NULL default '0', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; +) TYPE=InnoDB AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_tax_group_items` --- +### Data of table `0_tax_groups` ### -DROP TABLE IF EXISTS `0_tax_group_items`; -CREATE TABLE IF NOT EXISTS `0_tax_group_items` ( - `tax_group_id` int(11) NOT NULL default '0', - `tax_type_id` int(11) NOT NULL default '0', - `rate` double NOT NULL default '0', - PRIMARY KEY (`tax_group_id`,`tax_type_id`) -) TYPE=InnoDB; --- -------------------------------------------------------- --- --- Table structure for table `0_tax_types` --- +### Structure of table `0_tax_types` ### DROP TABLE IF EXISTS `0_tax_types`; -CREATE TABLE IF NOT EXISTS `0_tax_types` ( + +CREATE TABLE `0_tax_types` ( `id` int(11) NOT NULL auto_increment, `rate` double NOT NULL default '0', `sales_gl_code` varchar(11) NOT NULL default '', @@ -1077,16 +1482,42 @@ CREATE TABLE IF NOT EXISTS `0_tax_types` ( `name` varchar(60) NOT NULL default '', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`,`rate`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; +) TYPE=InnoDB AUTO_INCREMENT=1 ; + + +### Data of table `0_tax_types` ### + --- -------------------------------------------------------- --- --- Table structure for table `0_users` --- +### Structure of table `0_trans_tax_details` ### + +DROP TABLE IF EXISTS `0_trans_tax_details`; + +CREATE TABLE `0_trans_tax_details` ( + `id` int(11) NOT NULL auto_increment, + `trans_type` smallint(6) default NULL, + `trans_no` int(11) default NULL, + `tran_date` date NOT NULL, + `tax_type_id` int(11) NOT NULL default '0', + `rate` double NOT NULL default '0', + `ex_rate` double NOT NULL default '1', + `included_in_price` tinyint(1) NOT NULL default '0', + `net_amount` double NOT NULL default '0', + `amount` double NOT NULL default '0', + `memo` tinytext, + PRIMARY KEY (`id`) +) TYPE=InnoDB AUTO_INCREMENT=1 ; + + +### Data of table `0_trans_tax_details` ### + + + +### Structure of table `0_users` ### DROP TABLE IF EXISTS `0_users`; -CREATE TABLE IF NOT EXISTS `0_users` ( + +CREATE TABLE `0_users` ( `user_id` varchar(60) NOT NULL default '', `password` varchar(100) NOT NULL default '', `real_name` varchar(100) NOT NULL default '', @@ -1108,72 +1539,59 @@ CREATE TABLE IF NOT EXISTS `0_users` ( `show_codes` tinyint(1) NOT NULL default '0', `show_hints` tinyint(1) NOT NULL default '0', `last_visit_date` datetime default NULL, + `query_size` tinyint(1) default '10', + `graphic_links` tinyint(1) default '1', + `pos` smallint(6) default '1', + `print_profile` varchar(30) NOT NULL default '1', + `rep_popup` tinyint(1) default '1', PRIMARY KEY (`user_id`) -) TYPE=MyISAM; +) TYPE=MyISAM ; --- -------------------------------------------------------- --- --- Table structure for table `0_voided` --- +### Data of table `0_users` ### + +INSERT INTO `0_users` VALUES ('admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', '2', '', 'adm@adm.com', 'en_US', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '4', '1', '1', '0', '0', '2008-04-04 12:34:29', '10', '1', '1', '1', '1'); + + +### Structure of table `0_voided` ### DROP TABLE IF EXISTS `0_voided`; -CREATE TABLE IF NOT EXISTS `0_voided` ( + +CREATE TABLE `0_voided` ( `type` int(11) NOT NULL default '0', `id` int(11) NOT NULL default '0', `date_` date NOT NULL default '0000-00-00', `memo_` tinytext NOT NULL, UNIQUE KEY `id` (`type`,`id`) -) TYPE=InnoDB; +) TYPE=InnoDB ; --- -------------------------------------------------------- --- --- Table structure for table `0_workcentres` --- +### Data of table `0_voided` ### -DROP TABLE IF EXISTS `0_workcentres`; -CREATE TABLE IF NOT EXISTS `0_workcentres` ( - `id` int(11) NOT NULL auto_increment, - `name` char(40) NOT NULL default '', - `description` char(50) NOT NULL default '', - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) TYPE=MyISAM AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_workorders` --- +### Structure of table `0_wo_issue_items` ### -DROP TABLE IF EXISTS `0_workorders`; -CREATE TABLE IF NOT EXISTS `0_workorders` ( +DROP TABLE IF EXISTS `0_wo_issue_items`; + +CREATE TABLE `0_wo_issue_items` ( `id` int(11) NOT NULL auto_increment, - `wo_ref` varchar(60) NOT NULL default '', - `loc_code` varchar(5) NOT NULL default '', - `units_reqd` double NOT NULL default '1', - `stock_id` varchar(20) NOT NULL default '', - `date_` date NOT NULL default '0000-00-00', - `type` tinyint(4) NOT NULL default '0', - `required_by` date NOT NULL default '0000-00-00', - `released_date` date NOT NULL default '0000-00-00', - `units_issued` double NOT NULL default '0', - `closed` tinyint(1) NOT NULL default '0', - `released` tinyint(1) NOT NULL default '0', - `additional_costs` double NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `wo_ref` (`wo_ref`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; + `stock_id` varchar(40) default NULL, + `issue_id` int(11) default NULL, + `qty_issued` double default NULL, + PRIMARY KEY (`id`) +) TYPE=InnoDB AUTO_INCREMENT=1 ; + + +### Data of table `0_wo_issue_items` ### --- -------------------------------------------------------- --- --- Table structure for table `0_wo_issues` --- + +### Structure of table `0_wo_issues` ### DROP TABLE IF EXISTS `0_wo_issues`; -CREATE TABLE IF NOT EXISTS `0_wo_issues` ( + +CREATE TABLE `0_wo_issues` ( `issue_no` int(11) NOT NULL auto_increment, `workorder_id` int(11) NOT NULL default '0', `reference` varchar(100) default NULL, @@ -1181,47 +1599,36 @@ CREATE TABLE IF NOT EXISTS `0_wo_issues` ( `loc_code` varchar(5) default NULL, `workcentre_id` int(11) default NULL, PRIMARY KEY (`issue_no`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; +) TYPE=InnoDB AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_wo_issue_items` --- +### Data of table `0_wo_issues` ### -DROP TABLE IF EXISTS `0_wo_issue_items`; -CREATE TABLE IF NOT EXISTS `0_wo_issue_items` ( - `id` int(11) NOT NULL auto_increment, - `stock_id` varchar(40) default NULL, - `issue_id` int(11) default NULL, - `qty_issued` double default NULL, - PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; --- -------------------------------------------------------- --- --- Table structure for table `0_wo_manufacture` --- +### Structure of table `0_wo_manufacture` ### DROP TABLE IF EXISTS `0_wo_manufacture`; -CREATE TABLE IF NOT EXISTS `0_wo_manufacture` ( + +CREATE TABLE `0_wo_manufacture` ( `id` int(11) NOT NULL auto_increment, `reference` varchar(100) default NULL, `workorder_id` int(11) NOT NULL default '0', `quantity` double NOT NULL default '0', `date_` date NOT NULL default '0000-00-00', PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; +) TYPE=InnoDB AUTO_INCREMENT=1 ; + + +### Data of table `0_wo_manufacture` ### + --- -------------------------------------------------------- --- --- Table structure for table `0_wo_requirements` --- +### Structure of table `0_wo_requirements` ### DROP TABLE IF EXISTS `0_wo_requirements`; -CREATE TABLE IF NOT EXISTS `0_wo_requirements` ( + +CREATE TABLE `0_wo_requirements` ( `id` int(11) NOT NULL auto_increment, `workorder_id` int(11) NOT NULL default '0', `stock_id` char(20) NOT NULL default '', @@ -1231,215 +1638,53 @@ CREATE TABLE IF NOT EXISTS `0_wo_requirements` ( `loc_code` char(5) NOT NULL default '', `units_issued` double NOT NULL default '0', PRIMARY KEY (`id`) -) TYPE=InnoDB AUTO_INCREMENT=1 ; - --- --- Dumping data for table `0_areas` --- - -INSERT INTO `0_areas` VALUES(1, 'USA'); - --- --- Dumping data for table `0_bank_accounts` --- - -INSERT INTO `0_bank_accounts` VALUES('1700', 0, 'Current account', 'N/A', 'N/A', NULL, 'USD'); -INSERT INTO `0_bank_accounts` VALUES('1705', 0, 'Petty Cash account', 'N/A', 'N/A', NULL, 'USD'); - --- --- Dumping data for table `0_bank_trans_types` --- - -INSERT INTO `0_bank_trans_types` VALUES(1, 'Cash'); -INSERT INTO `0_bank_trans_types` VALUES(2, 'Transfer'); - --- --- Dumping data for table `0_chart_class` --- - -INSERT INTO `0_chart_class` VALUES(1, 'Assets', 1); -INSERT INTO `0_chart_class` VALUES(2, 'Liabilities', 1); -INSERT INTO `0_chart_class` VALUES(3, 'Income', 0); -INSERT INTO `0_chart_class` VALUES(4, 'Costs', 0); - --- --- Dumping data for table `0_chart_master` --- - -INSERT INTO `0_chart_master` VALUES('3000', NULL, 'Sales', 1, 1); -INSERT INTO `0_chart_master` VALUES('3010', NULL, 'Sales - Wholesale', 1, 1); -INSERT INTO `0_chart_master` VALUES('3020', NULL, 'Sales of Other items', 1, 1); -INSERT INTO `0_chart_master` VALUES('3400', NULL, 'Difference On Exchange', 1, 0); -INSERT INTO `0_chart_master` VALUES('5000', NULL, 'Direct Labour', 2, 0); -INSERT INTO `0_chart_master` VALUES('5050', NULL, 'Direct Labour Recovery', 2, 0); -INSERT INTO `0_chart_master` VALUES('4200', NULL, 'Material Usage Varaiance', 2, 4); -INSERT INTO `0_chart_master` VALUES('4210', NULL, 'Consumable Materials', 2, 4); -INSERT INTO `0_chart_master` VALUES('4220', NULL, 'Purchase price Variance', 2, 0); -INSERT INTO `0_chart_master` VALUES('4000', NULL, 'Purchases of materials', 2, 4); -INSERT INTO `0_chart_master` VALUES('4250', NULL, 'Discounts Received', 2, 0); -INSERT INTO `0_chart_master` VALUES('4260', NULL, 'Exchange Variation', 2, 0); -INSERT INTO `0_chart_master` VALUES('4300', NULL, 'Freight Inwards', 2, 4); -INSERT INTO `0_chart_master` VALUES('4010', NULL, 'Cost of Goods Sold - Retail', 2, 4); -INSERT INTO `0_chart_master` VALUES('6790', NULL, 'Bank Charges', 5, 4); -INSERT INTO `0_chart_master` VALUES('6800', NULL, 'Entertainments', 5, 4); -INSERT INTO `0_chart_master` VALUES('6810', NULL, 'Legal Expenses', 5, 4); -INSERT INTO `0_chart_master` VALUES('6600', NULL, 'Repairs and Maintenance Office', 5, 4); -INSERT INTO `0_chart_master` VALUES('6730', NULL, 'phone', 5, 4); -INSERT INTO `0_chart_master` VALUES('8200', NULL, 'Bank Interest', 52, 0); -INSERT INTO `0_chart_master` VALUES('6840', NULL, 'Credit Control', 5, 0); -INSERT INTO `0_chart_master` VALUES('7040', NULL, 'Depreciation Office Equipment', 51, 0); -INSERT INTO `0_chart_master` VALUES('3800', NULL, 'Freight Outwards', 5, 4); -INSERT INTO `0_chart_master` VALUES('4500', NULL, 'Packaging', 5, 4); -INSERT INTO `0_chart_master` VALUES('6400', NULL, 'Commissions', 5, 0); -INSERT INTO `0_chart_master` VALUES('3200', NULL, 'Prompt Payment Discounts', 1, 0); -INSERT INTO `0_chart_master` VALUES('6700', NULL, 'General Expenses', 5, 4); -INSERT INTO `0_chart_master` VALUES('5200', NULL, 'Indirect Labour', 2, 0); -INSERT INTO `0_chart_master` VALUES('5210', NULL, 'Overhead Recovery', 5, 0); -INSERT INTO `0_chart_master` VALUES('1700', NULL, 'Bank account', 10, 0); -INSERT INTO `0_chart_master` VALUES('1705', NULL, 'Petty Cash', 10, 0); -INSERT INTO `0_chart_master` VALUES('1710', NULL, 'Foreign currency account', 10, 0); -INSERT INTO `0_chart_master` VALUES('1500', NULL, 'Accounts Receivable', 20, 0); -INSERT INTO `0_chart_master` VALUES('1400', NULL, 'Stocks of Raw Materials', 45, 0); -INSERT INTO `0_chart_master` VALUES('1410', NULL, 'Stocks of Work In Progress', 45, 0); -INSERT INTO `0_chart_master` VALUES('1420', NULL, 'Stocks of Finsihed Goods', 45, 0); -INSERT INTO `0_chart_master` VALUES('1430', NULL, 'Goods Received Clearing account', 30, 0); -INSERT INTO `0_chart_master` VALUES('2630', NULL, 'Accounts Payable', 30, 0); -INSERT INTO `0_chart_master` VALUES('2660', NULL, 'VAT out 5', 30, 0); -INSERT INTO `0_chart_master` VALUES('2662', NULL, 'VAT out 1', 30, 0); -INSERT INTO `0_chart_master` VALUES('2664', NULL, 'VAT out 25', 30, 0); -INSERT INTO `0_chart_master` VALUES('2680', NULL, 'VAT In 5', 30, 0); -INSERT INTO `0_chart_master` VALUES('2682', NULL, 'VAT In 25', 30, 0); -INSERT INTO `0_chart_master` VALUES('2050', NULL, 'Retained Earnings', 50, 0); -INSERT INTO `0_chart_master` VALUES('2000', NULL, 'Share Capital', 50, 0); - --- --- Dumping data for table `0_chart_types` --- - -INSERT INTO `0_chart_types` VALUES(1, 'Sales', 3, -1); -INSERT INTO `0_chart_types` VALUES(2, 'Cost of Sales', 4, -1); -INSERT INTO `0_chart_types` VALUES(5, 'Expenses', 4, -1); -INSERT INTO `0_chart_types` VALUES(10, 'Cash/Bank', 1, -1); -INSERT INTO `0_chart_types` VALUES(20, 'Accounts Receivable', 1, -1); -INSERT INTO `0_chart_types` VALUES(30, 'Accounts Payable', 2, -1); -INSERT INTO `0_chart_types` VALUES(40, 'Fixed Assets', 1, -1); -INSERT INTO `0_chart_types` VALUES(45, 'Inventory', 1, -1); -INSERT INTO `0_chart_types` VALUES(50, 'Equity', 2, -1); -INSERT INTO `0_chart_types` VALUES(51, 'Depreciations', 4, -1); -INSERT INTO `0_chart_types` VALUES(52, 'Financials', 4, -1); - --- --- Dumping data for table `0_company` --- - -INSERT INTO `0_company` VALUES(1, 'Company name', '', '', 1, 1, 'N/A', '', '', '', '', '', 'USD', '1500', '4250', '2630', '1430', '4260', '4220', '2050', '3800', '3000', '3000', '3200', '1420', '4010', '4210', '3000', '1410', '5000', '', '', '', '', '', '', 0, 10, 10, 1000, 20, 20, 30, 1, 1, 0, 0, 0, -1); - --- --- Dumping data for table `0_credit_status` --- - -INSERT INTO `0_credit_status` VALUES(1, 'Good History', 0); -INSERT INTO `0_credit_status` VALUES(3, 'No more work until payment received', 1); -INSERT INTO `0_credit_status` VALUES(4, 'In liquidation', 1); - --- --- Dumping data for table `0_currencies` --- - -INSERT INTO `0_currencies` VALUES('Euro', 'EUR', '?', 'Europe', 'Cents'); -INSERT INTO `0_currencies` VALUES('Pounds', 'GBP', '?', 'England', 'Pence'); -INSERT INTO `0_currencies` VALUES('US Dollars', 'USD', '$', 'United States', 'Cents'); - --- --- Dumping data for table `0_fiscal_year` --- - -INSERT INTO `0_fiscal_year` VALUES(1, '2008-01-01', '2008-12-31', 0); - --- --- Dumping data for table `0_item_units` --- - -INSERT INTO `0_item_units` VALUES('ea.', 'Each', 0); - --- --- Dumping data for table `0_locations` --- - -INSERT INTO `0_locations` VALUES('DEF', 'Default', 'N/A', '', '', '', ''); - --- --- Dumping data for table `0_movement_types` --- - -INSERT INTO `0_movement_types` VALUES(1, 'Adjustment'); - --- --- Dumping data for table `0_payment_terms` --- - -INSERT INTO `0_payment_terms` VALUES(1, 'Due 15th Of the Following Month', 0, 17); -INSERT INTO `0_payment_terms` VALUES(2, 'Due By End Of The Following Month', 0, 30); -INSERT INTO `0_payment_terms` VALUES(3, 'Payment due within 10 days', 10, 0); -INSERT INTO `0_payment_terms` VALUES(4, 'Cash Only', 1, 0); - --- --- Dumping data for table `0_salesman` --- - -INSERT INTO `0_salesman` VALUES(1, 'Sales Person', '', '', '', 5, 1000, 4); - --- --- Dumping data for table `0_sales_types` --- - -INSERT INTO `0_sales_types` VALUES(1, 'Retail', 0, 1); -INSERT INTO `0_sales_types` VALUES(2, 'Wholesale', 0, 1); - --- --- Dumping data for table `0_shippers` --- - -INSERT INTO `0_shippers` VALUES(1, 'Default', '', '', ''); - --- --- Dumping data for table `0_stock_category` --- - -INSERT INTO `0_stock_category` VALUES(1, 'Components', NULL, NULL, NULL, NULL); -INSERT INTO `0_stock_category` VALUES(2, 'Charges', NULL, NULL, NULL, NULL); -INSERT INTO `0_stock_category` VALUES(3, 'Systems', NULL, NULL, NULL, NULL); -INSERT INTO `0_stock_category` VALUES(4, 'Services', NULL, NULL, NULL, NULL); - --- --- Dumping data for table `0_sys_types` --- - -INSERT INTO `0_sys_types` VALUES(0, 'Journal - GL', 17, '1'); -INSERT INTO `0_sys_types` VALUES(1, 'Payment - GL', 7, '1'); -INSERT INTO `0_sys_types` VALUES(2, 'Receipt - GL', 4, '1'); -INSERT INTO `0_sys_types` VALUES(4, 'Funds Transfer', 3, '1'); -INSERT INTO `0_sys_types` VALUES(10, 'Sales Invoice', 16, '1'); -INSERT INTO `0_sys_types` VALUES(11, 'Credit Note', 2, '1'); -INSERT INTO `0_sys_types` VALUES(12, 'Receipt', 6, '1'); -INSERT INTO `0_sys_types` VALUES(13, 'Delivery', 1, '1'); -INSERT INTO `0_sys_types` VALUES(16, 'Location Transfer', 2, '1'); -INSERT INTO `0_sys_types` VALUES(17, 'Inventory Adjustment', 2, '1'); -INSERT INTO `0_sys_types` VALUES(18, 'Purchase Order', 1, '1'); -INSERT INTO `0_sys_types` VALUES(20, 'Supplier Invoice', 6, '1'); -INSERT INTO `0_sys_types` VALUES(21, 'Supplier Credit Note', 1, '1'); -INSERT INTO `0_sys_types` VALUES(22, 'Supplier Payment', 3, '1'); -INSERT INTO `0_sys_types` VALUES(25, 'Purchase Order Delivery', 1, '1'); -INSERT INTO `0_sys_types` VALUES(26, 'Work Order', 1, '1'); -INSERT INTO `0_sys_types` VALUES(28, 'Work Order Issue', 1, '1'); -INSERT INTO `0_sys_types` VALUES(29, 'Work Order Production', 1, '1'); -INSERT INTO `0_sys_types` VALUES(30, 'Sales Order', 1, '1'); -INSERT INTO `0_sys_types` VALUES(35, 'Cost Update', 1, '1'); -INSERT INTO `0_sys_types` VALUES(40, 'Dimension', 1, '1'); - --- --- Dumping data for table `0_users` --- - -INSERT INTO `0_users` VALUES('admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', 2, '', 'adm@adm.com', 'en_US', 0, 0, 0, 0, 'default', 'Letter', 2, 2, 4, 1, 1, 0, 0, '2008-04-04 12:34:29'); +) TYPE=InnoDB AUTO_INCREMENT=1 ; + + +### Data of table `0_wo_requirements` ### + + + +### Structure of table `0_workcentres` ### + +DROP TABLE IF EXISTS `0_workcentres`; + +CREATE TABLE `0_workcentres` ( + `id` int(11) NOT NULL auto_increment, + `name` char(40) NOT NULL default '', + `description` char(50) NOT NULL default '', + `inactive` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) TYPE=MyISAM AUTO_INCREMENT=1 ; + + +### Data of table `0_workcentres` ### + + + +### Structure of table `0_workorders` ### + +DROP TABLE IF EXISTS `0_workorders`; + +CREATE TABLE `0_workorders` ( + `id` int(11) NOT NULL auto_increment, + `wo_ref` varchar(60) NOT NULL default '', + `loc_code` varchar(5) NOT NULL default '', + `units_reqd` double NOT NULL default '1', + `stock_id` varchar(20) NOT NULL default '', + `date_` date NOT NULL default '0000-00-00', + `type` tinyint(4) NOT NULL default '0', + `required_by` date NOT NULL default '0000-00-00', + `released_date` date NOT NULL default '0000-00-00', + `units_issued` double NOT NULL default '0', + `closed` tinyint(1) NOT NULL default '0', + `released` tinyint(1) NOT NULL default '0', + `additional_costs` double NOT NULL default '0', + PRIMARY KEY (`id`), + UNIQUE KEY `wo_ref` (`wo_ref`) +) TYPE=InnoDB AUTO_INCREMENT=1 ; + + +### Data of table `0_workorders` ### diff --git a/taxes/db/item_tax_types_db.inc b/taxes/db/item_tax_types_db.inc index 24a5eedd..3a99f9ba 100644 --- a/taxes/db/item_tax_types_db.inc +++ b/taxes/db/item_tax_types_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ function add_item_tax_type($name, $exempt, $exempt_from) { begin_transaction(); diff --git a/taxes/db/tax_groups_db.inc b/taxes/db/tax_groups_db.inc index 10f0256a..5abe4333 100644 --- a/taxes/db/tax_groups_db.inc +++ b/taxes/db/tax_groups_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ function clear_shipping_tax_group() { $sql = "UPDATE ".TB_PREF."tax_groups SET tax_shipping=0 WHERE 1"; db_query($sql, "could not update tax_shipping fields"); diff --git a/taxes/db/tax_types_db.inc b/taxes/db/tax_types_db.inc index 5cd18ebb..97a62329 100644 --- a/taxes/db/tax_types_db.inc +++ b/taxes/db/tax_types_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ function add_tax_type($name, $sales_gl_code, $purchasing_gl_code, $rate) { $sql = "INSERT INTO ".TB_PREF."tax_types (name, sales_gl_code, purchasing_gl_code, rate) diff --git a/taxes/item_tax_types.php b/taxes/item_tax_types.php index 31237f81..91f21c97 100644 --- a/taxes/item_tax_types.php +++ b/taxes/item_tax_types.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $path_to_root = ".."; $page_security = 3; @@ -122,7 +131,7 @@ while ($myrow = db_fetch($result2)) label_cell($myrow["name"]); label_cell($disallow_text); edit_button_cell("Edit".$myrow["id"], _("Edit")); - edit_button_cell("Delete".$myrow["id"], _("Delete")); + delete_button_cell("Delete".$myrow["id"], _("Delete")); end_row(); } diff --git a/taxes/tax_calc.inc b/taxes/tax_calc.inc index acc8f0f0..397c5f50 100644 --- a/taxes/tax_calc.inc +++ b/taxes/tax_calc.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ include_once($path_to_root . "/taxes/db/tax_groups_db.inc"); include_once($path_to_root . "/taxes/db/tax_types_db.inc"); include_once($path_to_root . "/taxes/db/item_tax_types_db.inc"); @@ -164,7 +173,10 @@ function get_tax_for_items($items, $prices, $shipping_cost, $tax_group, $tax_inc $ret_tax_array = $tax_items_array; else $ret_tax_array = get_tax_group_items_as_array($tax_group); - + + foreach($ret_tax_array as $k=>$t) + $ret_tax_array[$k]['Net'] = 0; + // loop for all items for ($i = 0; $i < count($items); $i++) { @@ -175,14 +187,17 @@ function get_tax_for_items($items, $prices, $shipping_cost, $tax_group, $tax_inc foreach ($item_taxes as $item_tax) { $index = $item_tax['tax_type_id']; - if($tax_included==1) // 2008-11-26 Joe Hunt Taxes are stored without roundings + if($tax_included==1) {// 2008-11-26 Joe Hunt Taxes are stored without roundings //$ret_tax_array[$index]['Value'] += round($prices[$i] * $item_tax['rate'] // / ($item_tax['rate'] + 100), user_price_dec()); $ret_tax_array[$index]['Value'] += ($prices[$i] * $item_tax['rate'] / ($item_tax['rate'] + 100)); - else + $ret_tax_array[$index]['Net'] += ($prices[$i] * 100 / ($item_tax['rate'] + 100)); + } else { //$ret_tax_array[$index]['Value'] += // round($prices[$i] * $item_tax['rate'] / 100, user_price_dec()); $ret_tax_array[$index]['Value'] += ($prices[$i] * $item_tax['rate'] / 100); + $ret_tax_array[$index]['Net'] += $prices[$i]; + } } } } @@ -197,14 +212,17 @@ function get_tax_for_items($items, $prices, $shipping_cost, $tax_group, $tax_inc { $index = $item_tax['tax_type_id']; if(isset($ret_tax_array[$index])) { - if($tax_included==1) // 2008-11-26 Joe Hunt Taxes are stored without roundings + if($tax_included==1) {// 2008-11-26 Joe Hunt Taxes are stored without roundings //$ret_tax_array[$index]['Value'] += round($shipping_cost * $item_tax['rate'] // / ($item_tax['rate'] + 100), user_price_dec()); $ret_tax_array[$index]['Value'] += ($shipping_cost * $item_tax['rate'] / ($item_tax['rate'] + 100)); - else + $ret_tax_array[$index]['Net'] += ($shipping_cost * 100 / ($item_tax['rate'] + 100)); + } else { //$ret_tax_array[$index]['Value'] += // round($shipping_cost * $item_tax['rate'] / 100, user_price_dec()); $ret_tax_array[$index]['Value'] += ($shipping_cost * $item_tax['rate'] / 100); + $ret_tax_array[$index]['Net'] += $shipping_cost; + } } } } @@ -214,6 +232,68 @@ function get_tax_for_items($items, $prices, $shipping_cost, $tax_group, $tax_inc return $ret_tax_array; } +// +// Get all taxes for given tax_type_id. This can be used when +// no tax group exemptions are active (local sales). +// To be used in quick entries. +// +function get_taxes_for_item_tax($tax_type_id) +{ + $item_tax_type = get_item_tax_type($tax_type_id); + + // if the item is exempt from all taxes then return 0 + if ($item_tax_type["exempt"]) + return null; + + // get the exemptions for this item tax type + $item_tax_type_exemptions_db = get_item_tax_type_exemptions($tax_type_id); + + // read them all into an array to minimize db querying + $item_tax_type_exemptions = array(); + while ($item_tax_type_exemp = db_fetch($item_tax_type_exemptions_db)) + { + $item_tax_type_exemptions[] = $item_tax_type_exemp["tax_type_id"]; + } + + $ret_tax_array = array(); + $tax_rates = get_all_tax_types_simple(); + // if any of the taxes are in the exemptions, then skip + while($tax_rate = db_fetch($tax_rates)) + { + + $skip = false; + + // if it's in the exemptions, skip + foreach ($item_tax_type_exemptions as $exemption) + { + if (($tax_rate['id'] == $exemption)) + { + $skip = true; + break; + } + } + + if (!$skip) + { + $index = $tax_rate['id']; + $ret_tax_array[$index] = $tax_rate; + } + } + + return $ret_tax_array; +} + +function is_tax_account($account_code) +{ + $sql= "SELECT id FROM ".TB_PREF."tax_types WHERE + sales_gl_code='$account_code' OR purchasing_gl_code='$account_code'"; + $result = db_query($sql, "checking account is tax account"); + if (db_num_rows($result) > 0) { + $acct = db_fetch($result); + return $acct['id']; + } else + return false; +} ?> \ No newline at end of file diff --git a/taxes/tax_groups.php b/taxes/tax_groups.php index 335691e1..bc947284 100644 --- a/taxes/tax_groups.php +++ b/taxes/tax_groups.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 3; $path_to_root=".."; @@ -154,7 +163,7 @@ while ($myrow = db_fetch($result)) echo "" . $myrow["type" . $i] . "\n"; if (!$no_menu) { + $applications = $_SESSION['App']->applications; $local_path_to_root = $path_to_root; + $img = ""._(  "; + $himg = ""._(  "; $sel_app = $_SESSION['sel_app']; echo "
"; echo "
"; - foreach($applications as $app => $name) + foreach($applications as $app) { - echo "" .$name . ""; + $acc = access_string($app->name); + echo "id ? "class='selected' " : ""). + "href='$local_path_to_root/index.php?application=".$app->id. + SID ."'$acc[1]>" .$acc[0] . ""; } echo "
"; @@ -47,14 +60,16 @@ echo ""; echo ""; + $indicator = "$path_to_root/themes/".user_theme(). "/images/ajax-loader.gif"; + echo ""; echo "
" . $db_connections[$_SESSION["wa_current_user"]->company]["name"] . " | " . $_SERVER['SERVER_NAME'] . " | " . $_SESSION["wa_current_user"]->name . "" . _("Preferences") . "   \n"; echo " " . _("Change password") . "   \n"; if ($help_base_url != null) { - echo "" . _("Help") . "   "; + echo "$himg" . _("Help") . "   "; } - echo "" . _("Logout") . "   "; + echo "$img" . _("Logout") . "   "; echo "
"; } echo "
"; @@ -112,9 +127,11 @@ function display_applications(&$waapp) { - + global $path_to_root; + $selected_app = $waapp->get_selected_application(); + $img = "  "; foreach ($selected_app->modules as $module) { // image @@ -129,8 +146,16 @@ foreach ($module->lappfunctions as $appfunction) { - if ($_SESSION["wa_current_user"]->can_access_page($appfunction->access)) - echo " " . $appfunction->label . "
"; + if ($_SESSION["wa_current_user"]->can_access_page($appfunction->access)) + { + if ($appfunction->label == "") + echo " 
"; + else + { + $lnk = access_string($appfunction->label); + echo "$img$lnk[0]
"; + } + } } echo "
\n"; if (!$no_menu) { + $applications = $_SESSION['App']->applications; $local_path_to_root = $path_to_root; + $img = ""._(  "; + $himg = ""._(  "; $sel_app = $_SESSION['sel_app']; echo "
"; echo "
"; - foreach($applications as $app => $name) + foreach($applications as $app) { - echo "" .$name . ""; + $acc = access_string($app->name); + echo "id ? "class='selected' " : ""). + "href='$local_path_to_root/index.php?application=".$app->id. + SID ."'$acc[1]>" .$acc[0] . ""; } echo "
"; @@ -47,14 +60,16 @@ echo ""; echo ""; + $indicator = "$path_to_root/themes/".user_theme(). "/images/ajax-loader.gif"; + echo ""; echo "
" . $db_connections[$_SESSION["wa_current_user"]->company]["name"] . " | " . $_SERVER['SERVER_NAME'] . " | " . $_SESSION["wa_current_user"]->name . "" . _("Preferences") . "   \n"; echo " " . _("Change password") . "   \n"; if ($help_base_url != null) { - echo "" . _("Help") . "   "; + echo "$himg" . _("Help") . "   "; } - echo "" . _("Logout") . "   "; + echo "$img" . _("Logout") . "   "; echo "
"; } echo "
"; @@ -112,9 +127,10 @@ function display_applications(&$waapp) { - + global $path_to_root; $selected_app = $waapp->get_selected_application(); + $img = "  "; foreach ($selected_app->modules as $module) { // image @@ -129,8 +145,16 @@ foreach ($module->lappfunctions as $appfunction) { - if ($_SESSION["wa_current_user"]->can_access_page($appfunction->access)) - echo " " . $appfunction->label . "
"; + if ($_SESSION["wa_current_user"]->can_access_page($appfunction->access)) + { + if ($appfunction->label == "") + echo " 
"; + else + { + $lnk = access_string($appfunction->label); + echo "$img$lnk[0]
"; + } + } } echo "
\n"; if (!$no_menu) { + $applications = $_SESSION['App']->applications; $local_path_to_root = $path_to_root; + $img = ""._(  "; + $himg = ""._(  "; $sel_app = $_SESSION['sel_app']; echo "
"; echo "
"; - foreach($applications as $app => $name) + foreach($applications as $app) { - echo "" .$name . ""; + $acc = access_string($app->name); + echo "id ? "class='selected' " : ""). + "href='$local_path_to_root/index.php?application=".$app->id. + SID ."'$acc[1]>" .$acc[0] . ""; } echo "
"; echo "
"; echo ""; echo ""; - + $indicator = "$path_to_root/themes/".user_theme(). "/images/ajax-loader.gif"; + echo ""; echo "
" . $db_connections[$_SESSION["wa_current_user"]->company]["name"] . " | " . $_SERVER['SERVER_NAME'] . " | " . $_SESSION["wa_current_user"]->name . "" . _("Preferences") . "   \n"; echo " " . _("Change password") . "   \n"; if ($help_base_url != null) { - echo "" . _("Help") . "   "; + echo "$himg" . _("Help") . "   "; } - echo "" . _("Logout") . "   "; + echo "$img" . _("Logout") . "   "; echo "
"; } echo "
"; @@ -112,9 +127,11 @@ function display_applications(&$waapp) { + global $path_to_root; $selected_app = $waapp->get_selected_application(); + $img = "  "; foreach ($selected_app->modules as $module) { // image @@ -129,8 +146,16 @@ foreach ($module->lappfunctions as $appfunction) { - if ($_SESSION["wa_current_user"]->can_access_page($appfunction->access)) - echo " " . $appfunction->label . "
"; + if ($_SESSION["wa_current_user"]->can_access_page($appfunction->access)) + { + if ($appfunction->label == "") + echo " 
"; + else + { + $lnk = access_string($appfunction->label); + echo "$img$lnk[0]
"; + } + } } echo ""; if (sizeof($module->rappfunctions) > 0) @@ -138,8 +163,16 @@ echo ""; foreach ($module->rappfunctions as $appfunction) { - if ($_SESSION["wa_current_user"]->can_access_page($appfunction->access)) - echo " " . $appfunction->label . "
"; + if ($_SESSION["wa_current_user"]->can_access_page($appfunction->access)) + { + if ($appfunction->label == "") + echo " 
"; + else + { + $lnk = access_string($appfunction->label); + echo "$img$lnk[0]
"; + } + } } echo ""; } diff --git a/update.html b/update.html index 5a87aafd..38310575 100644 --- a/update.html +++ b/update.html @@ -28,7 +28,7 @@ backup this file if you have done manually changes to it. installed languages)
  • /modules/installed_modules.php (contains information about -installed modules, only vers. 1.1) +installed modules)
  • if you have made changes to other files, like themes or so, backup these files too.
  • @@ -45,15 +45,16 @@ the new file.
  • Rename or remove the /install folder (you have already performed the install process earlier).
  • - -
  • If there are changes to the database structure, please run the script update_db.php -from FrontAccounting root installation, Enter the database user and the -password and choose the update script from the local harddisk.
  • -
  • When updating release 1.XX to release 2.0, you must run the update_db.php script and select the file - alter.sql - that are located in the sql folder. You must -do this, before entering FrontAccounting! -Enter the database user and the password and choose the alter.sql -script.  Do the same for the alter2.sql script. If you have -already updated release 2.0 Beta, you can just run the alter2.sql script.
    You must also manuelly ensure that you have write permission to the new folder /company .
    There are no database changes during a major and minor release. Like from 2.0 to 2.0.1 - 2.0.5 .
  • +
  • When +updating release 2.0.X to release 2.1.X, you must immediately +login on company 0, the first company you created, as admin +(called the superadmin). If you use a theme other than the standard 3, +aqua, cool or default, switch to one of these before going further. You +can download a new one of the new themes on the download page.  Go +to the 'Setup' tab and run 'Software +Upgrade'. +Mark the checkbox 'Install' and press 'Upgrade System'.  This will +upgrade ALL your companies.
  • If something goes wrong during upgrade, you can enter here again and try 'Force Upgrade', and press 'Upgrade System' again.
  • There are no database changes during a major and minor release. Like from 2.1 to 2.1.1 - 2.1.5 .
  •  

    diff --git a/update_db.php b/update_db.php deleted file mode 100644 index 4ebbbc74..00000000 --- a/update_db.php +++ /dev/null @@ -1,174 +0,0 @@ -\n" - . "function fixPNG(myImage)\n" - . "{\n" - . " var arVersion = navigator.appVersion.split(\"MSIE\")\n" - . " var version = parseFloat(arVersion[1])\n" - . " if ((version >= 5.5) && (version < 7) && (document.body.filters))\n" - . " {\n" - . " var imgID = (myImage.id) ? \"id='\" + myImage.id + \"' \" : \"\"\n" - . " var imgClass = (myImage.className) ? \"class='\" + myImage.className + \"' \" : \"\"\n" - . " var imgTitle = (myImage.title) ?\n" - . " \"title='\" + myImage.title + \"' \" : \"title='\" + myImage.alt + \"' \"\n" - . " var imgStyle = \"display:inline-block;\" + myImage.style.cssText\n" - . " var strNewHTML = \"\"\n" - . " myImage.outerHTML = strNewHTML\n" - . " }\n" - . "}\n" - . "\n"; - return $js; -} - -function get_js_set_focus($name) -{ - $js = "\n\n"; - return $js; -} - -function display_error($msg, $center=true) -{ - echo "
    - - - -
    $msg

    \n"; -} - -function display_notification($msg, $center=true) -{ - echo "
    - - - -
    $msg

    \n"; -} - - -function db_open($conn) -{ - $db = mysql_connect($conn["host"] ,$conn["dbuser"], $conn["dbpassword"]); - if (!$db) - return false; - if (!mysql_select_db($conn["dbname"], $db)) - return false; - return $db; -} - -echo "\n"; -echo "$title\n"; -echo "\n"; -echo "\n"; -echo $js; -echo " \n"; -echo ""; - -echo "



    "; -echo "\n"; -echo "\n"; -echo "
    FrontAccounting
    \n"; - -echo "

    "; -echo "
    $title
    \n"; -echo "
    "; - -if (isset($_POST["submit"])) -{ - $perms_ok = is_writable($path_to_root.'/company') && is_writable($path_to_root.'/company/0'); - $checkdirs = $comp_subdirs; - foreach ($checkdirs as $dir) { - $perms_ok &= is_writable($path_to_root.'/company/0/'.$dir); - } - - if (!$perms_ok) { - display_error("'System 'company' directory or any of its subdirectories - is not writable.
    Change webserver access permissions to those - directories."); - } elseif (!isset($_FILES['uploadfile']['tmp_name']) || !is_uploaded_file($_FILES['uploadfile']['tmp_name'])) - { - display_error("You must select an SQL script for update");; - } - else - { - include_once($path_to_root."/config_db.php"); - if (!isset($_POST['user']) || !isset($_POST['passwd']) || $_POST['user'] == "") - { - display_error("You must select a user name and an optional password"); - } - else - { - foreach($db_connections as $id => $conn) - { - $conn['dbuser'] = $_POST['user']; - $conn['dbpassword'] = $_POST['passwd']; - if (!($db = db_open($conn))) - { - display_error("Wrong user name or password - ".mysql_error()); - } - else - { - if (!db_import($_FILES['uploadfile']['tmp_name'], $conn)) - display_error("Bad SQL file or you have already updated the company: " - . $id . " " . $conn['name']." - ".mysql_error()); - else - display_notification("Database has been updated for company: " - . $id . " " . $conn['name']); - } - $cdir = "$path_to_root/company/$id"; - if (!file_exists($cdir)) - { - create_comp_dirs($cdir, $comp_subdirs); - } - } - } - } -} -if (!isset($_POST['passwd'])) - $_POST['passwd'] = ""; -if (!isset($_POST['user'])) - $_POST['user'] = ""; - -echo "
    \n"; - -echo "\n"; - -echo ""; -echo ""; -echo ""; -echo ""; - -echo "
    Database User
    Password
    Upload Script
     
    \n";; - -echo "

    "; -echo "
    Choose from Database update scripts in SQL folder. No Datase is updated without a script.
    \n"; -echo "
    "; - -echo "
    \n"; - -echo "\n"; -?> \ No newline at end of file -- 2.30.2