preferences没有php,CompanyPreferences.php

/* $Id: CompanyPreferences.php 6942 2014-10-27 02:48:29Z daintree $*/

include('includes/session.inc');

$Title = _('Company Preferences');

/* webERP manual links before header.inc */

$ViewTopic= 'CreatingNewSystem';

$BookMark = 'CompanyParameters';

include('includes/header.inc');

if (isset($Errors)) {

unset($Errors);

}

//initialise no input errors assumed initially before we test

$InputError = 0;

$Errors = array();

$i=1;

if (isset($_POST['submit'])) {

/* actions to take once the user has clicked the submit button

ie the page has called itself with some user input */

//first off validate inputs sensible

if (mb_strlen($_POST['CoyName']) > 50 OR mb_strlen($_POST['CoyName'])==0) {

$InputError = 1;

prnMsg(_('The company name must be entered and be fifty characters or less long'), 'error');

$Errors[$i] = 'CoyName';

$i++;

}

if (mb_strlen($_POST['Email'])>0 and !IsEmailAddress($_POST['Email'])) {

$InputError = 1;

prnMsg(_('The email address is not correctly formed'),'error');

$Errors[$i] = 'Email';

$i++;

}

if ($InputError !=1){

$sql = "UPDATE companies SET coyname='" . $_POST['CoyName'] . "',

companynumber = '" . $_POST['CompanyNumber'] . "',

gstno='" . $_POST['GSTNo'] . "',

regoffice1='" . $_POST['RegOffice1'] . "',

regoffice2='" . $_POST['RegOffice2'] . "',

regoffice3='" . $_POST['RegOffice3'] . "',

regoffice4='" . $_POST['RegOffice4'] . "',

regoffice5='" . $_POST['RegOffice5'] . "',

regoffice6='" . $_POST['RegOffice6'] . "',

telephone='" . $_POST['Telephone'] . "',

fax='" . $_POST['Fax'] . "',

email='" . $_POST['Email'] . "',

currencydefault='" . $_POST['CurrencyDefault'] . "',

debtorsact='" . $_POST['DebtorsAct'] . "',

pytdiscountact='" . $_POST['PytDiscountAct'] . "',

creditorsact='" . $_POST['CreditorsAct'] . "',

payrollact='" . $_POST['PayrollAct'] . "',

grnact='" . $_POST['GRNAct'] . "',

exchangediffact='" . $_POST['ExchangeDiffAct'] . "',

purchasesexchangediffact='" . $_POST['PurchasesExchangeDiffAct'] . "',

retainedearnings='" . $_POST['RetainedEarnings'] . "',

gllink_debtors='" . $_POST['GLLink_Debtors'] . "',

gllink_creditors='" . $_POST['GLLink_Creditors'] . "',

gllink_stock='" . $_POST['GLLink_Stock'] ."',

freightact='" . $_POST['FreightAct'] . "'

WHERE coycode=1";

$ErrMsg = _('The company preferences could not be updated because');

$result = DB_query($sql,$ErrMsg);

prnMsg( _('Company preferences updated'),'success');

/* Alter the exchange rates in the currencies table */

/* Get default currency rate */

$sql="SELECT rate from currencies WHERE currabrev='" . $_POST['CurrencyDefault'] . "'";

$result = DB_query($sql);

$myrow = DB_fetch_row($result);

$NewCurrencyRate=$myrow[0];

/* Set new rates */

$sql="UPDATE currencies SET rate=rate/" . $NewCurrencyRate;

$ErrMsg = _('Could not update the currency rates');

$result = DB_query($sql,$ErrMsg);

/* End of update currencies */

$ForceConfigReload = True; // Required to force a load even if stored in the session vars

include('includes/GetConfig.php');

$ForceConfigReload = False;

} else {

prnMsg( _('Validation failed') . ', ' . _('no updates or deletes took place'),'warn');

}

} /* end of if submit */

echo '

' . ' ' . $Title . '

';

echo '

';

echo '

';

echo '';

echo '

if ($InputError != 1) {

$sql = "SELECT coyname,

gstno,

companynumber,

regoffice1,

regoffice2,

regoffice3,

regoffice4,

regoffice5,

regoffice6,

telephone,

fax,

email,

currencydefault,

debtorsact,

pytdiscountact,

creditorsact,

payrollact,

grnact,

exchangediffact,

purchasesexchangediffact,

retainedearnings,

gllink_debtors,

gllink_creditors,

gllink_stock,

freightact

FROM companies

WHERE coycode=1";

$ErrMsg = _('The company preferences could not be retrieved because');

$result = DB_query($sql,$ErrMsg);

$myrow = DB_fetch_array($result);

$_POST['CoyName'] = $myrow['coyname'];

$_POST['GSTNo'] = $myrow['gstno'];

$_POST['CompanyNumber'] = $myrow['companynumber'];

$_POST['RegOffice1'] = $myrow['regoffice1'];

$_POST['RegOffice2'] = $myrow['regoffice2'];

$_POST['RegOffice3'] = $myrow['regoffice3'];

$_POST['RegOffice4'] = $myrow['regoffice4'];

$_POST['RegOffice5'] = $myrow['regoffice5'];

$_POST['RegOffice6'] = $myrow['regoffice6'];

$_POST['Telephone'] = $myrow['telephone'];

$_POST['Fax'] = $myrow['fax'];

$_POST['Email'] = $myrow['email'];

$_POST['CurrencyDefault'] = $myrow['currencydefault'];

$_POST['DebtorsAct'] = $myrow['debtorsact'];

$_POST['PytDiscountAct'] = $myrow['pytdiscountact'];

$_POST['CreditorsAct'] = $myrow['creditorsact'];

$_POST['PayrollAct'] = $myrow['payrollact'];

$_POST['GRNAct'] = $myrow['grnact'];

$_POST['ExchangeDiffAct'] = $myrow['exchangediffact'];

$_POST['PurchasesExchangeDiffAct'] = $myrow['purchasesexchangediffact'];

$_POST['RetainedEarnings'] = $myrow['retainedearnings'];

$_POST['GLLink_Debtors'] = $myrow['gllink_debtors'];

$_POST['GLLink_Creditors'] = $myrow['gllink_creditors'];

$_POST['GLLink_Stock'] = $myrow['gllink_stock'];

$_POST['FreightAct'] = $myrow['freightact'];

}

echo '

' . _('Name') . ' (' . _('to appear on reports') . '):';

echo '

' . _('Official Company Number') . ':';

echo '

' . _('Tax Authority Reference') . ':';

echo '

' . _('Address Line 1') . ':';

echo '

' . _('Address Line 2') . ':';

echo '

' . _('Address Line 3') . ':';

echo '

' . _('Address Line 4') . ':';

echo '

' . _('Address Line 5') . ':';

echo '

' . _('Address Line 6') . ':';

echo '

' . _('Telephone Number') . ':';

echo '

' . _('Facsimile Number') . ':';

echo '

' . _('Email Address') . ':';

$result=DB_query("SELECT currabrev, currency FROM currencies");

include('includes/CurrenciesArray.php'); // To get the currency name from the currency code.

echo '

' . _('Home Currency') . ':';

while ($myrow = DB_fetch_array($result)) {

if ($_POST['CurrencyDefault']==$myrow['currabrev']){

echo '' . $CurrencyName[$myrow['currabrev']] . '';

} else {

echo '' . $CurrencyName[$myrow['currabrev']] . '';

}

} //end while loop

DB_free_result($result);

echo '

';

$result=DB_query("SELECT accountcode,

accountname

FROM chartmaster INNER JOIN accountgroups

ON chartmaster.group_=accountgroups.groupname

WHERE accountgroups.pandl=0

ORDER BY chartmaster.accountcode");

echo '

' . _('Debtors Control GL Account') . ':';

while ($myrow = DB_fetch_row($result)) {

if ($_POST['DebtorsAct']==$myrow[0]){

echo '' . htmlspecialchars($myrow[1],ENT_QUOTES,'UTF-8') . ' ('.$myrow[0].')';

} else {

echo '' . htmlspecialchars($myrow[1],ENT_QUOTES,'UTF-8') . ' ('.$myrow[0].')';

}

} //end while loop

DB_data_seek($result,0);

echo '

';

echo '

' . _('Creditors Control GL Account') . ':';

while ($myrow = DB_fetch_row($result)) {

if ($_POST['CreditorsAct']==$myrow[0]){

echo '' . htmlspecialchars($myrow[1],ENT_QUOTES,'UTF-8') . ' ('.$myrow[0].')';

} else {

echo '' . htmlspecialchars($myrow[1],ENT_QUOTES,'UTF-8') . ' ('.$myrow[0].')';

}

} //end while loop

DB_data_seek($result,0);

echo '

';

echo '

' . _('Payroll Net Pay Clearing GL Account') . ':';

while ($myrow = DB_fetch_row($result)) {

if ($_POST['PayrollAct']==$myrow[0]){

echo '' . htmlspecialchars($myrow[1],ENT_QUOTES,'UTF-8') . ' ('.$myrow[0].')';

} else {

echo '' . htmlspecialchars($myrow[1],ENT_QUOTES,'UTF-8') . ' ('.$myrow[0].')';

}

} //end while loop

DB_data_seek($result,0);

echo '

';

echo '

' . _('Goods Received Clearing GL Account') . ':';

while ($myrow = DB_fetch_row($result)) {

if ($_POST['GRNAct']==$myrow[0]){

echo '' . htmlspecialchars($myrow[1],ENT_QUOTES,'UTF-8') . ' ('.$myrow[0].')';

} else {

echo '' . htmlspecialchars($myrow[1],ENT_QUOTES,'UTF-8') . ' ('.$myrow[0].')';

}

} //end while loop

DB_data_seek($result,0);

echo '

';

echo '

' . _('Retained Earning Clearing GL Account') . ':';

while ($myrow = DB_fetch_row($result)) {

if ($_POST['RetainedEarnings']==$myrow[0]){

echo '' . htmlspecialchars($myrow[1],ENT_QUOTES,'UTF-8') . ' ('.$myrow[0].')';

} else {

echo '' . htmlspecialchars($myrow[1],ENT_QUOTES,'UTF-8') . ' ('.$myrow[0].')';

}

} //end while loop

DB_free_result($result);

echo '

';

echo '

' . _('Freight Re-charged GL Account') . ':';

$result=DB_query("SELECT accountcode,

accountname

FROM chartmaster INNER JOIN accountgroups

ON chartmaster.group_=accountgroups.groupname

WHERE accountgroups.pandl=1

ORDER BY chartmaster.accountcode");

while ($myrow = DB_fetch_row($result)) {

if ($_POST['FreightAct']==$myrow[0]){

echo '' . htmlspecialchars($myrow[1],ENT_QUOTES,'UTF-8') . ' ('.$myrow[0].')';

} else {

echo '' . htmlspecialchars($myrow[1],ENT_QUOTES,'UTF-8') . ' ('.$myrow[0].')';

}

} //end while loop

DB_data_seek($result,0);

echo '

';

echo '

' . _('Sales Exchange Variances GL Account') . ':';

while ($myrow = DB_fetch_row($result)) {

if ($_POST['ExchangeDiffAct']==$myrow[0]){

echo '' . htmlspecialchars($myrow[1],ENT_QUOTES,'UTF-8') . ' ('.$myrow[0].')';

} else {

echo '' . htmlspecialchars($myrow[1],ENT_QUOTES,'UTF-8') . ' ('.$myrow[0].')';

}

} //end while loop

DB_data_seek($result,0);

echo '

';

echo '

' . _('Purchases Exchange Variances GL Account') . ':';

while ($myrow = DB_fetch_row($result)) {

if ($_POST['PurchasesExchangeDiffAct']==$myrow[0]){

echo '' . htmlspecialchars($myrow[1],ENT_QUOTES,'UTF-8') . ' ('.$myrow[0].')';

} else {

echo '' . htmlspecialchars($myrow[1],ENT_QUOTES,'UTF-8') . ' ('.$myrow[0].')';

}

} //end while loop

DB_data_seek($result,0);

echo '

';

echo '

' . _('Payment Discount GL Account') . ':';

while ($myrow = DB_fetch_row($result)) {

if ($_POST['PytDiscountAct']==$myrow[0]){

echo '' . htmlspecialchars($myrow[1],ENT_QUOTES,'UTF-8') . ' ('.$myrow[0].')';

} else {

echo '' . htmlspecialchars($myrow[1],ENT_QUOTES,'UTF-8') . ' ('.$myrow[0].')';

}

} //end while loop

DB_data_seek($result,0);

echo '

';

echo '

' . _('Create GL entries for accounts receivable transactions') . ':';

if ($_POST['GLLink_Debtors']==0){

echo '' . _('No') . '';

echo '' . _('Yes'). '';

} else {

echo '' . _('Yes'). '';

echo '' . _('No'). '';

}

echo '

';

echo '

' . _('Create GL entries for accounts payable transactions') . ':';

if ($_POST['GLLink_Creditors']==0){

echo '' . _('No') . '';

echo '' . _('Yes') . '';

} else {

echo '' . _('Yes') . '';

echo '' . _('No') . '';

}

echo '

';

echo '

' . _('Create GL entries for stock transactions') . ':';

if ($_POST['GLLink_Stock']=='0'){

echo '' . _('No') . '';

echo '' . _('Yes') . '';

} else {

echo '' . _('Yes') . '';

echo '' . _('No') . '';

}

echo '

';

echo '

echo '

';

include('includes/footer.inc');

?>

一键复制

编辑

Web IDE

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值