From 43ad91751a494b2572eb64441248aa3a87f0141e Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Fri, 11 Dec 2015 23:22:20 +0100 Subject: [PATCH] Moving bugfixes from 2.3 to 2.4 and updated install languages for Denmark and Sweden. --- admin/inst_module.php | 16 +- gl/includes/db/gl_db_trans.inc | 20 +- gl/manage/gl_accounts.php | 2 +- includes/hooks.inc | 6 +- install/lang/da_DK/LC_MESSAGES/da_DK.mo | Bin 9995 -> 10946 bytes install/lang/da_DK/LC_MESSAGES/da_DK.po | 109 +++++-- install/lang/sv_SE/LC_MESSAGES/sv_SE.mo | Bin 9982 -> 10929 bytes install/lang/sv_SE/LC_MESSAGES/sv_SE.po | 116 +++++-- .../includes/db/work_order_issues_db.inc | 4 +- .../db/work_order_produce_items_db.inc | 15 +- manufacturing/includes/db/work_orders_db.inc | 303 +++++++++++++++--- .../includes/db/work_orders_quick_db.inc | 80 +++-- manufacturing/includes/manufacturing_db.inc | 1 - manufacturing/includes/manufacturing_ui.inc | 2 +- manufacturing/work_order_costs.php | 36 ++- purchasing/includes/db/grn_db.inc | 8 +- purchasing/includes/po_class.inc | 12 +- .../includes/html_entity_decode_php4.php | 5 +- reporting/rep107.php | 11 +- reporting/rep109.php | 12 +- reporting/rep110.php | 11 +- reporting/rep111.php | 12 +- reporting/rep113.php | 10 +- reporting/rep709.php | 3 +- sales/view/view_credit.php | 7 +- sales/view/view_dispatch.php | 9 +- sales/view/view_invoice.php | 8 +- sales/view/view_sales_order.php | 5 +- 28 files changed, 615 insertions(+), 208 deletions(-) diff --git a/admin/inst_module.php b/admin/inst_module.php index 71d6f742..886ecc91 100644 --- a/admin/inst_module.php +++ b/admin/inst_module.php @@ -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)) diff --git a/gl/includes/db/gl_db_trans.inc b/gl/includes/db/gl_db_trans.inc index 9fd072b8..20c90232 100644 --- a/gl/includes/db/gl_db_trans.inc +++ b/gl/includes/db/gl_db_trans.inc @@ -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"); diff --git a/gl/manage/gl_accounts.php b/gl/manage/gl_accounts.php index 417d51d7..5bda0dcd 100644 --- a/gl/manage/gl_accounts.php +++ b/gl/manage/gl_accounts.php @@ -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.")); diff --git a/includes/hooks.inc b/includes/hooks.inc index 6c6dda32..d2096c17 100644 --- a/includes/hooks.inc +++ b/includes/hooks.inc @@ -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) diff --git a/install/lang/da_DK/LC_MESSAGES/da_DK.mo b/install/lang/da_DK/LC_MESSAGES/da_DK.mo index 824268ac91acc0c7037e38869f912edf9aa3e3bf..1b6dd4fea94d3148696abb56e8975b8754bcf87c 100644 GIT binary patch delta 3423 zcmaLXS!@+m9LMoPfl^RVixd=)1K5HB*9ugm$}Y%Kp;~c4P^Z0fFGJ_f)S0<0b>YSs z!C-<*aS5r$2jdcPt%Af4@+g$jje#AqDmM5kV9}G9u?wHXZCP79UsD(_!Q1!eDet>)9CmOHN*OG#>~KGjIjgB$$W^K$x$4S zCy>A5bn6Av*8Lf%{!38(>+u}ihD-5wR040}IL0^Ma-so#MrHgL_TzBU)%6`nZe};G z#Qms}e2Fc19Gh?&om#OqNSASNAx1a?pGKAHAkM*8v7i?mI&EJX(P>u?AzSXD+_l;-$^}tx|#j~iAoX+}>#0AKgY8K->T!OoYF$tW^^>1XOB_GGd zR-A{-(dYCD#7Pb1HF#g+@GVKJBfO(u8H-p<>V~Z zWj$J4joqjOUdDxZ6!pV8)-Az$^l%Sq^Ztr_>Sh>q>ca+P8<>5l#9u&7^i5QWKSm|? z^=#H(nf^|PHpSnlC8|HKRDx!#l5bn+b>5Oz8i@IYdlcL#RY*%>)xFHlJe~ zaVfEo(6Z|*P}54QjV__1=3lD0{yFIT)iSLm)U?Uevcw3&5;qX+pJG|yKkaI+ymF7~ zt9A*YJrEGxgqrpMm1gfSzUr}x$P+t=N?XT?YNs}zSV?HNtF@G<9xvqV3W9&0<`!ZB zv7A^>TuErRYk#dErV*DBY7LsdzHNP{+F)whfL+8qVg|8{xSntcHElfp%@_Yk={l`L zx#@Ggoam@@U@H+4`n0zaW>#Z7%Vs>^weC>c=o@OTPP@LFxHiluX(w^hw)#NIta5@N zOl&&r3;fXe-&>K}6Iw4wyF2yrp~p_yQZr^%==)CMg+c4kPh(#lRp_c*+x{?b`&A0!Oy*q)Kk&N3v}>!c zPnnL=9WRIzhu`;kw>nXJ;Kd28lbk3a&0=>kHQN(~U2Yr?{4nA8xjos);YICh+m%?a z8^t7Voy7XC6DPJM)tqV`IMOh=U=yd473_)JjJMNzrR3x7O23p8>&R+4oer62m`X0> zRcle=``_CLU$8KcT1&JGFoG#b4RpxCw+*c+>Bew7h z3PtzCDl;-!XmOs0Bq7%?{4wGO>8^_@|L>U^p< zY?>;1zU_?iS!%c`rw)>4PK+K|*Y`Qn*IRi=YY}(T?`27!rO(c_y+8O_7OPsu>g!YH z8r>>aYv9ht6%*UP?{u^MLAugeETJ0=yxVx9X;Z0sQK@{4m}5IqwMrR_)w2T!nh($ delta 2465 zcmY+^e@vBC9LMpmmn#VI8x*);-beye@&9{dY4 zaaWvK1|GmZJdC^_wBPB}^57rr$Ld?mit!kh<5yUPZr;{JYEcty!E_wN6*!Iw_&g@# z8+bdui~0BkuE86qg{1RxF5_DnodZ1RK*qAqQ8S*!MEng?@n7e8G7t5u>-y@O#L|zT~3+`z>msSMe#F*FEFgAo=2d+bA~TLDWjm;U@eB@4y6><-rQn3U_d+ zz;1NoBx);;;Ch@weSZeo1#|OHHGxFT#S9FV(y5`7heMc!uOi>Elc-dmcAj5EP4osb zd2_LR7p9;xkdCETj#{zb`TH<#=YAA-;2G3JQqstO8XXT8ePJW2NNP|sZ*!g>LdLY$ zP%C@~8}I{E?fik-(;^C@5}Q#gK8R1?i#Ui2s09Y7Ty60)E6Kl#;s_6@3;P7M!fDii zv#5#vgiPA5BV$?gs>PIhPy?;OYAnPp*oPbNIP$R>E=u{2xExooN)DPO2I&;hNyX=u zaojMQ`)Q`9l+NL9bTMtlwmrx}u`$$y$C2`|m#`h*Lal5bRV#5^_G2DuA+O_RoWhqe zc!^FKok2#e!lS4czD9i^i2~4yvyr)3G3t2}Y9j5Z%yglObQlZpO}q`ypfWs%T2K`G zG=jOv_k%V`hdJ0WR8f73`iJLHnYfH9#=lWp632hh@yfw%SdSWT0##I}P!s&vxj%;! z+|QtDXD74KdtF$m^B=goCVYb<4L3H&ob$#T1!wbcA{PkU^G67_hAsX;(62rlGiT& z0F|M>7r;>*#=Uq2Rh+H-xN!2U8~x+NIx59O zgi`v5^GruqZII9pk(yG^?@;8IPxnhLmX7LyT?j^wl#Y*w;E3A&gwDN=NCTm!D)$l( z5NZLUULB`(;e$&z_%P8-sD>UR)KtJaMHNIeQBIU;Q!?rF5XD3Xv7OjW6cK7FP&E}| zFQF5o>Q%d&c!;Rd4J|o*Id;GmemlO^6^>0h5ffUQ;R{VvxTxYp diff --git a/install/lang/da_DK/LC_MESSAGES/da_DK.po b/install/lang/da_DK/LC_MESSAGES/da_DK.po index 06fd3900..1d4408fa 100644 --- a/install/lang/da_DK/LC_MESSAGES/da_DK.po +++ b/install/lang/da_DK/LC_MESSAGES/da_DK.po @@ -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" diff --git a/install/lang/sv_SE/LC_MESSAGES/sv_SE.mo b/install/lang/sv_SE/LC_MESSAGES/sv_SE.mo index 104d2fae8dd7d0dbf6d1545454e84bed562eddc7..cbb9c18534371aaada644c369802e03158fbad45 100644 GIT binary patch delta 3433 zcmaLYe{5Cd9mny97K(snTBIml#{;FH1FkI<8P!S=MS(IpDvpVjJ?%X$hn{=R-8uKR zRwg%QD%)Q=u8?i9{4tGFXLP3g(Z#WBiJQiZ`G;n1S+eO;Ow3?^xXeFDHuwJAbKBvv z>`A}(b$;FRJkR(0Jh%Va^XmT6pBm<#G_)e|dE)h2V1iU1bXlq^zjNjhWwf1d|ZVmu?3&Qwe)Y^;$Q_AK1R*3VX-l* zuniOJL&jv@K+WVGT!I&nzshtQ1k=|2RjBK?psw%2FJM33hTlXD;5A%K|K`sesDr+Qn31gg#KSGu2C0vJRu%s8f z&jDpMjSN>ET2uyZz;^7xRy>B+;j^d?evV4{+tuqAPy?+aJ<7l}Sc5I746H%D?@rW& z$Ci+PJ@73q^x)&T7vDh*q=iCqXx5{?(2ZI|J*a_atJi;k%)vZ|n&A{~!(X7*Rt+mv zrQM1*V?S!bPc0??AqS_qFoN}s=?uqFwJc*EUqY>sW_oAcnJ&~!ccD5yfJ*%l)Ic9Y zl3~7!n!vND5=@~wK8suMjS>f49L%A&^|%$4>Hz7}oIvf07f>a+iu}*R4rHgAEw}-@ z@YEb8fxObxG^GPxj$h@x6Pcqqfg0fR$TBmfGu4CFQ4hY0m6TIh&7d27>_fJ&Ig7XA zn|KuGkyne4plbX>T#diP4*U=|<8p4^jQdan_zsf6k~zr%lQYj$Z~QF1VctZI_;+{% zUO>&Xkvd$Dcc3zoL;5gJVi8|Pb+Fo|?`=a(WGAY0_oEiCk4@VD4{@Lxo;znG^uf`_qLJc56t%VXQ1CQZ4e5QK-Hfm8`L{01p>Z0eaLuGt3mZ*X0 zfkb*7f9HBmJOy<05K=pWywvpzt4op8i{LW_o7SoyDbFRmoi+6X38 zX)2FOsNV>cPTADHS5v0d7NqD?^G_GkmoO%jrn?EXeJN%bRSruWBv?O{{}1q)b`NKM z^~$oUx1iQQNQ_jkX$??e)(-u%X3Ta%KORSjnYNPy)lN;@?{;FZPH5VOm$!CK_7F|P zHwgXmbrZXYuMpaP4a7EL1#t(V)~NY+5n4Q32sJIJL1F{3ir7kgjnKkUW7k#w4Qq?4 zWm77j89whK`YyZH$#F!~68G!++SX*P9r6RudXqg14%Xb0^#ZTp*{E2^x`LOrvkzp< zb{B?G!DgeeFo@j$y%l@;$ogT{dr&W*oLF>U&BE(9(D4bGg~@u+CW zTv)J$$QBbXV|NZ!uDRH=#V{#C6sJ%5L7+$MsEhrmnApID!$mjjCF^a%$Oj92!5@sW zo}GPt#`L9k{4gmvzCY$aQ+Sq+mB?+A?kBbB#?UTW|wpFdutE{)5&}2cI0)@Y6w&N3!V#93vlM zD!GVTg~KkiQRvwn+Zb#v@4|7W=7+=F;fpT!nK|rFyx8sx3tl|r20hy|GjH4HomlqT zqV|m&+S~2Mj?VUtlfPc}{n`T>dhG15%jH}!Tg8moO{YGuA#>TRvmtMtEphliZ~s>< z_cetzi)<3b428jFCa0QzGQTu?&Yhgi7VRftGU8&gRj@7`oer}uWA|3>Ovg4#rbp=5 z3j#jJRMYA+HVXU^XOnz%T k5F>YXIi-F-jr&#&*> z?ff&-X~r!WOC;3WJO)A1U1;qN#F zJMJ*^;dTt;OUUmdHb$j^hQDw#)=xB>hr<}e5v)Zozg8j*s6{&$b=72zQ}I`Z3nvD9*;o466XEQ6p^SQjHtY zi~CVaF@$sQHPrvlBdcIu9;yV=uo!(9siYF3G7Gn0KJG*QW5-cbeadaWgi7=llDv5s zz6Uc=GmwLo7(|V@+x>n3S8~4tTk$k1k<4u7KbuMc7yV%_YLkRenYX#^FCcx|AZmnf zU^Bjj+B?6Y*0h`rF&|q{Bi@DE@MY}BKT!khVdrXzpUY+bwJC;ZU|-lt)CfO8b$Ah# z*e^)ZHjeaV$$9Z9FF zu~E`fVq>@-(@C4Ytp}CRv&govy{?B)zdMRbFoBJtgmbYMOOXR+`%p7>7@xt&B`QHG z>!!w!*^4-z`;Sl^-A2tw5*tBNmW^r;pxWzDi7iDxcA^Hf2TSo?)X1-(mPnT;U^?=g zhz(NFgNIQ|a00dY&LDl;C~7Ij-S#AQ+6?aVa2eL2I^KyI;W1Q#@424F-Q1r;?VUEJ zRd!%V=YJCw?dHR%Q*azh@Jr-le{j+F1x4|Z`BBGhJ*vY_tim3w!68%vBdE2$jO1?L z;~Z4>x({GMgvtsk8gaM##gnKR8AMI-o2a#ZAGK-DqFykc<6Im^C0NWn>o`{860F8% zd>XY$KS0go8B~JbV1yH4KT^?D-bQuU%+s}rT2WIK#?{!5I>#rGpIXYy_zS2E)xieb zg1z_{evL}Jk!g)R5B0w=YN_|kV*XWeXi#RusLbAR?>|H(G=g5dic07QY{KiP5e9fY z&ckiUezsRo&pUxhcoseQ1!}K+g$bzrXC1JH(AtFwmBu)+XEg&B*zLe;3_b2p(WR9Q&$5}I0-`Z%#G z6A>$ku1jz!v6*NfG<#bKl|n)raWN5jm`fd@qI0hjAVS1);vr%kp`xi%$s@GRn$iae z6>UJ3eqwE`7N2_FN3k_`n_{GL)xKjDB340V0iku{h}tS*D#80Awzd%4Xv1|J|=2)zLxB~(@r+Jx0aG7%)Iv?w}iU4%AJJF$}JB+3aDZ9o;B*-eCA z&)T#q_YivR*6N0m5xtVy=ZU^PX^khEntm+Bndw{ZJn#G2ai-)u+4&bHR@9VN)D~6N qgerp3oB4+lqhr&$JkfB`krZcOw$C|O8g#xZz2RK<&u|_uYy206@#3BU diff --git a/install/lang/sv_SE/LC_MESSAGES/sv_SE.po b/install/lang/sv_SE/LC_MESSAGES/sv_SE.po index c9017dfb..b67290e3 100644 --- a/install/lang/sv_SE/LC_MESSAGES/sv_SE.po +++ b/install/lang/sv_SE/LC_MESSAGES/sv_SE.po @@ -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 \n" "Language-Team: Language \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" diff --git a/manufacturing/includes/db/work_order_issues_db.inc b/manufacturing/includes/db/work_order_issues_db.inc index cfc581d2..29bc02dd 100644 --- a/manufacturing/includes/db/work_order_issues_db.inc +++ b/manufacturing/includes/db/work_order_issues_db.inc @@ -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) { diff --git a/manufacturing/includes/db/work_order_produce_items_db.inc b/manufacturing/includes/db/work_order_produce_items_db.inc index 111feb4c..d2bbe0bd 100644 --- a/manufacturing/includes/db/work_order_produce_items_db.inc +++ b/manufacturing/includes/db/work_order_produce_items_db.inc @@ -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) { diff --git a/manufacturing/includes/db/work_orders_db.inc b/manufacturing/includes/db/work_orders_db.inc index 0d80d163..15ea30f7 100644 --- a/manufacturing/includes/db/work_orders_db.inc +++ b/manufacturing/includes/db/work_orders_db.inc @@ -9,6 +9,236 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License here . ***********************************************************************/ +//-------------------------------------------------------------------------------------- + +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); diff --git a/manufacturing/includes/db/work_orders_quick_db.inc b/manufacturing/includes/db/work_orders_quick_db.inc index 4aa2a176..e07ec8f3 100644 --- a/manufacturing/includes/db/work_orders_quick_db.inc +++ b/manufacturing/includes/db/work_orders_quick_db.inc @@ -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); + } } diff --git a/manufacturing/includes/manufacturing_db.inc b/manufacturing/includes/manufacturing_db.inc index 16428eec..d42375c9 100644 --- a/manufacturing/includes/manufacturing_db.inc +++ b/manufacturing/includes/manufacturing_db.inc @@ -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"); diff --git a/manufacturing/includes/manufacturing_ui.inc b/manufacturing/includes/manufacturing_ui.inc index 2d55477b..b95d2641 100644 --- a/manufacturing/includes/manufacturing_ui.inc +++ b/manufacturing/includes/manufacturing_ui.inc @@ -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'])); diff --git a/manufacturing/work_order_costs.php b/manufacturing/work_order_costs.php index a76c5f5e..eb089384 100644 --- a/manufacturing/work_order_costs.php +++ b/manufacturing/work_order_costs.php @@ -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']); } diff --git a/purchasing/includes/db/grn_db.inc b/purchasing/includes/db/grn_db.inc index d3bed587..90d84eb4 100644 --- a/purchasing/includes/db/grn_db.inc +++ b/purchasing/includes/db/grn_db.inc @@ -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 */ diff --git a/purchasing/includes/po_class.inc b/purchasing/includes/po_class.inc index 7fdef203..b197cb03 100644 --- a/purchasing/includes/po_class.inc +++ b/purchasing/includes/po_class.inc @@ -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); + } } diff --git a/reporting/includes/html_entity_decode_php4.php b/reporting/includes/html_entity_decode_php4.php index f5c21d8b..df1c7555 100644 --- a/reporting/includes/html_entity_decode_php4.php +++ b/reporting/includes/html_entity_decode_php4.php @@ -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); } diff --git a/reporting/rep107.php b/reporting/rep107.php index 4de23cc4..1e9cc148 100644 --- a/reporting/rep107.php +++ b/reporting/rep107.php @@ -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)) diff --git a/reporting/rep109.php b/reporting/rep109.php index 53df06f6..e5a92199 100644 --- a/reporting/rep109.php +++ b/reporting/rep109.php @@ -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); diff --git a/reporting/rep110.php b/reporting/rep110.php index 9fc2780a..6b083097 100644 --- a/reporting/rep110.php +++ b/reporting/rep110.php @@ -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)) diff --git a/reporting/rep111.php b/reporting/rep111.php index ecf9fc19..a75e44ef 100644 --- a/reporting/rep111.php +++ b/reporting/rep111.php @@ -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); diff --git a/reporting/rep113.php b/reporting/rep113.php index b1f93190..742738ab 100644 --- a/reporting/rep113.php +++ b/reporting/rep113.php @@ -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); diff --git a/reporting/rep709.php b/reporting/rep709.php index 9bfdc0a7..9a4b2a52 100644 --- a/reporting/rep709.php +++ b/reporting/rep709.php @@ -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"); } diff --git a/sales/view/view_credit.php b/sales/view/view_credit.php index d126fd48..a6f70980 100644 --- a/sales/view/view_credit.php +++ b/sales/view/view_credit.php @@ -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); diff --git a/sales/view/view_dispatch.php b/sales/view/view_dispatch.php index 300c67f4..8c1b0313 100644 --- a/sales/view/view_dispatch.php +++ b/sales/view/view_dispatch.php @@ -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); diff --git a/sales/view/view_invoice.php b/sales/view/view_invoice.php index db9ab103..2c53b622 100644 --- a/sales/view/view_invoice.php +++ b/sales/view/view_invoice.php @@ -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); diff --git a/sales/view/view_sales_order.php b/sales/view/view_sales_order.php index 6014aeaf..5aa606d9 100644 --- a/sales/view/view_sales_order.php +++ b/sales/view/view_sales_order.php @@ -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; -- 2.30.2