Page 1 of 1

apptication error

Posted: 2020-04-18 19:08
by Mahmud
when i change xampp to cwp hosting its error

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' `Bill`.`id` as 'Bill.id' from `Bill` LEFT JOIN `cash_book` as cash_book1 ON `ca' at line 1

Query:
SELECT , `Bill`.`id` as 'Bill.id' from `Bill` LEFT JOIN `cash_book` as cash_book1 ON `cash_book1`.`id`=`Bill`.`ACCOUNT_NAME` LEFT JOIN `Customer` as Customer1 ON `Customer1`.`id`=`Bill`.`Name` order by `Bill`.`date` desc limit 0,2000

The above info is displayed because you are currently signed in as the super admin. Other users won't see this.

You could try fixing this issue from the Admin Area : Utilities menu : Rebuild Fields.

Re: apptication error

Posted: 2020-04-18 19:09
by Mahmud
Bill Hook file
================

<?php
// For help on using hooks, please refer to https://bigprof.com/appgini/help/workin ... tion/hooks

function Bill_init(&$options, $memberInfo, &$args){

// modify the PAYMENT_STATUS field of the table view query to display 'Due' invoices in bold red
$oldArray=$options->QueryFieldsTV;
$options->QueryFieldsTV='';
foreach($oldArray as $field => $caption){
if($field=='`Bill`.`PAYMENT_STATUS`'){
$options->QueryFieldsTV['IF(`Bill`.`PAYMENT_STATUS`=\'PAID\', \'<b style="color: yellow;">PAID</b>\', IF(`Bill`.`PAYMENT_STATUS`=\'DUE\', \'<b style="color: red;">DUE</b>\', `Bill`.`PAYMENT_STATUS`))']=$caption;
}else{
$options->QueryFieldsTV[$field]=$caption;
}
}

return TRUE;
}

function Bill_header($contentType, $memberInfo, &$args){
$header='';

switch($contentType){
case 'tableview':
$header='';
break;

case 'detailview':
$header='';
break;

case 'tableview+detailview':
$header='';
break;

case 'print-tableview':
$header='';
break;

case 'print-detailview':
$header='';
break;

case 'filters':
$header='';
break;
}

return $header;
}

function Bill_footer($contentType, $memberInfo, &$args){
$footer='';

switch($contentType){
case 'tableview':
$footer='';
break;

case 'detailview':
$footer='';
break;

case 'tableview+detailview':
$footer='';
break;

case 'print-tableview':
$footer='';
break;

case 'print-detailview':
$footer='';
break;

case 'filters':
$footer='';
break;
}

return $footer;
}

function Bill_before_insert(&$data, $memberInfo, &$args){
$data['due_taka'] = $data['total'] - $data['nogot_joma'];

return TRUE;
}

function Bill_after_insert($data, $memberInfo, &$args){
update_balances($data);

return TRUE;
}

function Bill_before_update(&$data, $memberInfo, &$args){
$data['due_taka'] = $data['total'] - $data['nogot_joma'];

return TRUE;
}

function Bill_after_update($data, $memberInfo, &$args){
update_balances($data);

return TRUE;
}

function Bill_before_delete($selectedID, &$skipChecks, $memberInfo, &$args){
$res = sql("select * from Bill where id='{$selectedID}'", $eo);
$GLOBALS['deleted_data'] = db_fetch_assoc($res);

return TRUE;
}

function Bill_after_delete($selectedID, $memberInfo, &$args){
update_balances($GLOBALS['deleted_data']);

}

function Bill_dv($selectedID, $memberInfo, &$html, &$args){

}

function Bill_csv($query, $memberInfo, &$args){

return $query;
}
function Bill_batch_actions(&$args){

return array();
}

function transactions_batch_actions(&$args){

return array();
}


function update_balances($data){

$ACCOUNT_NAME = intval($data['ACCOUNT_NAME']);

/*
Comma-separated list of all transaction types (each enclosed in single quotes) that add
to inventory -- others are assumed to subtract from inventory
*/
$positive_transactions = "'PAID,DUE'";




/* get sum of all ACCOUNT_NAME funded_transaction and update ACCOUNT_NAME BALANCE */

/* get sum of all item transactions and update item balance */
if($ACCOUNT_NAME){
$ACCOUNT_NAME_balance = sqlValue("select sum(if(PAYMENT_STATUS in ({$positive_transactions}), nogot_joma, 1 * nogot_joma)) from Bill where ACCOUNT_NAME={$ACCOUNT_NAME}");
sql("update cash_book set balance='{$ACCOUNT_NAME_balance}' where id={$ACCOUNT_NAME}", $eo);
include('dbcon.php');
$query=mysql_query("select * from cash_book where id={$ACCOUNT_NAME} ")or die(mysql_error());
$row=mysql_fetch_array($query);
$ALANCE=$row['balance']- $row['expense'];
sql("UPDATE cash_book SET total_balance= '{$ALANCE}' where id={$ACCOUNT_NAME}", $eo);
}


/* get sum of all item pur and update item balance */




/* get sum of all ACCOUNT_NAME funded_transaction and update ACCOUNT_NAME BALANCE */


/* get sum of all ACCOUNT_NAME funded_transaction and update ACCOUNT_NAME BALANCE */


}

Re: apptication error

Posted: 2020-04-18 21:36
by pbottcher
Hi,

can you check you database setting for case-sensitivity. I would guess that causes your error.