Moving bugfixes from 2.3 to 2.4 and updated install languages for Denmark and Sweden.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 11 Dec 2015 22:22:20 +0000 (23:22 +0100)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 11 Dec 2015 22:22:20 +0000 (23:22 +0100)
28 files changed:
admin/inst_module.php
gl/includes/db/gl_db_trans.inc
gl/manage/gl_accounts.php
includes/hooks.inc
install/lang/da_DK/LC_MESSAGES/da_DK.mo
install/lang/da_DK/LC_MESSAGES/da_DK.po
install/lang/sv_SE/LC_MESSAGES/sv_SE.mo
install/lang/sv_SE/LC_MESSAGES/sv_SE.po
manufacturing/includes/db/work_order_issues_db.inc
manufacturing/includes/db/work_order_produce_items_db.inc
manufacturing/includes/db/work_orders_db.inc
manufacturing/includes/db/work_orders_quick_db.inc
manufacturing/includes/manufacturing_db.inc
manufacturing/includes/manufacturing_ui.inc
manufacturing/work_order_costs.php
purchasing/includes/db/grn_db.inc
purchasing/includes/po_class.inc
reporting/includes/html_entity_decode_php4.php
reporting/rep107.php
reporting/rep109.php
reporting/rep110.php
reporting/rep111.php
reporting/rep113.php
reporting/rep709.php
sales/view/view_credit.php
sales/view/view_dispatch.php
sales/view/view_invoice.php
sales/view/view_sales_order.php

index 71d6f7424200b1634439de6b4fca394bc159a6db..886ecc91a628f6823879e92a96f172e5dc772f83 100644 (file)
@@ -210,18 +210,10 @@ if (get_post('Refresh')) {
 
        $result = true;
        foreach($exts as $i => $ext) {
-               if ($ext['package'] && ($ext['active'] ^ check_value('Active'.$i))) {
-                       if (check_value('Active'.$i) && !check_src_ext_version($ext['version']))
-                       {
-                               display_warning(sprintf(_("Package '%s' is incompatible with current application version and cannot be activated.\n")
-                                       . _("Check Install/Activate page for newer package version."), $ext['name']));
-                               continue;
-                       }
-                       if (!$ext['active'])
-                               $activated = activate_hooks($ext['package'], $comp);
-                       else
-                               $activated = hook_invoke($ext['package'], check_value('Active'.$i) ?
-                                'activate_extension':'deactivate_extension', $comp, false);
+               if ($ext['package'] && ($ext['active'] ^ check_value('Active'.$i))) 
+               {
+                       $activated = activate_hooks($ext['package'], $comp, !$ext['active']);   // change active state
+
                        if ($activated !== null)
                                $result &= $activated;
                        if ($activated || ($activated === null))
index 9fd072b8daaf1a8b72cffbf2b9c5376d6b2bf450..20c902322c74c9a121d57fa1e93128f6d3f9b80b 100644 (file)
@@ -42,9 +42,9 @@ function add_gl_trans($type, $trans_id, $date_, $account, $dimension, $dimension
                else
                        $memo_ = $_SESSION["wa_current_user"]->username . " - " . $memo_;
        }
-       if (!is_subledger_account($account) || $account==get_company_pref('grn_clearing_act'))
+       if ($type != ST_WORKORDER && (!is_subledger_account($account) || $account==get_company_pref('grn_clearing_act')))
                $person_id = $person_type_id = null;
-
+       
        $sql = "INSERT INTO ".TB_PREF."gl_trans ( type, type_no, tran_date,
                account, dimension_id, dimension2_id, memo_, amount";
 
@@ -206,17 +206,11 @@ function get_gl_trans($type, $trans_id)
 
 function get_gl_wo_cost_trans($trans_id, $cost_type=-1)
 {
-       $sql = "SELECT costing.*, gl.*, chart.account_name, com.memo_ FROM "
-               .TB_PREF."wo_costing costing, "
-               .TB_PREF."gl_trans gl LEFT JOIN ".TB_PREF."comments com ON gl.type=com.type     AND gl.type_no=com.id,"
-               .TB_PREF."chart_master chart
-               WHERE 
-                       costing.workorder_id=".db_escape($trans_id)
-               ."      AND chart.account_code=gl.account
-                       AND gl.type=costing.trans_type
-                       AND gl.type_no=costing.trans_no";
-       if ($cost_type != -1)
-               $sql .= " AND costing.cost_type=".db_escape($cost_type);
+       $sql = "SELECT gl.*, chart.account_name FROM ".TB_PREF."gl_trans gl, ".TB_PREF."chart_master chart
+               WHERE chart.account_code=gl.account AND gl.type=".ST_WORKORDER." AND gl.type_no=".db_escape($trans_id)."
+               AND gl.person_type_id=".PT_WORKORDER;
+       if ($cost_type!= -1)
+               $sql .= " AND gl.person_id=".db_escape($cost_type);
        $sql .= " AND amount < 0";
 
        return db_query($sql, "The gl transactions could not be retrieved");
index 417d51d70b3127c5646bc9a153e4aeeb82b1770d..5bda0dcdff4047d4e6daa5d6b1886fc0b3e8556c 100644 (file)
@@ -63,7 +63,7 @@ if (isset($_POST['add']) || isset($_POST['update']))
                display_error( _("The account name cannot be empty."));
                set_focus('account_name');
        } 
-       elseif (!$SysPrefs->accounts_alpha() && !is_numeric($_POST['account_code'])) 
+       elseif (!$SysPrefs->accounts_alpha() && !preg_match("/^[0-9.]+$/",$_POST['account_code'])) // we only allow 0-9 and a dot
        {
            $input_error = 1;
            display_error( _("The account code must be numeric."));
index 6c6dda32bdc2a3e5922f44884f8b8b59e0a09931..d2096c17004362352f2c95020d1fad6f45955396 100644 (file)
@@ -247,7 +247,7 @@ function install_hooks()
        Non active hooks are not included in $Hooks array, so we can use special function to 
        activate.
 */
-function activate_hooks($ext, $comp)
+function activate_hooks($ext, $comp, $on=true)
 {
        global $Hooks;
 
@@ -261,8 +261,10 @@ function activate_hooks($ext, $comp)
        }
        if (!$hooks)
                return false;
-       else
+       elseif ($on)
                return $hooks->activate_extension($comp, false);
+       else
+               return $hooks->deactivate_extension($comp, false);
 }
 /*
        Calls hook $method defined in extension $ext (if any)
index 824268ac91acc0c7037e38869f912edf9aa3e3bf..1b6dd4fea94d3148696abb56e8975b8754bcf87c 100644 (file)
Binary files a/install/lang/da_DK/LC_MESSAGES/da_DK.mo and b/install/lang/da_DK/LC_MESSAGES/da_DK.mo differ
index 06fd3900dffed4297d79c5a7934cb8ade08cbc47..1d4408fa75de31758b886b8a5917314576fe7f1c 100644 (file)
@@ -52,8 +52,12 @@ msgid "Language"
 msgstr "Sprog"
 
 #: /install/index.php:124
-msgid "Cannot connect to database. User or password is invalid or you have no permittions to create database."
-msgstr "Kan ikke skabe forbindelse til databasen. Enten er brugernavnet eller adgangskoden forkert eller også har du ikke adgang til at skabe databasen"
+msgid ""
+"Cannot connect to database. User or password is invalid or you have no "
+"permittions to create database."
+msgstr ""
+"Kan ikke skabe forbindelse til databasen. Enten er brugernavnet eller "
+"adgangskoden forkert eller også har du ikke adgang til at skabe databasen"
 
 #: /install/index.php:164
 msgid "Cannot save system configuration file 'config.php'."
@@ -68,8 +72,12 @@ msgid "Cannot write to the 'config_db.php' configuration file."
 msgstr "Kan ikke skrive til 'config_db.php' konfigurationsfilen."
 
 #: /install/index.php:177
-msgid "Configuration file 'config_db.php' is not writable. Change its permissions so it is, then re-run installation step."
-msgstr "Konfigurationsfilen 'config_db.php' er ikke skrivbar. Ändre tilladelsen til det og kör installationenstrinet igen."
+msgid ""
+"Configuration file 'config_db.php' is not writable. Change its permissions "
+"so it is, then re-run installation step."
+msgstr ""
+"Konfigurationsfilen 'config_db.php' er ikke skrivbar. Ändre tilladelsen til "
+"det og kör installationenstrinet igen."
 
 #: /install/index.php:216
 msgid "Host name cannot be empty."
@@ -108,8 +116,12 @@ msgid "Select install wizard language:"
 msgstr "Vælg installationswizard sprog:"
 
 #: /install/index.php:328
-msgid "All application preliminary requirements seems to be correct. Please press Continue button below."
-msgstr "Alle programmets behov ser ud til at være dækket. Venligst tryk 'Fortsæt' forneden."
+msgid ""
+"All application preliminary requirements seems to be correct. Please press "
+"Continue button below."
+msgstr ""
+"Alle programmets behov ser ud til at være dækket. Venligst tryk 'Fortsæt' "
+"forneden."
 
 #: /install/index.php:329 /install/index.php:357 /install/index.php:364
 #: /install/index.php:371
@@ -117,8 +129,12 @@ msgid "Continue >>"
 msgstr "Fortsæt >>"
 
 #: /install/index.php:331
-msgid "Application cannot be installed. Please fix problems listed below in red, and press Refresh button."
-msgstr "Programmet kan ikke installeres. Venligst ordne problemerne beskrivet forneden i rødt, og tryk 'Genlæs' knappen."
+msgid ""
+"Application cannot be installed. Please fix problems listed below in red, "
+"and press Refresh button."
+msgstr ""
+"Programmet kan ikke installeres. Venligst ordne problemerne beskrivet "
+"forneden i rødt, og tryk 'Genlæs' knappen."
 
 #: /install/index.php:332
 msgid "Refresh"
@@ -146,7 +162,7 @@ msgstr "Database password:"
 
 #: /install/index.php:348
 msgid "Database Collation:"
-msgstr ""
+msgstr "Database sortering:"
 
 #: /install/index.php:349
 msgid "Use '0_' Table Prefix:"
@@ -171,16 +187,28 @@ msgid "Install Additional COAs from FA Repository:"
 msgstr "Installer yderligere kontoplaner fra FA's lager (Repository):"
 
 #: /install/index.php:353
-msgid "Select collation you want to use. If you are unsure or you will use various languages, select unicode collation."
+msgid ""
+"Select collation you want to use. If you are unsure or you will use various "
+"languages, select unicode collation."
 msgstr ""
+"Vælg database sortering du wil bruge. Om du er usikker eller du vil bruge "
+"forskellige sprog, vælg da unicode sortering."
 
 #: /install/index.php:354
-msgid "Use table prefix if you share selected database for more than one FA company using the same collation."
+msgid ""
+"Use table prefix if you share selected database for more than one FA company "
+"using the same collation."
 msgstr ""
+"Brug tabel prefix of du deler valgt database med mere end et firma som "
+"bruger samme sortering."
 
 #: /install/index.php:355
-msgid "Do not select additional langs nor COAs if you have no working internet connection right now. You can install them later."
-msgstr "Vælg ikke yderligere sprog eller kontoplaner hvis du ikke har en fungerende internet forbindelse lige nu. Du kan installere dem senere."
+msgid ""
+"Do not select additional langs nor COAs if you have no working internet "
+"connection right now. You can install them later."
+msgstr ""
+"Vælg ikke yderligere sprog eller kontoplaner hvis du ikke har en fungerende "
+"internet forbindelse lige nu. Du kan installere dem senere."
 
 #: /install/index.php:356 /install/index.php:363 /install/index.php:370
 #: /install/index.php:394
@@ -225,7 +253,7 @@ msgstr "V
 
 #: /install/index.php:395
 msgid "Start installation process"
-msgstr ""
+msgstr "Påbegynd installationen"
 
 #: /install/index.php:399
 msgid "FrontAccounting ERP has been installed successsfully."
@@ -277,7 +305,7 @@ msgstr "PHP version"
 
 #: /includes/system_tests.inc:50
 msgid "Upgrade PHP to version at least 5.0.0"
-msgstr ""
+msgstr "Opgrader PHP til mindst version 5.0.0 "
 
 #: /includes/system_tests.inc:57
 msgid "Server system"
@@ -418,8 +446,11 @@ msgstr "Database Auth fil"
 
 #: /includes/system_tests.inc:323
 #, php-format
-msgid "'%s' file should be read-only if you do not plan to add or change companies"
-msgstr "'%s' filen må være 'read-only' hvis du ikke har planer om at lægge till eller ændre firmaer."
+msgid ""
+"'%s' file should be read-only if you do not plan to add or change companies"
+msgstr ""
+"'%s' filen må være 'read-only' hvis du ikke har planer om at lægge till "
+"eller ændre firmaer."
 
 #: /includes/system_tests.inc:334
 msgid "Extensions system"
@@ -435,12 +466,19 @@ msgid "Non-standard theme directory '%s' is not writable"
 msgstr "Ikke standard theme mappe '%s' er ikk skrivbar"
 
 #: /includes/system_tests.inc:395
-msgid "OpenSSL PHP extension have to be enabled to use extension repository system."
-msgstr "OpenSSL PHP tillæg må være aktiv for at bruge tillægslagersystemet (FA Repository)"
+msgid ""
+"OpenSSL PHP extension have to be enabled to use extension repository system."
+msgstr ""
+"OpenSSL PHP tillæg må være aktiv for at bruge tillægslagersystemet (FA "
+"Repository)"
 
 #: /includes/system_tests.inc:398
-msgid "OpenSSL have to be available on your server to use extension repository system."
-msgstr "OpenSSL må findes på din server for at bruge tillægslagersystem (FA Repository)"
+msgid ""
+"OpenSSL have to be available on your server to use extension repository "
+"system."
+msgstr ""
+"OpenSSL må findes på din server for at bruge tillægslagersystem (FA "
+"Repository)"
 
 #: /includes/system_tests.inc:421
 msgid "Test"
@@ -469,16 +507,17 @@ msgstr "Intet n
 
 #: /includes/packages.inc:294
 msgid "Cannot download repo index file."
-msgstr ""
+msgstr "Kan ikke downloade repo indeks fil."
 
 #: /includes/packages.inc:306 /includes/packages.inc:343
 #, php-format
 msgid "Cannot delete outdated '%s' file."
-msgstr ""
+msgstr "Kan ikke slette gammel '%s' fil."
 
 #: /includes/packages.inc:310
 msgid "Release file in repository is invalid, or public key is outdated."
-msgstr "Release felt i repository er ugyldig, eller også er public key for gammel."
+msgstr ""
+"Release felt i repository er ugyldig, eller også er public key for gammel."
 
 #: /includes/packages.inc:327
 msgid "Repository version does not match application version."
@@ -487,24 +526,34 @@ msgstr "Repository versionen matcher ikke program versionen."
 #: /includes/packages.inc:335 /includes/packages.inc:377
 #, php-format
 msgid "Cannot download '%s' file."
-msgstr ""
+msgstr "Kan ikke downloade '%s' fil."
 
 #: /includes/packages.inc:347
 #, php-format
-msgid "Security alert: broken index file in repository '%s'. Please inform repository administrator about this issue."
-msgstr "Sikkerhedsadvarsel: Indeks feltet i repository '%s' er brudt. Informer venligst repository administratoren om dette."
+msgid ""
+"Security alert: broken index file in repository '%s'. Please inform "
+"repository administrator about this issue."
+msgstr ""
+"Sikkerhedsadvarsel: Indeks feltet i repository '%s' er brudt. Informer "
+"venligst repository administratoren om dette."
 
 #: /includes/packages.inc:383
 #, php-format
-msgid "Security alert: broken package '%s' in repository. Please inform repository administrator about this issue."
-msgstr "Sikkerhedsadvarsel: Brudt pakke '%s' i repository. Venligst informer repository administratoren om dette."
+msgid ""
+"Security alert: broken package '%s' in repository. Please inform repository "
+"administrator about this issue."
+msgstr ""
+"Sikkerhedsadvarsel: Brudt pakke '%s' i repository. Venligst informer "
+"repository administratoren om dette."
 
 #: /includes/packages.inc:641 /includes/packages.inc:696
 #, php-format
 msgid "Package '%s' not found."
 msgstr "Pakke '%s' findes ikke."
 
-#~ msgid "Use table prefix if you share selected database for more than one FA company."
+#~ msgid ""
+#~ "Use table prefix if you share selected database for more than one FA "
+#~ "company."
 #~ msgstr "Brug tabel prefix hvis du deler databasen med flere FA firmaer."
 
 #~ msgid "Upgrade PHP to version at least 4.3.3"
index 104d2fae8dd7d0dbf6d1545454e84bed562eddc7..cbb9c18534371aaada644c369802e03158fbad45 100644 (file)
Binary files a/install/lang/sv_SE/LC_MESSAGES/sv_SE.mo and b/install/lang/sv_SE/LC_MESSAGES/sv_SE.mo differ
index c9017dfb3e1f64f88e06eb5fe19979fe546c5e9b..b67290e3529a97efeae1b7b26c6acae78bba42cd 100644 (file)
@@ -7,7 +7,7 @@ msgstr ""
 "Project-Id-Version: PACKAGE Version\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2015-12-11 13:17+0100\n"
-"PO-Revision-Date: 2015-05-07 15:03+0100\n"
+"PO-Revision-Date: 2015-12-11 23:12+0100\n"
 "Last-Translator: Joe Hunt <joe.hunt.consulting@gmail.com>\n"
 "Language-Team: Language <LL@li.org>\n"
 "Language: sv_SE\n"
@@ -51,8 +51,12 @@ msgid "Language"
 msgstr "Språk"
 
 #: /install/index.php:124
-msgid "Cannot connect to database. User or password is invalid or you have no permittions to create database."
-msgstr "Kan inte ansluta till databasen. Anvøndarnamnet eller lösenordet är ogiltig eller hu har inte tillgång att skapa databasen."
+msgid ""
+"Cannot connect to database. User or password is invalid or you have no "
+"permittions to create database."
+msgstr ""
+"Kan inte ansluta till databasen. Anvøndarnamnet eller lösenordet är ogiltig "
+"eller hu har inte tillgång att skapa databasen."
 
 #: /install/index.php:164
 msgid "Cannot save system configuration file 'config.php'."
@@ -67,8 +71,12 @@ msgid "Cannot write to the 'config_db.php' configuration file."
 msgstr "Kan inte skriva till 'config_db.php konfigutionsfilen."
 
 #: /install/index.php:177
-msgid "Configuration file 'config_db.php' is not writable. Change its permissions so it is, then re-run installation step."
-msgstr "Konfigurationsfilen 'config_db.php' är inte skrivbar. Ändra så att den ör skrivbar, och kör installationssteget igen."
+msgid ""
+"Configuration file 'config_db.php' is not writable. Change its permissions "
+"so it is, then re-run installation step."
+msgstr ""
+"Konfigurationsfilen 'config_db.php' är inte skrivbar. Ändra så att den ör "
+"skrivbar, och kör installationssteget igen."
 
 #: /install/index.php:216
 msgid "Host name cannot be empty."
@@ -107,8 +115,12 @@ msgid "Select install wizard language:"
 msgstr "Välj installationswizardens språk:"
 
 #: /install/index.php:328
-msgid "All application preliminary requirements seems to be correct. Please press Continue button below."
-msgstr "Alla programmets behov ser ut att vara korrekta. Vänligen tryck Fortsätt knappen nedan."
+msgid ""
+"All application preliminary requirements seems to be correct. Please press "
+"Continue button below."
+msgstr ""
+"Alla programmets behov ser ut att vara korrekta. Vänligen tryck Fortsätt "
+"knappen nedan."
 
 #: /install/index.php:329 /install/index.php:357 /install/index.php:364
 #: /install/index.php:371
@@ -116,8 +128,12 @@ msgid "Continue >>"
 msgstr "Fortsätt >>"
 
 #: /install/index.php:331
-msgid "Application cannot be installed. Please fix problems listed below in red, and press Refresh button."
-msgstr "Programmet kan inte installeras. Vänligen fixa problemen som är beskrivna nedan och tryk Upprepa knappen."
+msgid ""
+"Application cannot be installed. Please fix problems listed below in red, "
+"and press Refresh button."
+msgstr ""
+"Programmet kan inte installeras. Vänligen fixa problemen som är beskrivna "
+"nedan och tryk Upprepa knappen."
 
 #: /install/index.php:332
 msgid "Refresh"
@@ -145,7 +161,7 @@ msgstr "Databasl
 
 #: /install/index.php:348
 msgid "Database Collation:"
-msgstr ""
+msgstr "Databas sortering."
 
 #: /install/index.php:349
 msgid "Use '0_' Table Prefix:"
@@ -170,16 +186,28 @@ msgid "Install Additional COAs from FA Repository:"
 msgstr "Installera ytterligare kontoplaner från FA lagret:"
 
 #: /install/index.php:353
-msgid "Select collation you want to use. If you are unsure or you will use various languages, select unicode collation."
+msgid ""
+"Select collation you want to use. If you are unsure or you will use various "
+"languages, select unicode collation."
 msgstr ""
+"Välj sortering som du önskar att använda. Om du är osäker eller will använda "
+"olika språk, välj då unicode sortering."
 
 #: /install/index.php:354
-msgid "Use table prefix if you share selected database for more than one FA company using the same collation."
+msgid ""
+"Use table prefix if you share selected database for more than one FA company "
+"using the same collation."
 msgstr ""
+"Använd tabell prefix om du delar vald daabas med flera än ett FA bolag som "
+"använder samma sortering. "
 
 #: /install/index.php:355
-msgid "Do not select additional langs nor COAs if you have no working internet connection right now. You can install them later."
-msgstr "Välj inte ytterligare språk eller kontoplaner om du inte har någon fungerande internet förbindelse nu. Du kan installere dem senare."
+msgid ""
+"Do not select additional langs nor COAs if you have no working internet "
+"connection right now. You can install them later."
+msgstr ""
+"Välj inte ytterligare språk eller kontoplaner om du inte har någon "
+"fungerande internet förbindelse nu. Du kan installere dem senare."
 
 #: /install/index.php:356 /install/index.php:363 /install/index.php:370
 #: /install/index.php:394
@@ -224,7 +252,7 @@ msgstr "V
 
 #: /install/index.php:395
 msgid "Start installation process"
-msgstr ""
+msgstr "Påbörja installationen"
 
 #: /install/index.php:399
 msgid "FrontAccounting ERP has been installed successsfully."
@@ -232,7 +260,8 @@ msgstr "FrontAccounting ERP har installerats."
 
 #: /install/index.php:400
 msgid "Please do not forget to remove install wizard folder."
-msgstr "Vänligen glöm inte att omdöpa eller ta bort installationswizrdens mapp."
+msgstr ""
+"Vänligen glöm inte att omdöpa eller ta bort installationswizrdens mapp."
 
 #: /install/index.php:403
 msgid "Click here to start."
@@ -276,7 +305,7 @@ msgstr "PHP version"
 
 #: /includes/system_tests.inc:50
 msgid "Upgrade PHP to version at least 5.0.0"
-msgstr ""
+msgstr "Uppgrader PHP till åtminstone"
 
 #: /includes/system_tests.inc:57
 msgid "Server system"
@@ -296,7 +325,8 @@ msgstr "Inte borttagen"
 
 #: /includes/system_tests.inc:83
 msgid "Remove or rename install wizard folder for security reasons."
-msgstr "Ta bort eller omdöp installationswizardens mapp av säkerhetsmässiga orsaker."
+msgstr ""
+"Ta bort eller omdöp installationswizardens mapp av säkerhetsmässiga orsaker."
 
 #: /includes/system_tests.inc:90
 msgid "Browser type"
@@ -352,7 +382,8 @@ msgstr "Nuvarande databasversion"
 
 #: /includes/system_tests.inc:166
 msgid "Database structure seems to be not upgraded to current version"
-msgstr "Databasstruktur tycks inte ha blivit uppgraderat till nuvarande version"
+msgstr ""
+"Databasstruktur tycks inte ha blivit uppgraderat till nuvarande version"
 
 #: /includes/system_tests.inc:181
 msgid "Company subdirectories consistency"
@@ -417,8 +448,11 @@ msgstr "Databas Auth fil"
 
 #: /includes/system_tests.inc:323
 #, php-format
-msgid "'%s' file should be read-only if you do not plan to add or change companies"
-msgstr "'%s' filen måste vara read-only om du inte planerar att lägga till eller ändra företag."
+msgid ""
+"'%s' file should be read-only if you do not plan to add or change companies"
+msgstr ""
+"'%s' filen måste vara read-only om du inte planerar att lägga till eller "
+"ändra företag."
 
 #: /includes/system_tests.inc:334
 msgid "Extensions system"
@@ -434,11 +468,14 @@ msgid "Non-standard theme directory '%s' is not writable"
 msgstr "Icke standard theme mapp '%s' är inte skrivbar"
 
 #: /includes/system_tests.inc:395
-msgid "OpenSSL PHP extension have to be enabled to use extension repository system."
+msgid ""
+"OpenSSL PHP extension have to be enabled to use extension repository system."
 msgstr "OpenSSL PHP tillägget måste vara aktivt för att använda tillägslagret"
 
 #: /includes/system_tests.inc:398
-msgid "OpenSSL have to be available on your server to use extension repository system."
+msgid ""
+"OpenSSL have to be available on your server to use extension repository "
+"system."
 msgstr "OpenSSL måste finnas på din server för att använda tillägslagret."
 
 #: /includes/system_tests.inc:421
@@ -468,16 +505,18 @@ msgstr "Inget nyckel f
 
 #: /includes/packages.inc:294
 msgid "Cannot download repo index file."
-msgstr ""
+msgstr "Kan inte ladda ner repo index filen."
 
 #: /includes/packages.inc:306 /includes/packages.inc:343
 #, php-format
 msgid "Cannot delete outdated '%s' file."
-msgstr ""
+msgstr "Kan inte radera gammal '%s' fil."
 
 #: /includes/packages.inc:310
 msgid "Release file in repository is invalid, or public key is outdated."
-msgstr "Release filen i repository är ogiltig, eller också är publika nyckeln ogiltig."
+msgstr ""
+"Release filen i repository är ogiltig, eller också är publika nyckeln "
+"ogiltig."
 
 #: /includes/packages.inc:327
 msgid "Repository version does not match application version."
@@ -486,25 +525,36 @@ msgstr "Repository versionen matchar inte program versionen."
 #: /includes/packages.inc:335 /includes/packages.inc:377
 #, php-format
 msgid "Cannot download '%s' file."
-msgstr ""
+msgstr "Kan inte ladda ner '%s' filen."
 
 #: /includes/packages.inc:347
 #, php-format
-msgid "Security alert: broken index file in repository '%s'. Please inform repository administrator about this issue."
-msgstr "Säkerhetsvarning: Bruten indes fil i repository '%s'. Vänligen informera repository administratorn om detta."
+msgid ""
+"Security alert: broken index file in repository '%s'. Please inform "
+"repository administrator about this issue."
+msgstr ""
+"Säkerhetsvarning: Bruten indes fil i repository '%s'. Vänligen informera "
+"repository administratorn om detta."
 
 #: /includes/packages.inc:383
 #, php-format
-msgid "Security alert: broken package '%s' in repository. Please inform repository administrator about this issue."
-msgstr "Säkerhetsvarning: Brutet paket '%s' i repository. Vänligen informera repository administratorn om detta."
+msgid ""
+"Security alert: broken package '%s' in repository. Please inform repository "
+"administrator about this issue."
+msgstr ""
+"Säkerhetsvarning: Brutet paket '%s' i repository. Vänligen informera "
+"repository administratorn om detta."
 
 #: /includes/packages.inc:641 /includes/packages.inc:696
 #, php-format
 msgid "Package '%s' not found."
 msgstr "Paket '%s' finns ej."
 
-#~ msgid "Use table prefix if you share selected database for more than one FA company."
-#~ msgstr "Använd tabell prefix om du delar databasen med flera än ett företag."
+#~ msgid ""
+#~ "Use table prefix if you share selected database for more than one FA "
+#~ "company."
+#~ msgstr ""
+#~ "Använd tabell prefix om du delar databasen med flera än ett företag."
 
 #~ msgid "Upgrade PHP to version at least 4.3.3"
 #~ msgstr "Uppgradera PHP till minst 4.3.3"
index cfc581d29f19ffd6b4e8a865ae815cba8ba56307..29bc02dde7e4260e1f26ef322ca1aaad5a2e7656 100644 (file)
@@ -75,7 +75,7 @@ function add_work_order_issue($woid, $ref, $to_work_order, $items, $location, $w
                if (!is_service($issue["mb_flag"]))
                        $ivaccount = $issue["inventory_account"];
                else
-                       $ivaccount = $issue["cogs_account"];            
+                       $ivaccount = $issue["assembly_account"];                
 
         $total_cost += add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $ivaccount, 0, 0,
                 $date_.": "._("Issue of")." ".$stockitem["description"], -$issue_cost);                        
@@ -199,7 +199,7 @@ function void_work_order_issue($type_no)
                if (!is_service($issue["mb_flag"]))
                        $ivaccount = $issue["inventory_account"];
                else
-                       $ivaccount = $issue["cogs_account"];
+                       $ivaccount = $issue["assembly_account"];
 
                if ($issue_cost != 0)
                {
index 111feb4ca29ea0121b6690d766c3913e96b5a331..d2bbe0bd4e12c0c3a975ed5b10fd89bdc572e542 100644 (file)
@@ -58,6 +58,19 @@ function work_order_produce($woid, $ref, $quantity, $date_, $memo_, $close_wo)
                $standard_cost = get_standard_cost($bom_item['component']);
                $m_cost += ($bom_item['quantity'] * $standard_cost);
        }
+       // new 2015.10.15       
+       // additilnal costs.
+       if (work_order_has_issues($woid))
+       {
+               $res = get_additional_issues($woid);
+               while ($issue = db_fetch($res))
+               {
+                       $standard_cost = get_standard_cost($issue['stock_id']);
+                       $m_cost += ($issue['qty_issued'] * $standard_cost) / $quantity;
+               }
+       }
+       $m_cost += (get_gl_wo_cost($woid, WO_LABOUR) / $quantity);
+       $m_cost += (get_gl_wo_cost($woid, WO_OVERHEAD) / $quantity);
 
        // insert a +ve stock move for the item being manufactured
        // negative means "unproduce" or unassemble
@@ -145,7 +158,7 @@ function void_work_order_produce($type_no)
                if (!is_service($issue["mb_flag"]))
                        $ivaccount = $issue["inventory_account"];
                else
-                       $ivaccount = $issue["cogs_account"];
+                       $ivaccount = $issue["assembly_account"];
 
                if ($issue_cost != 0)
                {
index 0d80d1633fa245bf9cf2f748bd64ebdfde1dc35c..15ea30f7cd3dbb70e05b622bbdfad06769b03c24 100644 (file)
@@ -9,6 +9,236 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
+//--------------------------------------------------------------------------------------
+
+function add_material_cost($stock_id, $qty, $date_, $advanced=false, $woid=0)
+{
+       $m_cost = 0;
+    $result = get_bom($stock_id);
+       while ($bom_item = db_fetch($result))
+       {
+               $standard_cost = get_standard_cost($bom_item['component']);
+               $m_cost += ($bom_item['quantity'] * $standard_cost);
+       }
+       $bom_cost = $m_cost;
+       // new 2015.10.15       
+       // additilnal costs.
+       $i_cost = 0;
+       if ($woid != 0 && work_order_has_issues($woid))
+       {
+               $res = get_additional_issues($woid);
+               while ($issue = db_fetch($res))
+               {
+                       $standard_cost = get_standard_cost($issue['stock_id']);
+                       $i_cost += ($issue['qty_issued'] * $standard_cost) / $qty;
+               }
+       }
+       $sql = "SELECT material_cost, labour_cost, overhead_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
+               .db_escape($stock_id);
+       $result = db_query($sql);
+       $myrow = db_fetch($result);
+       $material_cost =  $myrow['material_cost'] - $i_cost; // $i_cost was already added to material cost
+       $m_cost += $i_cost;
+       /* no, why will we do that?? Joe Hunt 2015.10.17
+       if ($advanced)
+       {
+               //reduce overhead_cost and labour_cost from price as those will remain as is
+               $m_cost = $m_cost - $myrow['labour_cost'] - $myrow['overhead_cost'];
+       }
+       */
+       $qoh = get_qoh_on_date($stock_id);
+       $cost_adjust = false;
+       if ($qoh < 0)
+       {
+               if ($qoh + $qty >= 0)
+                       $cost_adjust = true;
+               $qoh = 0;
+       }               
+       if ($qoh + $qty != 0)
+       {
+               if ($qoh == 0) // 27.10.2014 apmuthu and dz.
+                       $material_cost = $m_cost;
+               else    
+                       $material_cost = ($qoh * $material_cost + $qty * $m_cost) /     ($qoh + $qty);
+       }
+       if ($advanced && $cost_adjust) // new 2010-02-10
+               adjust_deliveries($stock_id, $bom_cost, $date_);        
+       
+               $sql = "UPDATE ".TB_PREF."stock_master SET material_cost=".db_escape($material_cost)."
+                   WHERE stock_id=".db_escape($stock_id);
+       db_query($sql,"The cost details for the inventory item could not be updated");
+}
+
+function add_overhead_cost($stock_id, $qty, $date_, $costs, $adj_only=false)
+{
+       if ($qty != 0)
+               $costs /= $qty;
+       $sql = "SELECT overhead_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
+               .db_escape($stock_id);
+       $result = db_query($sql);
+       $myrow = db_fetch($result);
+       $overhead_cost =  $myrow['overhead_cost'];
+       $qoh = get_qoh_on_date($stock_id);
+       if ($qoh < 0)
+               $qoh = 0;
+       if ($adj_only)
+       {
+               if ($qoh>0)
+               {
+                       if ($qoh + $qty != 0)   
+                               $overhead_cost = ($qoh * $overhead_cost + $qty * $costs) /      ($qoh + $qty);
+                       elseif ($qty == 0)
+                               $overhead_cost = ($qoh * $overhead_cost + $costs) / $qoh;
+               }                       
+               else // Journal Entry if QOH is 0/negative 
+               {
+                       global $Refs;
+
+                       $id = get_next_trans_no(ST_JOURNAL);
+                       $ref = $Refs->get_next(ST_JOURNAL);
+                       
+                       $stock_gl_code = get_stock_gl_code($stock_id);
+                       $memo = "WO Overhead cost settlement JV for zero/negative respository of ".$stock_id;
+                       //Reverse the inventory effect if $qoh <=0
+                       add_gl_trans_std_cost(ST_JOURNAL, $id, $date_, 
+                               $stock_gl_code["inventory_account"],
+                               $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], $memo, 
+                               -$costs);
+                       //GL Posting to inventory adjustment account
+                       add_gl_trans_std_cost(ST_JOURNAL, $id, $date_, 
+                               $stock_gl_code["assembly_account"], // changed 2015.10.14 from adjustment to assembly account. Petros.
+                               $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], $memo,
+                               $costs);
+                               
+                       add_audit_trail(ST_JOURNAL, $id, $date_);
+                       add_comments(ST_JOURNAL, $id, $date_, $memo);
+                       $Refs->save(ST_JOURNAL, $id, $ref);
+                       if ($qty != 0) // 27.10.2014 dz
+                               $overhead_cost = ($qoh * $overhead_cost + $costs) / $qty;
+               }
+       }
+       else
+       {               
+               if ($qoh + $qty != 0)   
+                       $overhead_cost = ($qoh * $overhead_cost + $qty * $costs) /      ($qoh + $qty);
+       }
+       $sql = "UPDATE ".TB_PREF."stock_master SET overhead_cost=".db_escape($overhead_cost)."
+               WHERE stock_id=".db_escape($stock_id);
+       db_query($sql,"The cost details for the inventory item could not be updated");
+}
+
+function add_labour_cost($stock_id, $qty, $date_, $costs, $adj_only=false)
+{
+       if ($qty != 0)
+               $costs /= $qty;
+       $sql = "SELECT labour_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
+               .db_escape($stock_id);
+       $result = db_query($sql);
+       $myrow = db_fetch($result);
+       $labour_cost =  $myrow['labour_cost'];
+       $qoh = get_qoh_on_date($stock_id);
+       if ($qoh < 0)
+               $qoh = 0;
+       if ($adj_only)
+       {
+               if ($qoh>0)
+               {
+                       if ($qoh + $qty != 0)   
+                               $labour_cost = ($qoh * $labour_cost + $qty * $costs) /  ($qoh + $qty);
+                       elseif ($qty == 0)
+                               $labour_cost = ($qoh * $labour_cost + $costs) / $qoh;
+               }               
+               else // Journal Entry if QOH is 0/negative 
+               {
+                       global $Refs;
+
+                       $id = get_next_trans_no(ST_JOURNAL);
+                       $ref = $Refs->get_next(ST_JOURNAL);
+                       
+                       $stock_gl_code = get_stock_gl_code($stock_id);
+                       $memo = "WO labour cost settlement JV for zero/negative respository of ".$stock_id;
+                       //Reverse the inventory effect if $qoh <=0
+                       add_gl_trans_std_cost(ST_JOURNAL, $id, $date_, 
+                               $stock_gl_code["inventory_account"],
+                               $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], $memo, 
+                               -$costs);
+                       //GL Posting to inventory adjustment account
+                       add_gl_trans_std_cost(ST_JOURNAL, $id, $date_, 
+                               $stock_gl_code["assembly_account"], // changed 2015.10.14 from adjustment to assembly account. Petros.
+                               $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], $memo,
+                               $costs);
+                               
+                       add_audit_trail(ST_JOURNAL, $id, $date_);
+                       add_comments(ST_JOURNAL, $id, $date_, $memo);
+                       $Refs->save(ST_JOURNAL, $id, $ref);     
+                       if ($qty != 0) // 27.10.2014 dz
+                               $labour_cost = ($qoh * $labour_cost + $costs) / $qty;
+               }
+       }
+       else
+       {               
+               if ($qoh + $qty != 0)   
+                       $labour_cost = ($qoh * $labour_cost + $qty * $costs) /  ($qoh + $qty);
+       }       
+       $sql = "UPDATE ".TB_PREF."stock_master SET labour_cost=labour_cost+".db_escape($labour_cost)."
+               WHERE stock_id=".db_escape($stock_id);
+       db_query($sql,"The cost details for the inventory item could not be updated");
+}
+
+function add_issue_cost($stock_id, $qty, $date_, $costs, $adj_only=false)
+{
+       if ($qty != 0)
+               $costs /= $qty;
+       $sql = "SELECT material_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
+               .db_escape($stock_id);
+       $result = db_query($sql);
+       $myrow = db_fetch($result);
+       $material_cost =  $myrow['material_cost'];
+       $qoh = get_qoh_on_date($stock_id);
+       if ($qoh < 0)
+               $qoh = 0;
+       if ($adj_only)
+       {
+               if ($qoh>0)
+                       $material_cost = ($qoh * $material_cost + $costs) / $qoh;
+               else // Journal Entry if QOH is 0/negative
+               {
+                       global $Refs;
+
+                       $id = get_next_trans_no(ST_JOURNAL);
+                       $ref = $Refs->get_next(ST_JOURNAL);
+                       
+                       $stock_gl_code = get_stock_gl_code($stock_id);
+                       $memo = "WO Issue settlement JV for zero/negative respository of ".$stock_id;
+                       //Reverse the inventory effect if $qoh <=0
+                       add_gl_trans_std_cost(ST_JOURNAL, $id, $date_, 
+                               $stock_gl_code["inventory_account"],
+                               $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], $memo, 
+                               -$costs);
+                       //GL Posting to inventory adjustment account
+                       add_gl_trans_std_cost(ST_JOURNAL, $id, $date_, 
+                               $stock_gl_code["assembly_account"], // changed 2015.10.14 from adjustment to assembly account. Petros.
+                               $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], $memo,
+                               $costs);
+                               
+                       add_audit_trail(ST_JOURNAL, $id, $date_);
+                       add_comments(ST_JOURNAL, $id, $date_, $memo);
+                       $Refs->save(ST_JOURNAL, $id, $ref);
+                       if ($qty != 0) // 27.10.2014 dz
+                               $material_cost = $costs / $qty; 
+               }
+       }
+       else
+       {
+               if ($qoh + $qty != 0)   
+                       $material_cost = ($qoh * $material_cost + $qty * $costs) /      ($qoh + $qty);
+       }       
+       $sql = "UPDATE ".TB_PREF."stock_master SET material_cost="
+               .db_escape($material_cost)
+               ." WHERE stock_id=".db_escape($stock_id);
+       db_query($sql,"The cost details for the inventory item could not be updated");
+}
+
 function add_work_order($wo_ref, $loc_code, $units_reqd, $stock_id,
        $type, $date_, $required_by, $memo_, $costs, $cr_acc, $labour, $cr_lab_acc)
 {
@@ -217,16 +447,6 @@ function void_work_order($woid)
        $work_order = get_work_order($woid);
        if (!($work_order["type"] == WO_ADVANCED))
        {
-               $date = sql2date($work_order['date_']);
-               $qty = $work_order['units_reqd'];
-               add_material_cost($work_order['stock_id'], -$qty, $date); // remove avg. cost for qty
-               $cost = get_gl_wo_cost($woid, WO_LABOUR); // get the labour cost and reduce avg cost
-               if ($cost != 0)
-                       add_labour_cost($work_order['stock_id'], -$qty, $date, $cost);
-               $cost = get_gl_wo_cost($woid, WO_OVERHEAD); // get the overhead cost and reduce avg cost
-               if ($cost != 0)
-                       add_overhead_cost($work_order['stock_id'], -$qty, $date, $cost);
-
                $sql = "UPDATE ".TB_PREF."workorders SET closed=1,units_reqd=0,units_issued=0 WHERE id = "
                        .db_escape($woid);
                db_query($sql, "The work order couldn't be voided");
@@ -234,7 +454,8 @@ function void_work_order($woid)
                // void all related stock moves
                void_stock_move(ST_WORKORDER, $woid);
 
-               void_wo_costing($woid);
+               // void any related bank/gl trans
+               void_bank_trans(ST_WORKORDER, $woid, true);
 
                // clear the requirements units received
                void_wo_requirements($woid);
@@ -243,44 +464,45 @@ function void_work_order($woid)
        {
                // void everything inside the work order : issues, productions, payments
                $date = sql2date($work_order['date_']);
-               add_material_cost($work_order['stock_id'], -$work_order['units_reqd'], $date); // remove avg. cost for qty
+               
                $result = get_work_order_productions($woid); // check the produced quantity
-               $qty = 0;
                while ($row = db_fetch($result))
                {
-                       $qty += $row['quantity'];
-                       // clear the production record
-                       $sql = "UPDATE ".TB_PREF."wo_manufacture SET quantity=0 WHERE id=".$$row['id'];
-                       db_query($sql, "Cannot void a wo production");
-
-                       void_stock_move(ST_MANURECEIVE, $row['id']); // and void the stock moves; 
+                       void_work_order_produce($row['id']);
+                       
+                       //Post voided entry if not prevoided explicitly
+                       $void_entry = get_voided_entry(ST_MANURECEIVE, $row['id']);
+                       if ($void_entry)
+                               continue;
+                       $memo_ = _("Voiding Work Order Trans # ").$woid;
+                       add_audit_trail(ST_MANURECEIVE, $row['id'], today(), _("Voided.")."\n".$memo_);
+                       add_voided_entry(ST_MANURECEIVE, $row['id'], today(), $memo_);
                }
-               $result = get_additional_issues($woid); // check the issued quantities
+
+               $result = get_work_order_issues($woid);
                $cost = 0;
-               $issue_no = 0;
                while ($row = db_fetch($result))
                {
-                       $std_cost = get_standard_cost($row['stock_id']);
-                       $icost = $std_cost * $row['qty_issued'];
-                       $cost += $icost;
-                       if ($issue_no == 0)
-                               $issue_no = $row['issue_no'];
-                       // void the actual issue items and their quantities
-                       $sql = "UPDATE ".TB_PREF."wo_issue_items SET qty_issued = 0 WHERE issue_id="
-                               .db_escape($row['id']);
-                       db_query($sql,"A work order issue item could not be voided");
-               }       
-               if ($issue_no != 0)
-                       void_stock_move(ST_MANUISSUE, $issue_no); // and void the stock moves 
-               if ($cost != 0)
-                       add_issue_cost($work_order['stock_id'], -$qty, $date, $cost);
+                       void_work_order_issue($row['issue_no']);
+                       
+                       //Post voided entry if not prevoided explicitly
+                       $void_entry = get_voided_entry(ST_MANUISSUE, $row['issue_no']);
+                       if ($void_entry)
+                               continue;
+                       $memo_ = _("Voiding Work Order Trans # ").$woid;
+                       add_audit_trail(ST_MANUISSUE, $row['issue_no'], today(), _("Voided.")."\n".$memo_);
+                       add_voided_entry(ST_MANUISSUE, $row['issue_no'], today(), $memo_);                              
+               }
 
-               $cost = get_gl_wo_cost($woid, WO_LABOUR); // get the labour cost and reduce avg cost
+               //Adust avg labour cost
+               $cost = get_gl_wo_cost($woid, WO_LABOUR); 
                if ($cost != 0)
-                       add_labour_cost($work_order['stock_id'], -$qty, $date, $cost);
-               $cost = get_gl_wo_cost($woid, WO_OVERHEAD); // get the overhead cost and reduce avg cost
+                       add_labour_cost($work_order['stock_id'], 1, $date, -$cost, true);
+                       
+               //Adust avg overhead cost
+               $cost = get_gl_wo_cost($woid, WO_OVERHEAD); 
                if ($cost != 0)
-                       add_overhead_cost($work_order['stock_id'], -$qty, $date, $cost);
+                       add_overhead_cost($work_order['stock_id'], 1, $date, -$cost, true);
                
                $sql = "UPDATE ".TB_PREF."workorders SET closed=1,units_reqd=0,units_issued=0 WHERE id = "
                        .db_escape($woid);
@@ -289,7 +511,8 @@ function void_work_order($woid)
                // void all related stock moves
                void_stock_move(ST_WORKORDER, $woid);
 
-               void_wo_costing($wo);
+               // void any related bank/gl trans
+               void_bank_trans(ST_WORKORDER, $woid, true);
 
                // clear the requirements units received
                void_wo_requirements($woid);
index 4aa2a176a09d659af77efe37c26890c43c9dfbc2..e07ec8f35ad82ce3d61391547c4a64cd5d2efe68 100644 (file)
@@ -68,7 +68,7 @@ function add_work_order_quick($wo_ref, $loc_code, $units_reqd, $stock_id, $type,
                // insert a -ve stock move for each item
                $UnitCost = get_standard_cost($bom_item["component"]);
                add_stock_move(ST_WORKORDER, $bom_item["component"], $woid,
-                       $bom_item["loc_code"], $date_, $wo_ref, -$item_quantity, $UnitCost, $UnitCost);
+                       $bom_item["loc_code"], $date_, $wo_ref, -$item_quantity, $UnitCost, 0, 1, $UnitCost);
        }
 
        // -------------------------------------------------------------------------
@@ -81,7 +81,6 @@ function add_work_order_quick($wo_ref, $loc_code, $units_reqd, $stock_id, $type,
                        $cost_adjust = true;
        }
 
-
        //Negative Stock Handling First; Prior to add_stock_move
        if ($cost_adjust)
                adjust_deliveries($stock_id, get_standard_cost($stock_id), $date_);
@@ -113,10 +112,12 @@ function add_work_order_quick($wo_ref, $loc_code, $units_reqd, $stock_id, $type,
 
 function work_order_quick_costs($woid, $stock_id, $units_reqd, $date_, $advanced=0, $costs=0, $cr_acc="", $labour=0, $cr_lab_acc="")
 {
+       global $wo_cost_types;
        $result = get_bom($stock_id);
 
        // credit all the components
        $total_cost = 0;
+       $total_material_cost = 0;
        while ($bom_item = db_fetch($result))
        {
 
@@ -130,35 +131,59 @@ function work_order_quick_costs($woid, $stock_id, $units_reqd, $date_, $advanced
                        $memo = $date_.": ".$memo; 
                        update_wo_requirement_issued($woid, $bom_item['component'], $bom_item["quantity"] * $units_reqd);                       
                        // insert a -ve stock move for each item
+                       $UnitCost = get_standard_cost($bom_item["component"]);                  
                        add_stock_move(ST_MANURECEIVE, $bom_item["component"], $advanced,
-                               $bom_item["loc_code"], $date_, "", -$bom_item["quantity"] * $units_reqd, 0);
+                               $bom_item["loc_code"], $date_, "", -$bom_item["quantity"] * $units_reqd, $UnitCost, 0, 1, $UnitCost);
                }
-               $total_cost += add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $bom_accounts["inventory_account"], 0, 0,
+               //Compatibility for Service Items
+               if (!is_service($bom_accounts["mb_flag"]))
+                       $ivaccount = $bom_accounts["inventory_account"];
+               else
+                       $ivaccount = $bom_accounts["assembly_account"]; // changed 2015.10.14 by Petros .               
+               $total_cost += add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $ivaccount, 0, 0,
                        $memo, -$bom_cost);
-
+               $total_material_cost += $bom_cost;
        }
-       $item_accounts = get_stock_gl_code($stock_id);
        if ($advanced)
        {
-               $wo = get_work_order($woid);
-               $lcost = get_gl_wo_cost($woid, WO_LABOUR);
-               add_labour_cost($stock_id, $units_reqd, $date_, $lcost * $units_reqd / $wo['units_reqd']);
-               $ocost = get_gl_wo_cost($woid, WO_OVERHEAD);
-               add_overhead_cost($stock_id, $units_reqd, $date_, $ocost * $units_reqd / $wo['units_reqd']);
-
-       } else { // only for quick
-               // credit additional costs
-
-               if ($costs != 0.0)
-               {
-                       add_wo_costs_journal($woid, $costs, WO_OVERHEAD, $cr_acc, $item_accounts["assembly_account"],
-                               $date_, $item_accounts["dimension_id"], $item_accounts["dimension2_id"]);
-               }
-               if ($labour != 0.0) // only for quick
-               {
-                       add_wo_costs_journal($woid, $labour, WO_LABOUR, $cr_lab_acc, $item_accounts["assembly_account"],
-                               $date_, $item_accounts["dimension_id"], $item_accounts["dimension2_id"]);
-               }
+               //Material cost added at time of production as per BOM at the time and in adjustment mode.
+               add_material_cost($stock_id, $units_reqd, $date_, true, $woid); 
+               // $wo = get_work_order($woid);
+               // also take the additional issues
+               // moved to work_order_issues_db.inc
+       }       // credit additional costs
+       $item_accounts = get_stock_gl_code($stock_id);
+       if ($costs != 0.0)
+       {
+               add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $cr_acc,
+                       0, 0, $wo_cost_types[WO_OVERHEAD], -$costs, PT_WORKORDER, WO_OVERHEAD);
+               $is_bank_to = is_bank_account($cr_acc);
+       if ($is_bank_to)
+       {
+               add_bank_trans(ST_WORKORDER, $woid, $is_bank_to, "",
+                       $date_, -$costs, PT_WORKORDER, WO_OVERHEAD, get_company_currency(),
+                       "Cannot insert a destination bank transaction");
+       }
+                       
+               add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $item_accounts["assembly_account"],
+                       $item_accounts["dimension_id"], $item_accounts["dimension2_id"], $wo_cost_types[WO_OVERHEAD], $costs, 
+                       PT_WORKORDER, WO_OVERHEAD);
+       }
+       if ($labour != 0.0) // only for quick
+       {
+               add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $cr_lab_acc,
+                       0, 0, $wo_cost_types[WO_LABOUR], -$labour, PT_WORKORDER, WO_LABOUR);
+               $is_bank_to = is_bank_account($cr_lab_acc);
+       if ($is_bank_to)
+       {
+               add_bank_trans(ST_WORKORDER, $woid, $is_bank_to, "",
+                       $date_, -$labour, PT_WORKORDER, WO_LABOUR, get_company_currency(),
+                       "Cannot insert a destination bank transaction");
+       }
+                       
+               add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $item_accounts["assembly_account"],
+                       $item_accounts["dimension_id"], $item_accounts["dimension2_id"], $wo_cost_types[WO_LABOUR], $labour, 
+                       PT_WORKORDER, WO_LABOUR);
        }
        // debit total components $total_cost
        $stockitem = get_item($stock_id);
@@ -167,5 +192,10 @@ function work_order_quick_costs($woid, $stock_id, $units_reqd, $date_, $advanced
                $memo = $date_.": ".$memo;
     add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $item_accounts["inventory_account"],
         0, 0, $memo, -$total_cost);
+       if (!$advanced)
+       {
+               $UnitWOCost = ($total_material_cost + $costs + $labour)/$units_reqd;
+               update_stock_move(ST_WORKORDER, $woid, $stock_id, $UnitWOCost); 
+       }       
 }
 
index 16428eec0cafeac897d6736ae3dfb69818b2a87f..d42375c954a9f92369ac355b03f4290c26ea92f0 100644 (file)
@@ -12,7 +12,6 @@
 include_once($path_to_root . "/includes/db/manufacturing_db.inc");
 include_once($path_to_root . "/manufacturing/includes/db/work_centres_db.inc");
 include_once($path_to_root . "/manufacturing/includes/db/work_orders_db.inc");
-include_once($path_to_root . "/manufacturing/includes/db/work_order_costing_db.inc");
 include_once($path_to_root . "/manufacturing/includes/db/work_orders_quick_db.inc");
 include_once($path_to_root . "/manufacturing/includes/db/work_order_issues_db.inc");
 include_once($path_to_root . "/manufacturing/includes/db/work_order_produce_items_db.inc");
index 2d55477ba767fb01651173eb6e5ea9ac930b1359..b95d2641f09f3fdaae79d9b4f89695710ba32db8 100644 (file)
@@ -245,7 +245,7 @@ function display_wo_payments($woid)
                        alt_table_row_color($k);
 
                label_cell(get_gl_view_str( $myrow["type"], $myrow["type_no"], $myrow["type_no"]));
-               label_cell($wo_cost_types[$myrow['cost_type']]);
+               label_cell($wo_cost_types[$myrow['person_id']]);
                $date = sql2date($myrow["tran_date"]);
                label_cell($date);
                        amount_cell(-($myrow['amount']));
index a76c5f5e0d90163e5affd6def3a226f039d34fdc..eb089384547bf86a92eef22588ae0ccb1ea47da6 100644 (file)
@@ -43,6 +43,8 @@ if (isset($_GET['AddedID']))
 
     display_note(get_trans_view_str($stype, $id, _("View this Work Order")));
 
+       display_note(get_gl_view_str($stype, $id, _("View the GL Journal Entries for this Work Order")), 1);
+
        hyperlink_params("work_order_costs.php", _("Enter another additional cost."), "trans_no=$id");
  
        hyperlink_no_params("search_work_orders.php", _("Select another &Work Order to Process"));
@@ -64,9 +66,10 @@ if (strlen($wo_details[0]) == 0)
 
 //--------------------------------------------------------------------------------------------------
 
-function can_process($wo_details)
+function can_process()
 {
-
+       global $wo_details;
+       
        if (!check_num('costs', 0))
        {
                display_error(_("The amount entered is not a valid number or less then zero."));
@@ -98,15 +101,32 @@ function can_process($wo_details)
 
 //--------------------------------------------------------------------------------------------------
 
-if (isset($_POST['process']) && can_process($wo_details) == true)
+if (isset($_POST['process']) && can_process() == true)
 {
        $date = $_POST['date_'];
-       $memo = $_POST['memo'];
-       $ref  = $_POST['ref'];
-
-       add_wo_costs_journal($_POST['selected_id'], input_num('costs'), $_POST['PaymentType'], 
-               $_POST['cr_acc'], $_POST['db_acc'], $date, $_POST['dim1'], $_POST['dim2'], $memo, $ref);
+       begin_transaction();
+       add_gl_trans_std_cost(ST_WORKORDER, $_POST['selected_id'], $_POST['date_'], $_POST['cr_acc'],
+               0, 0, $date.": ".$wo_cost_types[$_POST['PaymentType']], -input_num('costs'), PT_WORKORDER, $_POST['PaymentType']);
+       $is_bank_to = is_bank_account($_POST['cr_acc']);
+       if ($is_bank_to)
+       {
+               add_bank_trans(ST_WORKORDER, $_POST['selected_id'], $is_bank_to, "",
+                       $_POST['date_'], -input_num('costs'), PT_WORKORDER, $_POST['PaymentType'], get_company_currency(),
+                       "Cannot insert a destination bank transaction");
+       }
 
+       add_gl_trans_std_cost(ST_WORKORDER, $_POST['selected_id'], $_POST['date_'], $_POST['db_acc'],
+               $_POST['dim1'], $_POST['dim2'], $date.": ".$wo_cost_types[$_POST['PaymentType']], input_num('costs'), PT_WORKORDER, 
+                       $_POST['PaymentType']);
+                       
+       //Apply the costs to manfuctured stock item as adjustement
+       $wo = get_work_order($_POST['selected_id']);
+       if ($_POST['PaymentType'] == 0)
+               add_labour_cost($wo['stock_id'], $wo['units_reqd'], $_POST['date_'], input_num('costs'), true);
+       else
+               add_overhead_cost($wo['stock_id'], $wo['units_reqd'], $_POST['date_'], input_num('costs'), true);
+                       
+       commit_transaction();   
        meta_forward($_SERVER['PHP_SELF'], "AddedID=".$_POST['selected_id']);
 }
 
index d3bed587e3c2bbdc65314ad1ca4bb6f8d1e5cfa1..90d84eb47818e56ab027bebaf94ff559b6c51889 100644 (file)
@@ -123,9 +123,8 @@ function add_grn(&$po)
                                if ($clearing_act)
                                        $total += add_gl_trans_supplier(ST_SUPPRECEIVE, $grn, $date_, $stock_gl_code["inventory_account"],
                                                $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'],
-                                               $order_line->receive_qty * $order_line->taxfree_charge_price($po), $po->supplier_id, '', 0, 
-                                               $order_line->stock_id);
-                               update_average_material_cost($po->supplier_id, $order_line->stock_id, $order_line->price,
+                                           $order_line->taxfree_charge_value($po), $po->supplier_id, '', 0, $order_line->stock_id);
+                               update_average_material_cost($po->supplier_id, $order_line->stock_id, $order_line->price,
                                        $order_line->receive_qty, $date_);
                        }
                        //------------------------------------------------------------------------------------------------------
@@ -149,7 +148,8 @@ function add_grn(&$po)
                        $po->line_items[$line_no]->grn_item_id = $grn_item;
                        /* Update location stock records - NB  a po cannot be entered for a service/kit parts done automatically */
                        add_stock_move(ST_SUPPRECEIVE, $order_line->stock_id, $grn, $po->Location, $date_, "",
-                               $order_line->receive_qty, $order_line->standard_cost, $order_line->taxfree_charge_price($po));
+                               $order_line->receive_qty, $order_line->standard_cost,           
+                               $po->supplier_id, 1, $order_line->taxfree_charge_value($po)/$order_line->receive_qty);
 
                } /*quantity received is != 0 */
        } /*end of order_line loop */
index 7fdef20306065a05a444f3096cbe611f22282ff5..b197cb0369b1d27d3c31e81f79ead7dfa743c957 100644 (file)
@@ -246,10 +246,20 @@ class po_line_details
                $this->grn_item_id = $grn_item_id;
        }
        
-       function taxfree_charge_price($po)
+       // Deprecated, use with care. If you need line value as it is calculated in invoice, use taxfree_charge_value below.
+       function taxfree_charge_price($po)
        {
                return get_tax_free_price_for_item($this->stock_id, $this->price, 
                  $po->tax_group_id, $po->tax_included, $po->tax_group_array);
        }
+
+       //
+       // GRN line tax free value.
+       //
+       function taxfree_charge_value($po)
+       {
+               return get_tax_free_price_for_item($this->stock_id, $this->receive_qty*$this->price,
+                 $po->tax_group_id, $po->tax_included, $po->tax_group_array);
+       }
 }
 
index f5c21d8bfb5596b337ffa00b939bd25ef873962d..df1c75559c9e79a3110709da36573e32af1c3b12 100644 (file)
@@ -333,8 +333,9 @@ function html_entity_decode_php4($text_to_convert) {
        );
        $return_text = strtr($text_to_convert, $htmlentities_table);
        
-       if (version_compare(PHP_VERSION, '5.3.0') >= 0) // 07.11.2014, from php 5.3.0 fixed deprecated preg_replace with the /e flag. Joe. 
-       {
+       // 07.11.2014, from php 5.3.0 fixed deprecated preg_replace with the /e flag. Joe
+       if (version_compare(PHP_VERSION, '5.3.0') >= 0 && function_exists("preg_replace_callback"))
+       { 
                $return_text = preg_replace_callback('~&#x([0-9a-f]+);~i', function ($m){ return chr(hexdec($m[1]));}, $return_text);
                $return_text = preg_replace_callback('~&#([0-9]+);~', function ($m){ return chr($m[1]);}, $return_text);
        }
index 4de23cc4896994f22b634d43519c84a0c37e126b..1e9cc1487d4ad7afd419be68184aa649071a3d13 100644 (file)
@@ -188,7 +188,6 @@ function print_invoices()
                        }
 
                        $DisplaySubTot = number_format2($SubTotal,$dec);
-                       $DisplayFreight = number_format2($sign*$myrow["ov_freight"],$dec);
 
                        // set to start of summary line:
                $rep->row = $summary_start_row;
@@ -233,9 +232,13 @@ function print_invoices()
                        $rep->TextCol(3, 6, _("Sub-total"), -2);
                        $rep->TextCol(6, 7,     $DisplaySubTot, -2);
                        $rep->NewLine();
-                       $rep->TextCol(3, 6, _("Shipping"), -2);
-                       $rep->TextCol(6, 7,     $DisplayFreight, -2);
-                       $rep->NewLine();
+                       if ($myrow['ov_freight'] != 0.0)
+                       {
+                               $DisplayFreight = number_format2($sign*$myrow["ov_freight"],$dec);
+                               $rep->TextCol(3, 6, _("Shipping"), -2);
+                               $rep->TextCol(6, 7,     $DisplayFreight, -2);
+                               $rep->NewLine();
+                       }       
                        $tax_items = get_trans_tax_details(ST_SALESINVOICE, $row['trans_no']);
                        $first = true;
                while ($tax_item = db_fetch($tax_items))
index 53df06f61a8b42d9a89a16c016124bd3bdaec212..e5a92199682db4d12e371b83179d96fdc3ed03e0 100644 (file)
@@ -147,7 +147,6 @@ function print_sales_orders()
                        $rep->TextColLines(1, 5, $myrow['comments'], -2);
                }
                $DisplaySubTot = number_format2($SubTotal,$dec);
-               $DisplayFreight = number_format2($myrow["freight_cost"],$dec);
 
                $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
                $doctype = ST_SALESORDER;
@@ -155,10 +154,13 @@ function print_sales_orders()
                $rep->TextCol(3, 6, _("Sub-total"), -2);
                $rep->TextCol(6, 7,     $DisplaySubTot, -2);
                $rep->NewLine();
-               $rep->TextCol(3, 6, _("Shipping"), -2);
-               $rep->TextCol(6, 7,     $DisplayFreight, -2);
-               $rep->NewLine();
-
+               if ($myrow['ov_freight'] != 0.0)
+               {
+                       $DisplayFreight = number_format2($myrow["freight_cost"],$dec);
+                       $rep->TextCol(3, 6, _("Shipping"), -2);
+                       $rep->TextCol(6, 7,     $DisplayFreight, -2);
+                       $rep->NewLine();
+               }       
                $DisplayTotal = number_format2($myrow["freight_cost"] + $SubTotal, $dec);
                if ($myrow['tax_included'] == 0) {
                        $rep->TextCol(3, 6, _("TOTAL ORDER EX VAT"), - 2);
index 9fc2780af48212e6296128f4fe362e38ed5e1a6b..6b0830973dafaace1db2563dfc2927344250d65f 100644 (file)
@@ -148,7 +148,6 @@ function print_deliveries()
                        }
 
                        $DisplaySubTot = number_format2($SubTotal,$dec);
-                       $DisplayFreight = number_format2($myrow["ov_freight"],$dec);
 
                $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
                        $doctype=ST_CUSTDELIVERY;
@@ -157,9 +156,13 @@ function print_deliveries()
                                $rep->TextCol(3, 6, _("Sub-total"), -2);
                                $rep->TextCol(6, 7,     $DisplaySubTot, -2);
                                $rep->NewLine();
-                               $rep->TextCol(3, 6, _("Shipping"), -2);
-                               $rep->TextCol(6, 7,     $DisplayFreight, -2);
-                               $rep->NewLine();
+                               if ($myrow['ov_freight'] != 0.0)
+                               {
+                                       $DisplayFreight = number_format2($sign*$myrow["ov_freight"],$dec);
+                                       $rep->TextCol(3, 6, _("Shipping"), -2);
+                                       $rep->TextCol(6, 7,     $DisplayFreight, -2);
+                                       $rep->NewLine();
+                               }       
                                $tax_items = get_trans_tax_details(ST_CUSTDELIVERY, $i);
                                $first = true;
                        while ($tax_item = db_fetch($tax_items))
index ecf9fc19f10a62b02ca29e4c6ad238142794ff24..a75e44efba87be64833c4e934250f110bf903828 100644 (file)
@@ -144,7 +144,6 @@ function print_sales_quotations()
                        $rep->TextColLines(1, 5, $myrow['comments'], -2);
                }
                $DisplaySubTot = number_format2($SubTotal,$dec);
-               $DisplayFreight = number_format2($myrow["freight_cost"],$dec);
 
                $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
                $doctype = ST_SALESQUOTE;
@@ -152,10 +151,13 @@ function print_sales_quotations()
                $rep->TextCol(3, 6, _("Sub-total"), -2);
                $rep->TextCol(6, 7,     $DisplaySubTot, -2);
                $rep->NewLine();
-               $rep->TextCol(3, 6, _("Shipping"), -2);
-               $rep->TextCol(6, 7,     $DisplayFreight, -2);
-               $rep->NewLine();
-
+               if ($myrow['ov_freight'] != 0.0)
+               {
+                       $DisplayFreight = number_format2($myrow["freight_cost"],$dec);
+                       $rep->TextCol(3, 6, _("Shipping"), -2);
+                       $rep->TextCol(6, 7,     $DisplayFreight, -2);
+                       $rep->NewLine();
+               }       
                $DisplayTotal = number_format2($myrow["freight_cost"] + $SubTotal, $dec);
                if ($myrow['tax_included'] == 0) {
                        $rep->TextCol(3, 6, _("TOTAL ORDER EX VAT"), - 2);
index b1f931909a37759368c192a35bdfc3bd1db341ea..742738ab86a531159e3b6d3c6b192fdcdbcc05df 100644 (file)
@@ -138,7 +138,6 @@ function print_credits()
                }
 
                $DisplaySubTot = number_format2($SubTotal,$dec);
-               $DisplayFreight = number_format2($sign*$myrow["ov_freight"],$dec);
 
                $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
                $doctype = ST_CUSTCREDIT;
@@ -146,7 +145,14 @@ function print_credits()
                $rep->TextCol(3, 6, _("Sub-total"), -2);
                $rep->TextCol(6, 7,     $DisplaySubTot, -2);
                $rep->NewLine();
-               $rep->TextCol(3, 6, _("Shipping"), -2);
+               if ($myrow['ov_freight'] != 0.0)
+               {
+                       $DisplayFreight = number_format2($sign*$myrow["ov_freight"],$dec);
+                       $rep->TextCol(3, 6, _("Shipping"), -2);
+                       $rep->TextCol(6, 7,     $DisplayFreight, -2);
+                       $rep->NewLine();
+               }       
+               $rep->TextCol(3, 6, _("Shipping"), -2);
                $rep->TextCol(6, 7,     $DisplayFreight, -2);
                $rep->NewLine();
                $tax_items = get_trans_tax_details(ST_CUSTCREDIT, $i);
index 9bfdc0a78e0844decf19774c881bb889cf0d913e..9a4b2a5259a0e88ff6a32ce85e27042617be27a7 100644 (file)
@@ -43,7 +43,7 @@ function getTaxTransactions($from, $to)
                LEFT JOIN ".TB_PREF."tax_types tt
                        ON taxrec.tax_type_id=tt.id
                LEFT JOIN ".TB_PREF."gl_trans gl 
-                       ON taxrec.trans_type=gl.type AND taxrec.trans_no=gl.type_no AND 
+                       ON taxrec.trans_type=gl.type AND taxrec.trans_no=gl.type_no AND gl.amount<>0 AND
                        (tt.purchasing_gl_code=gl.account OR tt.sales_gl_code=gl.account)
                LEFT JOIN ".TB_PREF."supp_trans strans
                        ON taxrec.trans_no=strans.trans_no AND taxrec.trans_type=strans.type
@@ -57,6 +57,7 @@ function getTaxTransactions($from, $to)
                        AND taxrec.tran_date >= '$fromdate'
                        AND taxrec.tran_date <= '$todate'
                ORDER BY taxrec.trans_type, taxrec.tran_date, taxrec.trans_no, taxrec.ex_rate";
+
     return db_query($sql,"No transactions were returned");
 }
 
index d126fd48bdb7a79f5b56115ddcc9d3c1a27be56f..a6f709801c4bb5e34d517a612367a540775769b9 100644 (file)
@@ -126,7 +126,6 @@ else
        display_note(_("There are no line items on this credit note."), 1, 2);
 
 $display_sub_tot = price_format($sub_total);
-$display_freight = price_format($myrow["ov_freight"]);
 
 $credit_total = $myrow["ov_freight"]+$myrow["ov_gst"]+$myrow["ov_amount"]+$myrow["ov_freight_tax"];
 $display_total = price_format($credit_total);
@@ -135,7 +134,11 @@ $display_total = price_format($credit_total);
 if ($sub_total != 0)
        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");
+if ($myrow["ov_freight"] != 0.0)
+{
+       $display_freight = price_format($myrow["ov_freight"]);
+       label_row(_("Shipping"), $display_freight, "colspan=6 align=right", "nowrap align=right");
+}
 
 $tax_items = get_trans_tax_details(ST_CUSTCREDIT, $trans_id);
 display_customer_trans_tax_details($tax_items, 6);
index 300c67f4d39140026a3b21fa49345281eae450aa..8c1b031332ee13c4c50f6321c65019f8388f6071 100644 (file)
@@ -149,10 +149,11 @@ if (db_num_rows($result) > 0)
 }
 else
        display_note(_("There are no line items on this dispatch."), 1, 2);
-
-$display_freight = price_format($myrow["ov_freight"]);
-
-label_row(_("Shipping"), $display_freight, "colspan=6 align=right", "nowrap align=right");
+if ($myrow['ov_freight'] != 0.0)
+{
+       $display_freight = price_format($myrow["ov_freight"]);
+       label_row(_("Shipping"), $display_freight, "colspan=6 align=right", "nowrap align=right");
+}
 
 $tax_items = get_trans_tax_details(ST_CUSTDELIVERY, $trans_id);
 display_customer_trans_tax_details($tax_items, 6);
index db9ab1031c86ca9a91826d99bb76ed20ca020687..2c53b622a5a6cfc0a18866d0dfeff999ec405c2b 100644 (file)
@@ -153,10 +153,12 @@ if (db_num_rows($result) > 0)
 else
        display_note(_("There are no line items on this invoice."), 1, 2);
 
-$display_freight = price_format($myrow["ov_freight"]);
-
 /*Print out the invoice text entered */
-label_row(_("Shipping"), $display_freight, "colspan=6 align=right", "nowrap align=right");
+if ($myrow['ov_freight'] != 0.0)
+{
+       $display_freight = price_format($myrow["ov_freight"]);
+       label_row(_("Shipping"), $display_freight, "colspan=6 align=right", "nowrap align=right");
+}
 
 $tax_items = get_trans_tax_details(ST_SALESINVOICE, $trans_id);
 display_customer_trans_tax_details($tax_items, 6);
index 6014aeaf50b9a27eef7918a97731256b4b97f14f..5aa606d91f06744b0ca9fb450478f9a3c5c4fddf 100644 (file)
@@ -242,8 +242,9 @@ foreach ($_SESSION['View']->line_items as $stock_item) {
        end_row();
 }
 
-label_row(_("Shipping"), price_format($_SESSION['View']->freight_cost),
-       "align=right colspan=6", "nowrap align=right", 1);
+if ($_SESSION['View']->freight_cost != 0.0)
+       label_row(_("Shipping"), price_format($_SESSION['View']->freight_cost),
+               "align=right colspan=6", "nowrap align=right", 1);
 
 $sub_tot = $_SESSION['View']->get_items_total() + $_SESSION['View']->freight_cost;