invoices.php

来自「asterisk用 的voip记费软件」· PHP 代码 · 共 1,049 行 · 第 1/3 页

PHP
1,049
字号
} else {	$QUERY = "SELECT substring(t1.creationdate,1,10) AS day, sum(t1.amount) AS cost, count(*) as nbcharge FROM cc_charge t1 ".$date_clause." GROUP BY substring(t1.creationdate,1,10) ORDER BY day"; //extract(DAY from calldate) }if (!$nodisplay){	$res = $DBHandle -> Execute($QUERY);	if ($res){		$num = $res -> RecordCount();		for($i=0;$i<$num;$i++)		{							$list_total_day_charge [] =$res-> fetchRow();				 		}	}		if ($FG_DEBUG >= 1) var_dump ($list_total_day_charge);}//end IF nodisplayif($exporttype!="pdf"){	$smarty->display('main.tpl');	?><!-- ** ** ** ** ** Part for the research ** ** ** ** ** -->	<center>	<FORM name="myForm"  METHOD=POST ACTION="<?php echo $PHP_SELF?>?s=1&t=0&order=<?php echo $order?>&sens=<?php echo $sens?>&current_page=<?php echo $current_page?>">	<INPUT TYPE="hidden" NAME="posted" value=1>	<INPUT TYPE="hidden" NAME="current_page" value=0>			<table class="bar-status" width="95%" border="0" cellspacing="1" cellpadding="2" align="center">			<tbody>			<?php  if ($_SESSION["pr_groupID"]==2 && is_numeric($_SESSION["pr_IDCust"])){ ?>			<?php  }else{ ?>			<tr>				<td align="left" valign="top" class="bgcolor_004">					<font class="fontstyle_003">&nbsp;&nbsp;<?php echo gettext("CUSTOMERS");?></font>				</td>								<td class="bgcolor_005" align="left" >				<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>					<td class="fontstyle_searchoptions">						<?php echo gettext("Enter the cardnumber");?>: <INPUT TYPE="text" NAME="entercustomer" value="<?php echo $entercustomer?>" class="form_input_text">						<a href="#" onclick="window.open('A2B_entity_card.php?popup_select=2&popup_formname=myForm&popup_fieldname=entercustomer' , 'CardNumberSelection','width=550,height=330,top=20,left=100,scrollbars=1');"><img src="<?php echo Images_Path;?>/icon_arrow_orange.gif"></a>											</td>					<td align="right" class="fontstyle_searchoptions">						<?php echo gettext("Provider");?>: <INPUT TYPE="text" NAME="enterprovider" value="<?php echo $enterprovider?>" size="4" class="form_input_text">						<a href="#" onclick="window.open('A2B_entity_provider.php?popup_select=2&popup_formname=myForm&popup_fieldname=enterprovider' , 'ProviderSelection','width=550,height=330,top=20,left=100,scrollbars=1');"><img src="<?php echo Images_Path ;?>/icon_arrow_orange.gif"></a>						<?php echo gettext("Trunk");?>: <INPUT TYPE="text" NAME="entertrunk" value="<?php echo $entertrunk?>" size="4" class="form_input_text">						<a href="#" onclick="window.open('A2B_entity_trunk.php?popup_select=2&popup_formname=myForm&popup_fieldname=entertrunk' , 'TrunkSelection','width=550,height=330,top=20,left=100,scrollbars=1');"><img src="<?php echo Images_Path ;?>/icon_arrow_orange.gif"></a>											</td>				</tr></table></td>			</tr>						<?php  }?>			<tr>        		<td class="bgcolor_002" align="left">					<input type="radio" name="Period" value="Month" <?php  if (($Period=="Month") || !isset($Period)){ ?>checked="checked" <?php  } ?>>					<font class="fontstyle_003"><?php echo gettext("SELECT MONTH");?></font>				</td>      			<td class="bgcolor_003" align="left" >					<table width="100%" border="0" cellspacing="0" cellpadding="0"  class="bgcolor_003">					<tr><td class="fontstyle_searchoptions">	  				<input type="checkbox" name="<?php echo gettext("frommonth");?>" value="true" <?php  if ($frommonth){ ?>checked<?php }?>>					<?php echo gettext("From");?> : <select name="fromstatsmonth" class="form_input_select">					<?php 	$year_actual = date("Y");  							for ($i=$year_actual;$i >= $year_actual-1;$i--)						{		   							   $monthname = array( gettext("January"), gettext("February"),gettext("March"), gettext("April"), gettext("May"), gettext("June"), gettext("July"), gettext("August"), gettext("September"), gettext("October"), gettext("November"), gettext("December"));							   if ($year_actual==$i){									$monthnumber = date("n")-1; // Month number without lead 0.							   }else{									$monthnumber=11;							   }		   							   for ($j=$monthnumber;$j>=0;$j--){										$month_formated = sprintf("%02d",$j+1);							   			if ($fromstatsmonth=="$i-$month_formated"){$selected="selected";}else{$selected="";}										echo "<OPTION value=\"$i-$month_formated\" $selected> $monthname[$j]-$i </option>";											   }						}					?>							</select>					</td><td class="fontstyle_searchoptions">&nbsp;&nbsp;					<input type="checkbox" name="tomonth" value="true" <?php  if ($tomonth){ ?>checked<?php }?>> 				   <?php echo gettext("To");?> : <select name="tostatsmonth" class="form_input_select">					<?php 	$year_actual = date("Y");  							for ($i=$year_actual;$i >= $year_actual-1;$i--)						{		   							   $monthname = array( gettext("January"), gettext("February"),gettext("March"), gettext("April"), gettext("May"), gettext("June"), gettext("July"), gettext("August"), gettext("September"), gettext("October"), gettext("November"), gettext("December"));							   if ($year_actual==$i){									$monthnumber = date("n")-1; // Month number without lead 0.							   }else{									$monthnumber=11;							   }		   							   for ($j=$monthnumber;$j>=0;$j--){											$month_formated = sprintf("%02d",$j+1);							   			if ($tostatsmonth=="$i-$month_formated"){$selected="selected";}else{$selected="";}										echo "<OPTION value=\"$i-$month_formated\" $selected> $monthname[$j]-$i </option>";											   }						}					?>					</select>					</td></tr></table>	  			</td>    		</tr>			<tr>        		<td align="left" class="bgcolor_004">					<input type="radio" name="Period" value="Day" <?php  if ($Period=="Day"){ ?>checked="checked" <?php  } ?>>					<font class="fontstyle_003"><?php echo gettext("SELECT DAY");?></font>				</td>      			<td align="left" class="bgcolor_005">					<table width="100%" border="0" cellspacing="0" cellpadding="0"  class="bgcolor_005">					<tr><td class="fontstyle_searchoptions">	  				<input type="checkbox" name="fromday" value="true" <?php  if ($fromday){ ?>checked<?php }?>><?php echo gettext("From");?> :					<select name="fromstatsday_sday" class="form_input_select">						<?php  							for ($i=1;$i<=31;$i++){								if ($fromstatsday_sday==sprintf("%02d",$i)){$selected="selected";}else{$selected="";}								echo '<option value="'.sprintf("%02d",$i)."\"$selected>".sprintf("%02d",$i).'</option>';							}						?>						</select>				 	<select name="fromstatsmonth_sday" class="form_input_select">					<?php 	$year_actual = date("Y");  							for ($i=$year_actual;$i >= $year_actual-1;$i--)						{		   							   $monthname = array( gettext("January"), gettext("February"),gettext("March"), gettext("April"), gettext("May"), gettext("June"), gettext("July"), gettext("August"), gettext("September"), gettext("October"), gettext("November"), gettext("December"));							   if ($year_actual==$i){									$monthnumber = date("n")-1; // Month number without lead 0.							   }else{									$monthnumber=11;							   }		   							   for ($j=$monthnumber;$j>=0;$j--){											$month_formated = sprintf("%02d",$j+1);							   			if ($fromstatsmonth_sday=="$i-$month_formated"){$selected="selected";}else{$selected="";}										echo "<OPTION value=\"$i-$month_formated\" $selected> $monthname[$j]-$i </option>";											   }						}					?>					</select>					<select name="fromstatsmonth_shour" class="form_input_select">					<?php  						if (strlen($fromstatsmonth_shour)==0) $fromstatsmonth_shour='0';						for ($i=0;$i<=23;$i++){								if ($fromstatsmonth_shour==sprintf("%02d",$i)){$selected="selected";}else{$selected="";}													echo '<option value="'.sprintf("%02d",$i)."\" $selected>".sprintf("%02d",$i).'</option>';						}					?>										</select>:<select name="fromstatsmonth_smin" class="form_input_select">					<?php  						if (strlen($fromstatsmonth_smin)==0) $fromstatsmonth_smin='0';						for ($i=0;$i<=59;$i++){								if ($fromstatsmonth_smin==sprintf("%02d",$i)){$selected="selected";}else{$selected="";}													echo '<option value="'.sprintf("%02d",$i)."\" $selected>".sprintf("%02d",$i).'</option>';						}					?>										</select>					</td><td class="fontstyle_searchoptions">&nbsp;&nbsp;					<input type="checkbox" name="today" value="true" <?php  if ($today){ ?>checked<?php }?>> To : 					<select name="tostatsday_sday" class="form_input_select">					<?php  						for ($i=1;$i<=31;$i++){							if ($tostatsday_sday==sprintf("%02d",$i)){$selected="selected";}else{$selected="";}							echo '<option value="'.sprintf("%02d",$i)."\"$selected>".sprintf("%02d",$i).'</option>';						}					?>											</select>				 	<select name="tostatsmonth_sday" class="form_input_select">					<?php 	$year_actual = date("Y");  							for ($i=$year_actual;$i >= $year_actual-1;$i--)						{		   							   $monthname = array( gettext("January"), gettext("February"),gettext("March"), gettext("April"), gettext("May"), gettext("June"), gettext("July"), gettext("August"), gettext("September"), gettext("October"), gettext("November"), gettext("December"));							   if ($year_actual==$i){									$monthnumber = date("n")-1; // Month number without lead 0.							   }else{									$monthnumber=11;							   }		   							   for ($j=$monthnumber;$j>=0;$j--){											$month_formated = sprintf("%02d",$j+1);							   			if ($tostatsmonth_sday=="$i-$month_formated"){$selected="selected";}else{$selected="";}										echo "<OPTION value=\"$i-$month_formated\" $selected> $monthname[$j]-$i </option>";											   }						}					?>					</select>					<select name="tostatsmonth_shour" class="form_input_select">					<?php  						if (strlen($tostatsmonth_shour)==0) $tostatsmonth_shour='23';						for ($i=0;$i<=23;$i++){								if ($tostatsmonth_shour==sprintf("%02d",$i)){$selected="selected";}else{$selected="";}													echo '<option value="'.sprintf("%02d",$i)."\" $selected>".sprintf("%02d",$i).'</option>';						}					?>										</select>:<select name="tostatsmonth_smin" class="form_input_select">					<?php  						if (strlen($tostatsmonth_smin)==0) $tostatsmonth_smin='59';						for ($i=0;$i<=59;$i++){								if ($tostatsmonth_smin==sprintf("%02d",$i)){$selected="selected";}else{$selected="";}													echo '<option value="'.sprintf("%02d",$i)."\" $selected>".sprintf("%02d",$i).'</option>';						}					?>										</select>					</td></tr></table>	  			</td>    		</tr>			<tr>				<td class="bgcolor_002" align="left">								<font class="fontstyle_003">&nbsp;&nbsp;<?php echo gettext("DESTINATION");?></font>				</td>				<td class="bgcolor_003" align="left" >				<table width="100%" border="0" cellspacing="0" cellpadding="0">				<tr><td class="fontstyle_searchoptions">&nbsp;&nbsp;<INPUT TYPE="text" NAME="dst" value="<?php echo $dst?>" class="form_input_text"></td>				<td class="fontstyle_searchoptions" align="center"><input type="radio" NAME="dsttype" value="1" <?php if((!isset($dsttype))||($dsttype==1)){?>checked<?php }?>><?php echo gettext("Exact");?></td>				<td class="fontstyle_searchoptions" align="center"><input type="radio" NAME="dsttype" value="2" <?php if($dsttype==2){?>checked<?php }?>><?php echo gettext("Begins with");?></td>				<td class="fontstyle_searchoptions" align="center"><input type="radio" NAME="dsttype" value="3" <?php if($dsttype==3){?>checked<?php }?>><?php echo gettext("Contains");?></td>				<td class="fontstyle_searchoptions" align="center"><input type="radio" NAME="dsttype" value="4" <?php if($dsttype==4){?>checked<?php }?>><?php echo gettext("Ends with");?></td>				<td class="fontstyle_searchoptions" align="center"><input type="radio" NAME="dsttype" value="5" <?php if($dsttype==5){?>checked<?php }?>><?php echo gettext("Is Not");?></td>				</tr></table></td>			</tr>			<tr>				<td align="left"  class="bgcolor_004">					<font class="fontstyle_003">&nbsp;&nbsp;<?php echo gettext("SOURCE");?></font>				</td>				<td class="bgcolor_005" align="left" >				<table width="100%" border="0" cellspacing="0" cellpadding="0" >				<tr><td class="fontstyle_searchoptions">&nbsp;&nbsp;<INPUT TYPE="text" NAME="src" value="<?php echo "$src";?>" class="form_input_text"></td>				<td class="fontstyle_searchoptions" align="center" ><input type="radio" NAME="srctype" value="1" <?php if((!isset($srctype))||($srctype==1)){?>checked<?php }?>><?php echo gettext("Exact");?></td>				<td class="fontstyle_searchoptions" align="center" ><input type="radio" NAME="srctype" value="2" <?php if($srctype==2){?>checked<?php }?>><?php echo gettext("Begins with");?></td>				<td class="fontstyle_searchoptions" align="center" ><input type="radio" NAME="srctype" value="3" <?php if($srctype==3){?>checked<?php }?>><?php echo gettext("Contains");?></td>				<td class="fontstyle_searchoptions" align="center" ><input type="radio" NAME="srctype" value="4" <?php if($srctype==4){?>checked<?php }?>><?php echo gettext("Ends with");?></td>				<td class="fontstyle_searchoptions" align="center" ><input type="radio" NAME="srctype" value="5" <?php if($srctype==5){?>checked<?php }?>><?php echo gettext("Is Not");?></td>				</tr></table></td>			</tr>			<tr>        		<td class="bgcolor_002" align="left" >				<font class="fontstyle_003">&nbsp;&nbsp;<?php echo gettext("OPTIONS");?></font>				 </td>				<td class="bgcolor_003" align="center" >								 <table width="100%" border="0" cellspacing="0" cellpadding="0">				<tr>					<td width="20%"  class="fontstyle_searchoptions">						<?php echo gettext("RESULT");?> :				   </td>				   <td width="80%"  class="fontstyle_searchoptions">				   		<?php echo gettext("Minutes");?><input type="radio" NAME="resulttype" value="min" <?php if((!isset($resulttype))||($resulttype=="min")){?>checked<?php }?>> - Seconds <input type="radio" NAME="resulttype" value="sec" <?php if($resulttype=="sec"){?>checked<?php }?>>					</td>				</tr>				<tr class="bgcolor_005">					<td  class="fontstyle_searchoptions">						<?php echo gettext("EXPORT FORMAT");?> : 				   </td>				   <td  class="fontstyle_searchoptions">						<?php echo gettext("See Invoice in HTML");?> <input type="radio" NAME="exporttype" value="html" <?php if((!isset($exporttype))||($exporttype=="html")){?>checked<?php }?>>						<?php echo gettext("or Export PDF");?> <input type="radio" NAME="exporttype" value="pdf" <?php if($exporttype=="pdf"){?>checked<?php }?>>										</td>				</tr>								<tr>					<td  class="fontstyle_searchoptions">						<?php echo gettext("CURRENCY");?> :					</td>					<td  class="fontstyle_searchoptions">						<select NAME="choose_currency" size="1" class="form_input_select" >						<?php							$currencies_list = get_currencies();							foreach($currencies_list as $key => $cur_value) {						?>							<option value='<?php echo $key ?>' <?php if (($choose_currency==$key) || (!isset($choose_currency) && $key==strtoupper(BASE_CURRENCY))){?>selected<?php } ?>><?php echo $cur_value[1].' ('.$cur_value[2].')' ?>							</option>						<?php 	} ?>							   </select>					</td>				</tr>				</table>								<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-->										  			</td>    		</tr>			<tr>				<td class="bgcolor_004" align="left">									</td>								<td class="bgcolor_005" align="left" >					<center>					<input type="image"  name="image16" align="top" border="0" src="<?php echo Images_Path;?>/button-search.gif" />											</center>					</td>			</tr>					</tbody></table>	</FORM></center><br><br><?php  }else{   require('pdf-invoices/html2pdf/html2fpdf.php');   ob_start();} ?><table width="20%" align="center"><tr><td> <img src="<?php echo Images_Path."/".INVOICE_IMAGE;?>"/> </td></tr></table><?php if (count($info_customer)>0 && (1==2)){ ?><table  class="invoices_table2">	<tr>		<td width="75%">&nbsp;				</td>				<td width="25%"><br/><font color="#000000" face="verdana" size="3"><?php  if (strlen($info_customer[0][3].$info_customer[0][2])>0) echo $info_customer[0][3].' '.$info_customer[0][2].' <br>'; ?> <?php  if (strlen($info_customer[0][4].$info_customer[0][8])>0) echo $info_customer[0][4].' '.$info_customer[0][8].' <br>'; ?> <?php  if (strlen($info_customer[0][5].$info_customer[0][6])>0) echo $info_customer[0][5].' '.$info_customer[0][6].' <br>'; ?> <?php  if (strlen($info_customer[0][7])>0) echo $info_customer[0][7].'<br><br>'; ?> <b><?php  if (strlen($info_customer[0][9])>0) echo "Phone :".$info_customer[0][9]; ?></b><br><b><?php  if (strlen($info_customer[0][11])>0) echo "Fax  :".$info_customer[0][11]; ?></b><br></font>		</td>	</tr></table><?php } ?><br><hr width="350"><br><br><table width="100%"><tr><?php if (SHOW_ICON_INVOICE){?><td align="left"><img src="<?php echo Images_Path;?>/desktop.jpg"/> </td><?php }?><td align="center"  class="invoices_table4_td1"><font ><?php echo gettext("B I L L I N G &nbsp;&nbsp; S E R V I C E");?> : <?php  if (strlen($info_customer[0][2])>0) echo $info_customer[0][2]; ?> </font></td></tr></table><br><br><?php if (is_array($list_total_day_charge) && count($list_total_day_charge)>0){$totalcharge=0;$totalcost=0;foreach ($list_total_day_charge as $data){		if ($mmax < $data[1]) $mmax=$data[1];	$totalcharge+=$data[2];	$totalcost+=$data[1];

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?