Jump to content

l0ve2hat3

Members
  • Posts

    312
  • Joined

  • Last visited

    Never

Everything posted by l0ve2hat3

  1. i think you could just disable the mysql and php service and then install wamp... all that time spend configuring and installing php and mysql... while wamp installs everything in a matter of minutes...
  2. just download wamp server, it has gd support built in. http://www.wampserver.com/en/
  3. From everyones experience, what is the easiest customizable PHP shopping cart out there?
  4. i just want to know the string to use to determin numbers and - only... no specific order... 123-123-1234 is valid 12-1234-4561 is valid 111111111 is vaild (454) 456-4564 is NOT valid cell- 212-4564-4564 is NOT valid -------- is NOT valid this is what i came up with, but it doesnt work $test="/(\d+\-?)/" Please help...
  5. max_execution_time=300 and i think u need = signs max_execution_time =10800 max_input_time =10800 memory_limit =64M
  6. well thanks for all the help! i founnd my solution: <?php $server = "0.0.0.0"; //valid IP $username = "username"; //valid User Name $password = "Password"; //valid Password $connection = ssh2_connect($server, 22); // use any of the ssh2_auth_* methods ssh2_auth_password($connection,$username, $password); $sftp = ssh2_sftp($connection); $dir = "ssh2.sftp://$sftp/a/"; $dh = opendir($dir); while (false !== ($file = readdir($dh))){ echo "$file <br>"; } closedir($dh); ?>
  7. I am trying to list and download files from a remote server that only accepts SFTP not FTPS (they are different... google it) so ftp_ssl_connect() will not work for me. now is it possible to connect via exec using the sftp command? if so how?
  8. how can i do it using $GLOBALS?? foreach($GLOBALS as $var)unset($GLOBALS[$var]); doesnt work
  9. actually not google, boss. im signed up on phpclasses.com.
  10. well i just want to know how to unset all variable...
  11. lol u want to see the code? yeah maybe u'll understand y <?php error_reporting(0); ini_set(max_execution_time,999); include("functions.php"); //check_posclient_login(); //declared Variables $buy_back_text=$CONFIG[buy_back_text]; $gift_cert_text=$CONFIG[gift_cert_text]; $party_payment_text=$CONFIG[party_payment_text]; $cc_credit_text=$CONFIG[cc_credit_text]; $additional_discounts=$CONFIG[additional_discounts]; $additional_comps=$CONFIG[additional_comps]; $exceptions_reasons[1]=$CONFIG[exceptions_reasons][1]; $exceptions_reasons[2]=$CONFIG[exceptions_reasons][2]; $exceptions_reasons[3]=$CONFIG[exceptions_reasons][3]; $exceptions_reasons[4]=$CONFIG[exceptions_reasons][4]; //company name $sql1='SELECT [Company_Info_1] FROM [setup]'; $template['company_name']=mssql_result(mssql_query($sql1),0,0); //for($p=1;$p<=3;$p++{ //////////////// //START END TIME $TIMEsql='SELECT TOP 100 * FROM [End_Of_Day] ORDER BY [EndDateTime] DESC'; $TIMEres=mssql_query($TIMEsql); while($TIMErow=mssql_fetch_assoc($TIMEres)){ $i++; if($i==1&&$_GET[index]=='')$_GET[index]=$TIMErow['Close_Out_Index']; $template['select'].='<OPTION value="'.$TIMErow['Close_Out_Index'].'">'.$TIMErow['StartDateTime'].' - '.$TIMErow['EndDateTime'].'</OPTION>'; } $TIMEsql="SELECT * FROM [End_Of_Day] WHERE [Close_Out_Index]='$_GET[index]'"; $TIMEres=mssql_query($TIMEsql); $TIMErow=mssql_fetch_assoc($TIMEres); $shift_start=$TIMErow['StartDateTime']; $shift_end=$TIMErow['EndDateTime']; $template['from_period']=$shift_start; $template['to_period']=$shift_end; $template['to_period_day']=date('l',strtotime($shift_end)); //END START END TIME //////////////////// $where='DateTime >= \''.$shift_start.'\' AND DateTime <= \''.$shift_end.'\''; //General Totals And Money Track $sql_numbers='SELECT * FROM [invoice_Totals] WHERE '.$where.' ORDER BY [invoice_Number] ASC'; $res_numbers=mssql_query($sql_numbers)or die($sql_numbers."<br>".mssql_get_last_message().": $sql_numbers"); while($row_numbers=mssql_fetch_assoc($res_numbers)){ //only do also this stuff if it's not voided if($row_numbers['Status']!="V"){ //General Totals $template['var13']+=$row_numbers['Total_Price']; $template['var14']+=$row_numbers['Total_Tax1'] + $row_numbers['Total_Tax2'] + $row_numbers['Total_Tax3']; $template['var15']+=$row_numbers['Grand_Total']; ////TESTING ONLY $row_numbers['Cashier_ID']=($row_numbers['Cashier_ID']=='')?'NO CASHIER ID ON INVOICE':$row_numbers['Cashier_ID']; // $empTOTAL[$row_numbers[Cashier_ID]][Total_Price]+=$row_numbers['Total_Price']; // $empTOTAL[$row_numbers[Cashier_ID]][CA_Amount]+=$row_numbers['CA_Amount']; // $empTOTAL[$row_numbers[Cashier_ID]][Total_Tax]+=$row_numbers['Total_Tax1'] + $row_numbers['Total_Tax2'] + $row_numbers['Total_Tax3']; // $empTOTAL[$row_numbers[Cashier_ID]][Grand_Total]+=$row_numbers['Grand_Total']; // $empTOTAL[$row_numbers[Cashier_ID]][Cashier_ID]=$row_numbers['Cashier_ID']; $empTOTAL[$row_numbers[Cashier_ID]]+=$row_numbers['CA_Amount']; //total checks $template['var55']++; //total guests $template['var56']+=$row_numbers['Num_People_Party']; if($row_numbers['Acc_Balance_due']>0){ $template['checks_outstanding_num']++; $template['checks_outstanding']+=$row_numbers['Acc_Balance_due']; }else{ $template['checks_outstanding_num']+=0; $template['checks_outstanding']+=0; } //Money Track - Cash if($row_numbers['CA_Amount']>0){ $template['var16']++; $template['var17']+=$row_numbers['CA_Amount']; } if($row_numbers['Payment_Method']=="CA"){ //Money Track - Applied Gratuity Part 1 if($row_numbers['Tip_Amount']>0){ $template['var21']++; $template['var22']+=$row_numbers['Tip_Amount']; } } if($row_numbers['Payment_Method']=="ST" || $row_numbers['Payment_Method']=="CC"){ //Money Track - CC Tips + Applied Gratuity $sub_amount_sum=0; $sql_sub_tip='SELECT * From [CC_Trans] WHERE [CRENumber] ='.$row_numbers['Invoice_Number']; $sub_tip_res=mssql_query($sql_sub_tip); while($sub_tip_row=mssql_fetch_assoc($sub_tip_res)){ //Money Track - CC Tips if($sub_tip_row['TipAmount']>0){ $template['var19']++; $template['var18']+=$sub_tip_row['TipAmount']; //old applied grat //$sub_tip_sum+=$sub_tip_row['TipAmount']; } //new applied grat $sub_amount_sum+=$sub_tip_row['Amount']; //Payment Breakdown For CC Array Fill $cc_breakdown[$sub_tip_row['Type']]['count']++; $cc_breakdown[$sub_tip_row['Type']]['sum']+=$sub_tip_row['TipAmount']+$sub_tip_row['Amount']; $cc_breakdown['ALL']['count']++; $cc_breakdown['ALL']['sum']+=$sub_tip_row['TipAmount']+$sub_tip_row['Amount']; //Credit Cards Itemized if($count_cc++%2==1) $bgcolor_cc='white'; else $bgcolor_cc='lightgray'; $template['cc_itemized'].='<TR style="background-color:'.$bgcolor_cc.'"><TD align=center>'.$sub_tip_row['Type'].'</TD><TD align=center>'.substr($sub_tip_row['Number'],-4).'</TD><TD align=center>$'.number_format($sub_tip_row['Amount'],2,'.','').'</TD><TD align=center>$'.number_format($sub_tip_row['TipAmount'],2,'.','').'</TD><TD align=center>$'.number_format($sub_tip_row['TipAmount']+$sub_tip_row['Amount'],2,'.','').'</TD><TD align=center>'.$row_numbers['Invoice_Number'].'</TD></TR>'; } //Money Track - Applied Gratuity Part 2 //old applied grat //$sub_applied=$row_numbers['Tip_Amount']-$sub_tip_sum; //new applied grat $sub_applied=$sub_amount_sum-($row_numbers['Grand_Total']-$row_numbers['Amt_Tendered']+$row_numbers['Amt_Change']); if($sub_applied>0){ $template['var21']++; $template['var22']+=$sub_applied; } } if($row_numbers['Payment_Method']=="ST" || $row_numbers['Payment_Method']=="CH"){ //Payment Breakdown For Gift Certificates $sql_sub_gc='SELECT SUM([Amount]) AS [sum], COUNT([Amount]) AS [count] From [CH_Trans] WHERE [Trans_Number] ='.$row_numbers['Invoice_Number']; $sub_gc_row=mssql_fetch_assoc(mssql_query($sql_sub_gc)); $template['var36']+=$sub_gc_row['count']; $template['var37']+=$sub_gc_row['sum']; } //Invoice Exceptions $sql_exceptions='SELECT * FROM [invoice_Exceptions] LEFT JOIN [inventory] ON [invoice_Exceptions].[itemNum]=[inventory].[itemNum] WHERE [invoice_Number] ='.$row_numbers['Invoice_Number']; $exceptions_res=mssql_query($sql_exceptions); while($exceptions_row=mssql_fetch_assoc($exceptions_res)){ if($exceptions_row['Amount']>0){ if($exceptions_row['Exception_Type']==2 && $exceptions_row['Reason_Code']==$buy_back_text){ $exceptions_row['Exception_Type']=4; } $exceptions_breakdown[$exceptions_row['Exception_Type']]['count']++; $exceptions_breakdown[$exceptions_row['Exception_Type']]['sum']+=$exceptions_row['Amount']; $exceptions_row['ItemName']=substr($exceptions_row['ItemName'],0,20); $exceptions_row['Reason_Code']=substr($exceptions_row['Reason_Code'],0,20); $exceptions_row['Reason_Code']=substr($exceptions_row['Reason_Code'],0,20); if($exceptions_row['Exception_Type']==3){ $row_discount=($exceptions_row['Amount']/$exceptions_row['Price'])*100; $discount_disp=' ('.$row_discount.'%)'; } if($count_exceptions++%2==1) $bgcolor_exceptions='white'; else $bgcolor_exceptions='lightgray'; $template['exceptions_itemized'].='<TR style="background-color:'.$bgcolor_exceptions.'"><TD align=center>'.$exceptions_reasons[$exceptions_row['Exception_Type']].'</TD><TD align=center>'.$exceptions_row['ItemName'].'</TD><TD align=center>$'.number_format($exceptions_row['Amount'],2,'.','').' '.$discount_disp.'</TD><TD align=center>'.$exceptions_row['Reason_Code'].'</TD><TD align=center>'.$exceptions_row['Invoice_Number'].'</TD></TR>'; } } //additional discounts $additional_discounts_string=''; foreach($additional_discounts as $additional_discount){ $additional_discounts_string.='OR [itemNum] = \''.$additional_discount.'\''; } $additional_discounts_string='('.substr($additional_discounts_string,3).') AND'; $sql_additional_discounts='SELECT * FROM [invoice_Itemized] WHERE '.$additional_discounts_string.' [invoice_Number] ='.$row_numbers['Invoice_Number']; $additional_discounts_res=mssql_query($sql_additional_discounts); while($additional_discounts_row=mssql_fetch_assoc($additional_discounts_res)){ $additional_discounts_row['PricePer']=abs($additional_discounts_row['PricePer']); $template['var49']++; $template['var50']+=$additional_discounts_row['PricePer']; if($count_exceptions++%2==1) $bgcolor_exceptions='white'; else $bgcolor_exceptions='lightgray'; $template['exceptions_itemized'].='<TR style="background-color:'.$bgcolor_exceptions.'"><TD align=center>Discount</TD><TD align=center>Entire Check</TD><TD align=center>$'.number_format($additional_discounts_row['PricePer'],2,'.','').'</TD><TD align=center>'.$additional_discounts_row['ItemNum'].'</TD><TD align=center>'.$additional_discounts_row['Invoice_Number'].'</TD></TR>'; } //additional comps $additional_comps_string=''; foreach($additional_comps as $additional_comp){ $additional_comps_string.='OR [itemNum] = \''.$additional_comp.'\''; } $additional_comps_string='('.substr($additional_comps_string,3).') AND'; $sql_additional_comps='SELECT * FROM [invoice_Itemized] WHERE '.$additional_comps_string.' [invoice_Number] ='.$row_numbers['Invoice_Number']; $additional_comps_res=mssql_query($sql_additional_comps); while($additional_comps_row=mssql_fetch_assoc($additional_comps_res)){ $additional_comps_row['PricePer']=abs($additional_comps_row['PricePer']); $template['var47']++; $template['var48']+=$additional_comps_row['PricePer']; if($count_exceptions++%2==1) $bgcolor_exceptions='white'; else $bgcolor_exceptions='lightgray'; $template['exceptions_itemized'].='<TR style="background-color:'.$bgcolor_exceptions.'"><TD align=center>Comp</TD><TD align=center>Entire Check</TD><TD align=center>$'.number_format($additional_comps_row['PricePer'],2,'.','').'</TD><TD align=center>'.$additional_comps_row['ItemNum'].'</TD><TD align=center>'.$additional_comps_row['Invoice_Number'].'</TD></TR>'; } //Gift Card Payments $sql_gc_sales='SELECT * FROM [Gift_Card_Trans] WHERE [TransType]=1 AND [invoice_Number] ='.$row_numbers['Invoice_Number']; $gc_sales_res=mssql_query($sql_gc_sales); while($gc_sales_row=mssql_fetch_assoc($gc_sales_res)){ $template['var38']++; $template['var39']+=(-1*$gc_sales_row['Amt']); } //Gift Certificates Sold! $sql_gcert_sales1='SELECT SUM([Quantity]*[PricePer]) as [sum],COUNT(*) as [count] FROM [invoice_Itemized] WHERE [itemNum] = \''.$gift_cert_text.'\' AND [invoice_Number] ='.$row_numbers['Invoice_Number']; $gcert_sales_row1=mssql_fetch_assoc(mssql_query($sql_gcert_sales1)); $template['var53']+=$gcert_sales_row1['count']; $template['var54']+=$gcert_sales_row1['sum']; //Party Payments! $sql_gcert_sales2='SELECT SUM([Quantity]*[PricePer]) as [sum],COUNT(*) as [count] FROM [invoice_Itemized] WHERE [itemNum] = \''.$cc_credit_text.'\' AND [invoice_Number] ='.$row_numbers['Invoice_Number']; $gcert_sales_row2=mssql_fetch_assoc(mssql_query($sql_gcert_sales2)); $template['var95']+=$gcert_sales_row2['count']; $template['var96']+=$gcert_sales_row2['sum']; //Credit Card Credits! $sql_gcert_sales3='SELECT SUM([Quantity]*[PricePer]) as [sum],COUNT(*) as [count] FROM [invoice_Itemized] WHERE [itemNum] = \''.$party_payment_text.'\' AND [invoice_Number] ='.$row_numbers['Invoice_Number']; $gcert_sales_row3=mssql_fetch_assoc(mssql_query($sql_gcert_sales3)); $template['var97']+=$gcert_sales_row3['count']; $template['var98']+=$gcert_sales_row3['sum']; //Gift Cards Sold! $sql_gc_sales4='SELECT SUM([Quantity]*[GC_Sold]) as [sum],COUNT(*) as [count] FROM [invoice_Itemized] WHERE [itemNum] = \'GIFT_C\' AND [invoice_Number] ='.$row_numbers['Invoice_Number']; $gc_sales_row4=mssql_fetch_assoc(mssql_query($sql_gc_sales4)); $template['var42']+=$gc_sales_row4['sum']; $template['var43']+=$gc_sales_row4['count']; ////////////////////// /////CATEGORY TOTALS// ////////////////////// $Invoice_Number=$row_numbers['Invoice_Number']; $sql_cat="SELECT [invoice_Totals].[invoice_Number],[invoice_Totals].[Discount],[invoice_Itemized].[itemNum],[invoice_Itemized].[Quantity],[invoice_Itemized].[PricePer],[invoice_Itemized].[Tax1Per],[inventory].[Dept_ID],[Departments].[subType],[Categories].[Description] FROM [invoice_Totals] LEFT JOIN [invoice_Itemized] on [invoice_Itemized].[invoice_Number]=[invoice_Totals].[invoice_Number] LEFT JOIN [inventory] on [inventory].[itemNum]=[invoice_Itemized].[itemNum] LEFT JOIN [Departments] on [Departments].[Dept_ID]=[inventory].[Dept_ID] LEFT JOIN [Categories] on [Categories].[Cat_ID]=[Departments].[subType] WHERE [invoice_Totals].[invoice_Number]='$Invoice_Number'"; $result_cat=mssql_query($sql_cat) or die("error: <br>$sql_cat: <br>".mssql_get_last_message()); while($row_cat=mssql_fetch_array($result_cat)){ $tracking[$row_cat['Description']]['name']=$row_cat['Description']; $tracking[$row_cat['Description']]['quantity']+=$row_cat['Quantity']; $tracking[$row_cat['Description']]['price']+=number_format((1-$row_cat['Discount'])*$row_cat['PricePer']*$row_cat['Quantity'],2,'.',''); } /////////////////////// //END CATEGORY TOTALS// /////////////////////// /////////////////////// ///BREAK DOWN TOTALS/// /////////////////////// //BAR TOTALS if(in_array($row_numbers['Station_ID'],$CONFIG[bar])&&$row_numbers['InvType']=='0'){ //SALES $template['2_bar_checks']++; $template['2_bar_net_sales']+=$row_numbers['Total_Price']; //GIFT cert/cards $template['3_bar_giftcert_redeemed_total']+=$gcert_sales_row1['sum']; $template['3_bar_giftcert_redeemed_count']+=$gcert_sales_row1['count']; $template['3_bar_giftcard_redeemed_total']+=$gc_sales_row['sum']; $template['3_bar_giftcard_redeemed_count']+=$gc_sales_row['count']; }else{ $template['2_bar_checks']+=0; } //TOGO TOTALS if($row_numbers['InvType']>0){ //SALES $template['2_togo_checks']++; $template['2_togo_net_sales']+=$row_numbers['Total_Price']; //GIFT CARDS $template['3_togo_giftcert_redeemed_total']+=$gcert_sales_row1['sum']; $template['3_togo_giftcert_redeemed_count']+=$gcert_sales_row1['count']; $template['3_togo_giftcard_redeemed_total']+=$gc_sales_row['sum']; $template['3_togo_giftcard_redeemed_count']+=$gc_sales_row['count']; }else{ $template['2_togo_checks']+=0; } //DINING TOTALS if(!in_array($row_numbers['Station_ID'],$CONFIG[bar])&&$row_numbers['InvType']=='0'){ //SALES $template['2_dining_checks']++; $template['2_dining_guests']+=$row_numbers['Num_People_Party']; $template['2_dining_net_sales']+=$row_numbers['Total_Price']; //GIFT CARDS $template['3_dining_giftcert_redeemed_total']+=$gcert_sales_row1['sum']; $template['3_dining_giftcert_redeemed_count']+=$gcert_sales_row1['count']; $template['3_dining_giftcard_redeemed_total']+=$gc_sales_row['sum']; $template['3_dining_giftcard_redeemed_count']+=$gc_sales_row['count']; }else{ $template['2_dining_checks']+=0; $template['2_dining_guests']+=0; } /////////////////////////// ///END BREAK DOWN TOTALS/// /////////////////////////// } else { //add the voided check to the exceptions table $template['var91']++; $template['var92']+=$row_numbers['Total_Price']; if($count_exceptions++%2==1) $bgcolor_exceptions='white'; else $bgcolor_exceptions='lightgray'; $template['exceptions_itemized'].='<TR style="background-color:'.$bgcolor_exceptions.'"><TD align=center>Check Void</TD><TD align=center>Entire Check</TD><TD align=center>$'.number_format($row_numbers['Total_Price'],2,'.','').'</TD><TD align=center>***</TD><TD align=center>'.$row_numbers['Invoice_Number'].'</TD></TR>'; } } ////////////////////// /////CATEGORY TOTALS// ////////////////////// foreach($tracking as $Description){ $quantTotal+=$Description['quantity']; $priceTotal+=$Description['price']; $template['cat_table'].='<tr><td NOWRAP align=left">'.$Description['name'].'</td><td NOWRAP align=right>'.$Description['quantity'].'</td><td NOWRAP align=right>'.number_format($Description['price'],2,'.','').'</td></tr>'; } $template['cat_table'].='<tr><td NOWRAP align=right style="font-weight:bold;border-top: 2px solid black;">Sub Total</td><td NOWRAP style="font-weight:bold;border-top: 2px solid black;" align=right>'.$quantTotal.'</td><td NOWRAP style="font-weight:bold;border-top: 2px solid black;" align=right>'.number_format($priceTotal,2,'.','').'</td></tr>'; ////////////////////////// /////END CATEGORY TOTALS// ////////////////////////// //Money Track - Payouts $sql_payouts='SELECT * From [Payouts] WHERE DateTime >= \''.$shift_start.'\' AND DateTime <= \''.$shift_end.'\' AND [Cashier_ID]='.$template['var6']; $payouts_res=mssql_query($sql_payouts); while($payouts_row=mssql_fetch_assoc($payouts_res)){ $template['var23']++; $template['var24']+=$payouts_row['Amount']; if($count_payouts++%2==1) $bgcolor_payouts='white'; else $bgcolor_payouts='lightgray'; $template['payout_itemized'].='<TR style="background-color:'.$bgcolor_payouts.'"><TD align=center>$'.number_format($payouts_row['Amount'],2,'.','').'</TD><TD align=center>'.$payouts_row['Vendor_Number'].'</TD><TD align=center>'.$payouts_row['Description'].'</TD></TR>'; } //fix CC tips $template['var18']=number_format($template['var18'],2,'.',''); $template['var20']=number_format($template['var18'] *1,2,'.',''); //Money Track - Owe Outs $template['var25']=$template['var17'] + $template['var59'] - $template['var20'] - $template['var22'] - $template['var24']; if($template['var25']<0){ $template['owe_statement']=$template['var1'].' Owes '.$template['var5']; $template['owe_coupon_start']=''; $template['owe_coupon_end']=''; } else { $template['owe_statement']=$template['var5'].' Owes '.$template['var1']; $template['owe_coupon_start']='<!--'; $template['owe_coupon_end']='-->'; } $template['var25']=number_format(abs($template['var25']),2,'.',''); //Payment Breakdown By CC Extraction $template['var26']=$cc_breakdown['Visa']['count']+0; $template['var27']=number_format($cc_breakdown['Visa']['sum'],2,'.',''); $template['var28']=$cc_breakdown['MC']['count']+0; $template['var29']=number_format($cc_breakdown['MC']['sum'],2,'.',''); $template['var30']=$cc_breakdown['Amex']['count']+0; $template['var31']=number_format($cc_breakdown['Amex']['sum'],2,'.',''); $template['var32']=$cc_breakdown['Dine']['count']+0; $template['var33']=number_format($cc_breakdown['Dine']['sum'],2,'.',''); $template['var87']=$cc_breakdown['Disc']['count']+0; $template['var88']=number_format($cc_breakdown['Disc']['sum'],2,'.',''); $template['var89']=$cc_breakdown['Othr']['count']+0; $template['var90']=number_format($cc_breakdown['Othr']['sum'],2,'.',''); $template['var34']=$cc_breakdown['ALL']['count']+0; $template['var35']=number_format($cc_breakdown['ALL']['sum'],2,'.',''); //Invoice Exception Breakdown $template['var45']=$exceptions_breakdown[1]['count']+0; $template['var46']=number_format($exceptions_breakdown[1]['sum'],2,'.',''); $template['var47']=$template['var47'] + $exceptions_breakdown[2]['count']+0; $template['var48']=number_format($template['var48'] + $exceptions_breakdown[2]['sum'],2,'.',''); $template['var49']=$template['var49'] + $exceptions_breakdown[3]['count']+0; $template['var50']=number_format($template['var50'] + $exceptions_breakdown[3]['sum'],2,'.',''); $template['var51']=$exceptions_breakdown[4]['count']+0; $template['var52']=number_format($exceptions_breakdown[4]['sum'],2,'.',''); //Format Numbers $template['var13']=number_format($template['var13']-$template['var54'],2,'.',''); $template['var14']=number_format($template['var14'],2,'.',''); $template['var15']=number_format($template['var15']-$template['var42']-$template['var54'],2,'.',''); $template['var16']=$template['var16']+0; $template['var17']=number_format($template['var17'],2,'.',''); $template['var19']=$template['var19']+0; $template['var20']=number_format($template['var20'],2,'.',''); $template['var21']=$template['var21']+0; $template['var22']=number_format($template['var22'],2,'.',''); $template['var23']=$template['var23']+0; $template['var24']=number_format($template['var24'],2,'.',''); $template['var25']=number_format($template['var25'],2,'.',''); $template['var36']=$template['var36']+0; $template['var37']=number_format($template['var37'],2,'.',''); $template['var38']=$template['var38']+0; $template['var39']=number_format($template['var39'],2,'.',''); $template['var40']=$template['var36']+$template['var38']+0; $template['var41']=number_format($template['var37']+$template['var39'],2,'.',''); $template['var42']=number_format($template['var42'],2,'.',''); $template['var43']=$template['var43']+0; $template['var53']=$template['var53']+0; $template['var54']=number_format($template['var54'],2,'.',''); $template['var55']=$template['var55']+0; $template['var56']=$template['var56']+0; $template['var57']=number_format($template['var13']/$template['var56'],2,'.',''); $template['var58']=number_format($template['var13']/$template['var55'],2,'.',''); $template['var59']=number_format($template['var59'],2,'.',''); $template['var60']=number_format($template['var59']+$template['var17']-$template['var24'],2,'.',''); $template['var85']=number_format($template['var85'],2,'.',''); $template['var86']=$template['var85']-$template['var60']; $template['var91']=$template['var91']+0; $template['var92']=number_format($template['var92'],2,'.',''); $predisc_net=$template['var13']+$template['var48']+$template['var50']+$template['var52']; $template['var93']=number_format($predisc_net/$template['var56'],2,'.',''); $template['var94']=number_format($predisc_net/$template['var55'],2,'.',''); $template['var95']=$template['var95']+0; $template['var96']=number_format($template['var96'],2,'.',''); $template['var97']=$template['var97']+0; $template['var98']=number_format($template['var98'],2,'.',''); $template['var001']=number_format($template['var60']-$template['var59'],2,'.',''); //do over under statement if($template['var86']>0){ $template['over_under_statement']='Drawer Over By'; $template['drawer_under_show_start']='<!--'; $template['drawer_under_show_end']='-->'; } else { $template['over_under_statement']='Drawer Under By'; $template['drawer_under_show_start']=''; $template['drawer_under_show_end']=''; } if($row63to84['ID']!=$_GET['id']){ $template['drawer_under_show_start']=''; $template['drawer_under_show_end']=''; } $template['var86']=number_format(abs($template['var86']),2,'.',''); //force replacements $template['cc_itemized']=$template['cc_itemized']; $template['exceptions_itemized']=$template['exceptions_itemized']; $template['payout_itemized']=$template['payout_itemized']; //MAKE TEMPLATE FIELDS $template['net_sales']=$template['var13']; $template['service_charge']=number_format($template['var20']+$template['var22'],2,'.',''); $template['tax_collected']=number_format($template['var14'],2,'.',''); $template['total_revenue']=number_format($template['tax_collected']+$template['service_charge']+$template['var13'],2,'.',''); $template['item_discount']=$template['var50']; $template['subtotal_discount']='0.00'; $template['total_discount']=number_format($template['subtotal_discount']+$template['item_discount'],2,'.',''); $template['voids_num']=$template['var91']; $template['voids']=$template['var92']; $template['checks_num']=$template['var55']; $template['checks']=$template['total_revenue']; $template['checks_paid_num']=$template['checks_num']-$template['checks_outstanding_num']; $template['checks_paid']=number_format($template['checks']-$template['checks_outstanding'],2,'.',''); $template['checks_outstanding']=number_format($template['checks_outstanding'],2,'.',''); $template['gross_receipts']=$template['var17']; $template['charged_receipts']='0.00'; $template['service_charges']=$template['var22']; $template['charged_tips']=number_format($template['var20'],2,'.',''); $template['cash_tips_dec']='0.00'; $template['indirect_tips_dec']='0.00'; $template['total_tips']=$template['service_charge']; $template['total_tips_percent']=number_format(($template['total_tips']/$template['gross_receipts'])*100,2,'.',''); $template['var56']=$template['2_togo_guests']+$template['2_dining_guests']; $template['2_dining_net_sales']=number_format($template['2_dining_net_sales']-$template['3_dining_giftcert_redeemed_total'],2,'.',''); $template['2_dining_net_sales_percent']=number_format(($template['2_dining_net_sales']/$template['var13'])*100,2,'.',''); $template['2_dining_guests_percent']=number_format(($template['2_dining_guests']/$template['var56'])*100,2,'.',''); $template['2_dining_guests_average']=number_format($template['2_dining_net_sales']/$template['2_dining_guests'],2,'.',''); $template['2_dining_checks_percent']=number_format(($template['2_dining_checks']/$template['var55'])*100,2,'.',''); $template['2_dining_checks_average']=number_format($template['2_dining_net_sales']/$template['2_dining_checks'],2,'.',''); $template['2_dining_tables']=$template['2_dining_checks']; $template['2_dining_tables_percent']=number_format(($template['2_dining_tables']/$template['var55'])*100,2,'.',''); $template['2_dining_tables_average']=number_format($template['2_dining_net_sales']/$template['2_dining_tables'],2,'.',''); $template['2_bar_net_sales']=number_format($template['2_bar_net_sales']-$template['3_bar_giftcert_redeemed_total'],2,'.',''); $template['2_bar_net_sales_percent']=number_format(($template['2_bar_net_sales']/$template['var13'])*100,2,'.',''); $template['2_bar_guests']=0; $template['2_bar_guests_percent']=number_format(0,2,'.',''); $template['2_bar_guests_average']=number_format(0,2,'.',''); $template['2_bar_checks_percent']=number_format(($template['2_bar_checks']/$template['var55'])*100,2,'.',''); $template['2_bar_checks_average']=number_format($template['2_bar_net_sales']/$template['2_bar_checks'],2,'.',''); $template['2_bar_tables']=0; $template['2_bar_tables_percent']=number_format(0,2,'.',''); $template['2_bar_tables_average']=number_format(0,2,'.',''); $template['2_togo_net_sales']=number_format($template['2_togo_net_sales']-$template['3_togo_giftcert_redeemed_total'],2,'.',''); $template['2_togo_net_sales_percent']=number_format(($template['2_togo_net_sales']/$template['var13'])*100,2,'.',''); $template['2_togo_guests']=0; $template['2_togo_guests_percent']=number_format(($template['2_togo_guests']/$template['var56'])*100,2,'.',''); $template['2_togo_guests_average']=number_format($template['2_togo_net_sales']/$template['2_togo_guests'],2,'.',''); $template['2_togo_checks_percent']=number_format(($template['2_togo_checks']/$template['var55'])*100,2,'.',''); $template['2_togo_checks_average']=number_format($template['2_togo_net_sales']/$template['2_togo_checks'],2,'.',''); $template['2_togo_tables']=0; $template['2_togo_tables_percent']=number_format(0,2,'.',''); $template['2_togo_tables_average']=number_format(0,2,'.',''); $template['2_total_net_sales']=number_format($template['2_togo_net_sales']+$template['2_bar_net_sales']+$template['2_dining_net_sales'],2,'.',''); $template['2_total_guests']=$template['var56']; $template['2_total_checks']=$template['var55']; $template['2_total_tables']=$template['2_dining_tables']; $template['priceTotal-var54']=number_format($priceTotal-$template['var54'],2,'.',''); $template['service_charge_num']=$template['var19']+$template['var21']; $template['cash_due_num']=$template['var16']+$template['service_charge_num']+$template['var23']; $template['cash_due']=number_format($template['var17']-($template['service_charge']-$template['var24']),2,'.',''); $template['cards_total']=number_format($template['var27']+$template['var29']+$template['var31']+$template['var33'],2,'.',''); $template['cards_total_num']=$template['var26']+$template['var28']+$template['var30']+$template['var32']+$template['var88']+$template['var90']; $i++; /* $template['test']= "CASH: ".$template['var17']." CREDIT: ".$template['var35']." CCTIP: ".$template['var20']." TOTAL: ".$template['var15']." :: ".($template['var15']-$template['var35']-$template['var17']-$template['var20']); $template['empTOTAL']="<table width=5 border=1 style='border-collapse: collapse;'><tr><td NOWRAP>Employee Name</td><td NOWRAP>ID</td><td NOWRAP>Cash</td><td NOWRAP>Credit</td><td NOWRAP>Tax</td><td NOWRAP>Total</td></tr>"; foreach($empTOTAL as $emp=>$val){ foreach ($key as $emp){ $empSQL='SELECT [EmpName] FROM [Employee] WHERE Cashier_ID=\''.$emp.'\''; $name=mssql_result(mssql_query($empSQL),0,0); $template['empTOTAL'].="<tr><td NOWRAP>$name</td><td NOWRAP>$emp</td><td NOWRAP>$val</td><td NOWRAP></td><td NOWRAP>$emp[Total_Tax]</td><td NOWRAP>$emp[Grand_Total]</td></tr>"; $grandCASH+=$; $grandTAX+=$; $grandCC+=$; $grandTOTAL+=$; } } $template['empTOTAL'].="<tr><td colspan=2>GRAND TOTAL</td><td NOWRAP>$grandTOTAL</td></tr>"; $template['empTOTAL'].="</table>"; */ $template[todays_datetime]=date('l, F j, Y - g:iA'); $template[logged_username]=$_SESSION[posclient_firstname]; $fcontents=get_page($template_file,$CONFIG[customer_name]." Administration Page","templates/html_print_template.html",$_GET[msg]); echo parse_template($template,$fcontents); ?>
  12. becuase i have to loop the same code 3 times and it will mess up the numbers if they do not get unset.
  13. class: <?php define ("SERIAL_DEVICE_NOTSET", 0); define ("SERIAL_DEVICE_SET", 1); define ("SERIAL_DEVICE_OPENED", 2); /** * Serial port control class * * THIS PROGRAM COMES WITH ABSOLUTELY NO WARANTIES ! * USE IT AT YOUR OWN RISKS ! * * @author Rémy Sanchez <thenux@gmail.com> * @thanks Aurélien Derouineau for finding how to open serial ports with windows * @thanks Alec Avedisyan for help and testing with reading * @copyright under GPL 2 licence */ class phpSerial { var $_device = null; var $_windevice = null; var $_dHandle = null; var $_dState = SERIAL_DEVICE_NOTSET; var $_buffer = ""; var $_os = ""; /** * This var says if buffer should be flushed by sendMessage (true) or manualy (false) * * @var bool */ var $autoflush = true; /** * Constructor. Perform some checks about the OS and setserial * * @return phpSerial */ function phpSerial () { setlocale(LC_ALL, "en_US"); $sysname = php_uname(); if (substr($sysname, 0, 5) === "Linux") { $this->_os = "linux"; if($this->_exec("stty --version") === 0) { register_shutdown_function(array($this, "deviceClose")); } else { trigger_error("No stty availible, unable to run.", E_USER_ERROR); } } elseif(substr($sysname, 0, 7) === "Windows") { $this->_os = "windows"; register_shutdown_function(array($this, "deviceClose")); } else { trigger_error("Host OS is neither linux nor windows, unable tu run.", E_USER_ERROR); exit(); } } // // OPEN/CLOSE DEVICE SECTION -- {START} // /** * Device set function : used to set the device name/address. * -> linux : use the device address, like /dev/ttyS0 * -> windows : use the COMxx device name, like COM1 (can also be used * with linux) * * @param string $device the name of the device to be used * @return bool */ function deviceSet ($device) { if ($this->_dState !== SERIAL_DEVICE_OPENED) { if ($this->_os === "linux") { if (preg_match("@^COM(\d+):?$@i", $device, $matches)) { $device = "/dev/ttyS" . ($matches[1] - 1); } if ($this->_exec("stty -F " . $device) === 0) { $this->_device = $device; $this->_dState = SERIAL_DEVICE_SET; return true; } } elseif ($this->_os === "windows") { if (preg_match("@^COM(\d+):?$@i", $device, $matches) and $this->_exec(exec("mode " . $device)) === 0) { $this->_windevice = "COM" . $matches[1]; $this->_device = "\\.\com" . $matches[1]; $this->_dState = SERIAL_DEVICE_SET; return true; } } trigger_error("Specified serial port is not valid", E_USER_WARNING); return false; } else { trigger_error("You must close your device before to set an other one", E_USER_WARNING); return false; } } /** * Opens the device for reading and/or writing. * * @param string $mode Opening mode : same parameter as fopen() * @return bool */ function deviceOpen ($mode = "r+b") { if ($this->_dState === SERIAL_DEVICE_OPENED) { trigger_error("The device is already opened", E_USER_NOTICE); return true; } if ($this->_dState === SERIAL_DEVICE_NOTSET) { trigger_error("The device must be set before to be open", E_USER_WARNING); return false; } if (!preg_match("@^[raw]\+?b?$@", $mode)) { trigger_error("Invalid opening mode : ".$mode.". Use fopen() modes.", E_USER_WARNING); return false; } $this->_dHandle = @fopen($this->_device, $mode); if ($this->_dHandle !== false) { stream_set_blocking($this->_dHandle, 0); $this->_dState = SERIAL_DEVICE_OPENED; return true; } $this->_dHandle = null; trigger_error("Unable to open the device", E_USER_WARNING); return false; } /** * Closes the device * * @return bool */ function deviceClose () { if ($this->_dState !== SERIAL_DEVICE_OPENED) { return true; } if (fclose($this->_dHandle)) { $this->_dHandle = null; $this->_dState = SERIAL_DEVICE_SET; return true; } trigger_error("Unable to close the device", E_USER_ERROR); return false; } // // OPEN/CLOSE DEVICE SECTION -- {STOP} // // // CONFIGURE SECTION -- {START} // /** * Configure the Baud Rate * Possible rates : 110, 150, 300, 600, 1200, 2400, 4800, 9600, 38400, * 57600 and 115200. * * @param int $rate the rate to set the port in * @return bool */ function confBaudRate ($rate) { if ($this->_dState !== SERIAL_DEVICE_SET) { trigger_error("Unable to set the baud rate : the device is either not set or opened", E_USER_WARNING); return false; } $validBauds = array ( 110 => 11, 150 => 15, 300 => 30, 600 => 60, 1200 => 12, 2400 => 24, 4800 => 48, 9600 => 96, 19200 => 19, 38400 => 38400, 57600 => 57600, 115200 => 115200 ); if (isset($validBauds[$rate])) { if ($this->_os === "linux") { $ret = $this->_exec("stty -F " . $this->_device . " " . (int) $rate, $out); } elseif ($this->_os === "windows") { $ret = $this->_exec("mode " . $this->_windevice . " BAUD=" . $validBauds[$rate], $out); } else return false; if ($ret !== 0) { trigger_error ("Unable to set baud rate: " . $out[1], E_USER_WARNING); return false; } } } /** * Configure parity. * Modes : odd, even, none * * @param string $parity one of the modes * @return bool */ function confParity ($parity) { if ($this->_dState !== SERIAL_DEVICE_SET) { trigger_error("Unable to set parity : the device is either not set or opened", E_USER_WARNING); return false; } $args = array( "none" => "-parenb", "odd" => "parenb parodd", "even" => "parenb -parodd", ); if (!isset($args[$parity])) { trigger_error("Parity mode not supported", E_USER_WARNING); return false; } if ($this->_os === "linux") { $ret = $this->_exec("stty -F " . $this->_device . " " . $args[$parity], $out); } else { $ret = $this->_exec("mode " . $this->_windevice . " PARITY=" . $parity{0}, $out); } if ($ret === 0) { return true; } trigger_error("Unable to set parity : " . $out[1], E_USER_WARNING); return false; } /** * Sets the length of a character. * * @param int $int length of a character (5 <= length <= * @return bool */ function confCharacterLength ($int) { if ($this->_dState !== SERIAL_DEVICE_SET) { trigger_error("Unable to set length of a character : the device is either not set or opened", E_USER_WARNING); return false; } $int = (int) $int; if ($int < 5) $int = 5; elseif ($int > $int = 8; if ($this->_os === "linux") { $ret = $this->_exec("stty -F " . $this->_device . " cs" . $int, $out); } else { $ret = $this->_exec("mode " . $this->_windevice . " DATA=" . $int, $out); } if ($ret === 0) { return true; } trigger_error("Unable to set character length : " .$out[1], E_USER_WARNING); return false; } /** * Sets the length of stop bits. * * @param float $length the length of a stop bit. It must be either 1, * 1.5 or 2. 1.5 is not supported under linux and on some computers. * @return bool */ function confStopBits ($length) { if ($this->_dState !== SERIAL_DEVICE_SET) { trigger_error("Unable to set the length of a stop bit : the device is either not set or opened", E_USER_WARNING); return false; } if ($length != 1 and $length != 2 and $length != 1.5 and !($length == 1.5 and $this->_os === "linux")) { trigger_error("Specified stop bit length is invalid", E_USER_WARNING); return false; } if ($this->_os === "linux") { $ret = $this->_exec("stty -F " . $this->_device . " " . (($length == 1) ? "-" : "") . "cstopb", $out); } else { $ret = $this->_exec("mode " . $this->_windevice . " STOP=" . $length, $out); } if ($ret === 0) { return true; } trigger_error("Unable to set stop bit length : " . $out[1], E_USER_WARNING); return false; } /** * Configures the flow control * * @param string $mode Set the flow control mode. Availible modes : * -> "none" : no flow control * -> "rts/cts" : use RTS/CTS handshaking * -> "xon/xoff" : use XON/XOFF protocol * @return bool */ function confFlowControl ($mode) { if ($this->_dState !== SERIAL_DEVICE_SET) { trigger_error("Unable to set flow control mode : the device is either not set or opened", E_USER_WARNING); return false; } $linuxModes = array( "none" => "clocal -crtscts -ixon -ixoff", "rts/cts" => "-clocal crtscts -ixon -ixoff", "xon/xoff" => "-clocal -crtscts ixon ixoff" ); $windowsModes = array( "none" => "xon=off octs=off rts=on", "rts/cts" => "xon=off octs=on rts=hs", "xon/xoff" => "xon=on octs=off rts=on", ); if ($mode !== "none" and $mode !== "rts/cts" and $mode !== "xon/xoff") { trigger_error("Invalid flow control mode specified", E_USER_ERROR); return false; } if ($this->_os === "linux") $ret = $this->_exec("stty -F " . $this->_device . " " . $linuxModes[$mode], $out); else $ret = $this->_exec("mode " . $this->_windevice . " " . $windowsModes[$mode], $out); if ($ret === 0) return true; else { trigger_error("Unable to set flow control : " . $out[1], E_USER_ERROR); return false; } } /** * Sets a setserial parameter (cf man setserial) * NO MORE USEFUL ! * -> No longer supported * -> Only use it if you need it * * @param string $param parameter name * @param string $arg parameter value * @return bool */ function setSetserialFlag ($param, $arg = "") { if (!$this->_ckOpened()) return false; $return = exec ("setserial " . $this->_device . " " . $param . " " . $arg . " 2>&1"); if ($return{0} === "I") { trigger_error("setserial: Invalid flag", E_USER_WARNING); return false; } elseif ($return{0} === "/") { trigger_error("setserial: Error with device file", E_USER_WARNING); return false; } else { return true; } } // // CONFIGURE SECTION -- {STOP} // // // I/O SECTION -- {START} // /** * Sends a string to the device * * @param string $str string to be sent to the device * @param float $waitForReply time to wait for the reply (in seconds) */ function sendMessage ($str, $waitForReply = 0.1) { $this->_buffer .= $str; if ($this->autoflush === true) $this->flush(); usleep((int) ($waitForReply * 1000000)); } /** * Reads the port until no new datas are availible, then return the content. * * @pararm int $count number of characters to be read (will stop before * if less characters are in the buffer) * @return string */ function readPort ($count = 0) { if ($this->_dState !== SERIAL_DEVICE_OPENED) { trigger_error("Device must be opened to read it", E_USER_WARNING); return false; } if ($this->_os === "linux") { $content = ""; $i = 0; if ($count !== 0) { do { if ($i > $count) $content .= fread($this->_dHandle, ($count - $i)); else $content .= fread($this->_dHandle, 128); } while (($i += 128) === strlen($content)); } else { do { $content .= fread($this->_dHandle, 128); } while (($i += 128) === strlen($content)); } return $content; } elseif ($this->_os === "windows") { /* Do nohting : not implented yet */ } trigger_error("Reading serial port is not implemented for Windows", E_USER_WARNING); return false; } /** * Flushes the output buffer * * @return bool */ function flush () { if (!$this->_ckOpened()) return false; if (fwrite($this->_dHandle, $this->_buffer) !== false) { $this->_buffer = ""; return true; } else { $this->_buffer = ""; trigger_error("Error while sending message", E_USER_WARNING); return false; } } // // I/O SECTION -- {STOP} // // // INTERNAL TOOLKIT -- {START} // function _ckOpened() { if ($this->_dState !== SERIAL_DEVICE_OPENED) { trigger_error("Device must be opened", E_USER_WARNING); return false; } return true; } function _ckClosed() { if ($this->_dState !== SERIAL_DEVICE_CLOSED) { trigger_error("Device must be closed", E_USER_WARNING); return false; } return true; } function _exec($cmd, &$out = null) { $desc = array( 1 => array("pipe", "w"), 2 => array("pipe", "w") ); $proc = proc_open($cmd, $desc, $pipes); $ret = stream_get_contents($pipes[1]); $err = stream_get_contents($pipes[2]); fclose($pipes[1]); fclose($pipes[2]); $retVal = proc_close($proc); if (func_num_args() == 2) $out = array($ret, $err); return $retVal; } // // INTERNAL TOOLKIT -- {STOP} // } ?> example: <?php include "php_serial.class.php"; // Let's start the class $serial = new phpSerial; // First we must specify the device. This works on both linux and windows (if // your linux serial device is /dev/ttyS0 for COM1, etc) $serial->deviceSet("COM1"); // Then we need to open it $serial->deviceOpen(); // To write into $serial->sendMessage("Hello !"); // Or to read from $read = $serial->readPort(); // If you want to change the configuration, the device must be closed $serial->deviceClose(); // We can change the baud rate $serial->confBaudRate(2400); // etc... ?>
  14. is it possible to unset all variables that are set? without doing this: unset($var1,$var2,$var3);
  15. $exp_date = "2006-01-16"; $todays_date = date("Y-m-d"); $today = strtotime($todays_date); $expiration_date = strtotime($exp_date); if ($expiration_date > $today) { $valid = "yes"; } else { $valid = "no"; }
  16. yeah i understand but no one is going to help with code to look at. php doesnt care what browser your using for the most part so it must have something to do with the html/javascript. unless your using cookies?
  17. try adding this to the form tag enctype="multipart/form-data" sooo... <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
  18. sounds like a permission issue.. check the file permissions to make sure php has access to them... or ask the hosting company to do so
  19. you cannot echo inside of an echo use this for starters echo '<br /><img src="/cerebra/images/'.$id.'-.jpg" width="60" height="75" border="0"'.$row['image'].'" /</p>'; you also might want to double check the - before the .jpg to make sure thats not a typo
  20. u can lock the tables, but this will 99.999% never happen
  21. yeah no. i asked this question recently and got the same answer... http://www.phpfreaks.com/forums/index.php/topic,205776.msg933505.html#msg933505
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.