invoices_customer.php

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

PHP
1,200
字号
<?php  if($exporttype!="pdf"){ ?><table width="20%" align="center"><tr><td> <img src="<?php echo Images_Path;?>/companylogo.gif"/> </td></tr></table><br><?php if ((is_array($list_total_day_charge) && count($list_total_day_charge)>0 ) || (is_array($list_total_destination) && count($list_total_destination)>0)){?><table  class="invoice_main_table"> <tr>        <td class="invoice_heading"><?php echo gettext("Invoice Details"); ?></td> </tr>  <tr>        <td valign="top"><table width="60%" align="left" cellpadding="0" cellspacing="0">            <tr>              <td width="35%">&nbsp; </td>              <td width="65%">&nbsp; </td>            </tr>            <tr>              <td width="35%" class="invoice_td"><?php echo gettext("Name");?>&nbsp;: </td>              <td width="65%" class="invoice_td"><?php echo $info_customer[0][3] ." ".$info_customer[0][2] ?></td>            </tr>            <tr>              <td width="35%" class="invoice_td"><?php echo gettext("Card Number");?>&nbsp;:</td>              <td width="65%" class="invoice_td"><?php echo $info_customer[0][1] ?> </td>            </tr>                       <tr>              <td width="35%" class="invoice_td"><?php echo gettext("From Date");?>&nbsp;:</td>              <td width="65%" class="invoice_td"><?php echo display_dateonly($invoice_dates[0][0]);?></td>            </tr>            <tr>              <td >&nbsp;</td>              <td >&nbsp;</td>            </tr>                    </table></td>  </tr>	   	  <tr>		  <td valign="top">		  	<?php 				if (is_array($list_total_day_charge) && count($list_total_day_charge)>0){								$totalcharge=0;				$totalcost=0;				$total_extra_charges = 0;				foreach ($list_total_day_charge as $data){						if ($mmax < $data[1]) $mmax=$data[1];					$totalcharge+=$data[2];					$totalcost+=$data[1];					$total_extra_charges += convert_currency($currencies_list,$data[1], $data[3],BASE_CURRENCY);				}								?>				<!-- FIN TITLE GLOBAL MINUTES //-->				<table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">					<tr>							 <td colspan="5" align="center"><b><?php echo gettext("Extra Charges");?></b></font></td>					</tr>					<tr class="invoice_subheading">						<td  class="invoice_td" align="center"><?php echo gettext("DATE");?></td>						<td class="invoice_td" align="center"><?php echo gettext("NB CHARGE");?></td>						<td class="invoice_td" align="center"><?php echo gettext("TOTALCOST");?></td>									</tr><?php  								$i=0;						foreach ($list_total_day_charge as $data){							$i=($i+1)%2;							?>					<tr class="invoice_rows">						<td align="center" class="invoice_td"><?php echo $data[0]?></td>						<td class="invoice_td" align="right"><?php echo $data[2]?></td>						<td  class="invoice_td" align="right"><?php echo convert_currency($currencies_list, $data[1], $data[3], BASE_CURRENCY)." ".BASE_CURRENCY ?></td>					                 						</tr>	 					<?php 						 }	 	 						 ?>  					<tr>						<td class="invoice_td">&nbsp;</td>						<td class="invoice_td">&nbsp;</td>						<td class="invoice_td">&nbsp;</td>					</tr> 					<tr class="invoice_subheading">						<td class="invoice_td"><?php echo gettext("TOTAL");?></td>						<td class="invoice_td" align="right"><?php echo $totalcharge?></td>						<td class="invoice_td" align="right"><?php  display_2bill($total_extra_charges)?></td>					</tr>				</table>					  				<?php  } ?>									  </td>	  </tr>	  <?php 				$mmax=0;				$totalcall=0;				$totalminutes=0;				$totalcost=0;				if (is_array($list_total_destination) && count($list_total_destination)>0){				foreach ($list_total_destination as $data){						if ($mmax < $data[1]) $mmax=$data[1];					$totalcall+=$data[3];					$totalminutes+=$data[1];					$totalcost+=$data[2];				}								?>	  <tr>	  <td>&nbsp;</td>	  </tr>	  <tr>	  <td>	  	  		<table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">			<tr>								<td  align="center" colspan="5"><b><?php echo gettext("CALLS PER DESTINATION");?></b></td>			</tr>			<tr class="invoice_subheading">				<td align="center" class="invoice_td"><?php echo gettext("DESTINATION");?></td>				<td align="right" class="invoice_td"><?php echo gettext("DUR");?></td>				<td align="center" class="invoice_td"><?php echo gettext("GRAPHIC");?>  </td>				<td align="right" class="invoice_td"><?php echo gettext("CALL");?></td>				<td align="right" class="invoice_td"><?php echo gettext("TOTALCOST");?></td>			</tr>		<?php  						$i=0;				foreach ($list_total_destination as $data){					$i=($i+1)%2;						$tmc = $data[1]/$data[3];								if ((!isset($resulttype)) || ($resulttype=="min")){					$tmc = sprintf("%02d",intval($tmc/60)).":".sprintf("%02d",intval($tmc%60));						}else{									$tmc =intval($tmc);				}								if ((!isset($resulttype)) || ($resulttype=="min")){						$minutes = sprintf("%02d",intval($data[1]/60)).":".sprintf("%02d",intval($data[1]%60));				}else{						$minutes = $data[1];				}				if ($mmax>0) 	$widthbar= intval(($data[1]/$mmax)*200); 							?>			<tr class="invoice_rows">				<td align="left" class="invoice_td"><?php echo $data[0]?></font></td>				<td class="invoice_td" align="right"><?php echo $minutes?> </font></td>				<td class="invoice_td" align="left">					<img src="<?php echo Images_Path_Main ?>/sidenav-selected.gif" height="6" width="<?php echo $widthbar?>">				</td>				<td class="invoice_td" align="right"><?php echo $data[3]?></td>								<td class="invoice_td" align="right"><?php  display_2bill($data[2]) ?></td>			                  				</tr>				 <?php 	 }	 	 									if ((!isset($resulttype)) || ($resulttype=="min")){					$total_tmc = sprintf("%02d",intval(($totalminutes/$totalcall)/60)).":".sprintf("%02d",intval(($totalminutes/$totalcall)%60));									$totalminutes = sprintf("%02d",intval($totalminutes/60)).":".sprintf("%02d",intval($totalminutes%60));				}else{					$total_tmc = intval($totalminutes/$totalcall);							}			 			 ?> 			 <tr>				<td class="invoice_td">&nbsp;</td>				<td class="invoice_td">&nbsp;</td>				<td class="invoice_td">&nbsp;</td>				<td class="invoice_td">&nbsp;</td>				<td class="invoice_td">&nbsp;</td>			</tr>						<tr class="invoice_subheading">				<td align="left" class="invoice_td" ><?php echo gettext("TOTAL");?></td>				<td align="right"  class="invoice_td"><?php echo $totalminutes?> </td>								<td align="right" class="invoice_td" colspan="2"><?php echo $totalcall?></b></font></td>				<td align="right" class="invoice_td"><?php  display_2bill($totalcost) ?></td>			</tr>	</table>	  	  </td>	  </tr>	  <?php	  }	  ?>	  <tr>	  <td>&nbsp;</td>	  </tr>	  	  <tr>	  <td>	  	   <?php 	   		$total_invoice_cost = $totalcost + $total_extra_charges;						$mmax=0;			$totalcall=0;			$totalminutes=0;			$totalcost=0;			if (is_array($list_total_day) && count($list_total_day)>0){			foreach ($list_total_day as $data){					if ($mmax < $data[1]) $mmax=$data[1];				$totalcall+=$data[3];				$totalminutes+=$data[1];				$totalcost+=$data[2];			}						?>						<!-- FIN TITLE GLOBAL MINUTES //-->			<table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">				<tr>						<td align="center" colspan="5"><b><?php echo gettext("CALLS PER DAY");?></b> </td>				</tr>				<tr class="invoice_subheading">					<td align="center" class="invoice_td"><?php echo gettext("DATE");?></td>					<td align="right" class="invoice_td"><?php echo gettext("DUR");?> </td>					<td align="center" class="invoice_td"><?php echo gettext("GRAPHIC");?> </td>					<td align="right" class="invoice_td"><?php echo gettext("CALL");?></td>					<td align="right" class="invoice_td"><?php echo gettext("TOTALCOST");?></td>							</tr>				<?php  							$i=0;					foreach ($list_total_day as $data){						$i=($i+1)%2;							$tmc = $data[1]/$data[3];										if ((!isset($resulttype)) || ($resulttype=="min")){						$tmc = sprintf("%02d",intval($tmc/60)).":".sprintf("%02d",intval($tmc%60));							}else{											$tmc =intval($tmc);					}										if ((!isset($resulttype)) || ($resulttype=="min")){							$minutes = sprintf("%02d",intval($data[1]/60)).":".sprintf("%02d",intval($data[1]%60));					}else{							$minutes = $data[1];					}					if ($mmax>0) 	$widthbar= intval(($data[1]/$mmax)*200); 									?>				<tr class="invoice_rows">					<td align="center"  class="invoice_td"><?php echo $data[0]?></td>					<td class="invoice_td" align="right"><?php echo $minutes?> </td>					<td class="invoice_td" align="left">						<img src="<?php echo Images_Path_Main ?>/sidenav-selected.gif" height="6" width="<?php echo $widthbar?>">					</td>					<td class="invoice_td" align="right"><?php echo $data[3]?></font></td>					<td class="invoice_td" align="right"><?php  display_2bill($data[2]) ?></td>				 <?php 	 }	 	 						if ((!isset($resulttype)) || ($resulttype=="min")){						$total_tmc = sprintf("%02d",intval(($totalminutes/$totalcall)/60)).":".sprintf("%02d",intval(($totalminutes/$totalcall)%60));										$totalminutes = sprintf("%02d",intval($totalminutes/60)).":".sprintf("%02d",intval($totalminutes%60));					}else{						$total_tmc = intval($totalminutes/$totalcall);								}				 				 ?>                   					</tr>					<tr >					<td align="right">&nbsp;</td>					<td align="center" colspan="2">&nbsp;</td>					<td align="center">&nbsp;</td>					<td align="center">&nbsp;</td>				</tr>								<tr class="invoice_subheading">					<td align="left" class="invoice_td"><?php echo gettext("TOTAL");?></td>					<td align="right"  class="invoice_td"><?php echo $totalminutes?> </td>					<td align="center"  class="invoice_td">&nbsp; </td>					<td align="right" class="invoice_td"><?php echo $totalcall?></td>					<td align="right" class="invoice_td"><?php  display_2bill($totalcost) ?></td>				</tr>			</table>				  		<?php  } ?>	  </td>	  </tr>	  	  <tr>	  <td>&nbsp;</td>	  </tr>	  <?php  if (is_array($list) && count($list)>0){ ?>	  <tr>	  <td>	  <center><b><?php echo gettext("Number of call");?> : <?php  if (is_array($list) && count($list)>0){ echo $nb_record; }else{echo "0";}?></b></center>		<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%" align="center">                <TR class="invoice_subheading"> 		  		<TD width="7%" class="invoice_td">nb</TD>					                  <?php 				  	if (is_array($list) && count($list)>0){				  		for($i=0;$i<$FG_NB_TABLE_COL;$i++){ 					?>				                  <TD width="<?php echo $FG_TABLE_COL[$i][2]?>" align=middle class="invoice_td" >                     <center>                    <?php echo $FG_TABLE_COL[$i][0]?>                   </center></TD>				   <?php } ?>						   <?php if ($FG_DELETION || $FG_EDITION){ ?>				   <?php } ?>		                </TR>				<?php				  	 $ligne_number=0;					 				  	 foreach ($list as $recordset){ 						 $ligne_number++;				?>               		 <TR class="invoice_rows"> 			<TD align="<?php echo $FG_TABLE_COL[$i][3]?>" class="invoice_td"><?php  echo $ligne_number+$current_page*$FG_LIMITE_DISPLAY; ?></TD>				  		<?php for($i=0;$i<$FG_NB_TABLE_COL;$i++){ 							if ($FG_TABLE_COL[$i][6]=="lie"){								$instance_sub_table = new Table($FG_TABLE_COL[$i][7], $FG_TABLE_COL[$i][8]);								$sub_clause = str_replace("%id", $recordset[$i], $FG_TABLE_COL[$i][9]);								$select_list = $instance_sub_table -> Get_list ($DBHandle, $sub_clause, null, null, null, null, null, null);								$field_list_sun = split(',',$FG_TABLE_COL[$i][8]);								$record_display = $FG_TABLE_COL[$i][10];								for ($l=1;$l<=count($field_list_sun);$l++){													$record_display = str_replace("%$l", $select_list[0][$l-1], $record_display);									}							}elseif ($FG_TABLE_COL[$i][6]=="list"){									$select_list = $FG_TABLE_COL[$i][7];									$record_display = $select_list[$recordset[$i]][0];							}else{									$record_display = $recordset[$i];							}														if ( is_numeric($FG_TABLE_COL[$i][5]) && (strlen($record_display) > $FG_TABLE_COL[$i][5])  ){								$record_display = substr($record_display, 0, $FG_TABLE_COL[$i][5]-3)."";  							}											 		 ?>                 		 <TD align="<?php echo $FG_TABLE_COL[$i][3]?>" class="invoice_td"><?php 						 if (isset ($FG_TABLE_COL[$i][11]) && strlen($FG_TABLE_COL[$i][11])>1){						 		call_user_func($FG_TABLE_COL[$i][11], $record_display);						 }else{						 		echo stripslashes($record_display);						 }						 						 ?></TD>				 		 <?php  } ?>                  					</TR>				<?php					 }//foreach ($list as $recordset)					 if ($ligne_number < $FG_LIMITE_DISPLAY)  $ligne_number_end=$ligne_number +2;					 while ($ligne_number < $ligne_number_end){					 	$ligne_number++;				?>					<TR> 				  		<?php for($i=0;$i<$FG_NB_TABLE_COL;$i++){ 				 		 ?>                 		 <TD>&nbsp;</TD>				 		 <?php  } ?>                 		 <TD align="center">&nbsp;</TD>									</TR>													<?php					 					 } //END_WHILE					 				  }else{				  		echo gettext("No data found !!!");				  				  }//end_if				 ?>        </TABLE>	  </td>	  </tr>	  <?php } ?>	 <tr class="invoice_subheading">	 <td  align="right" class="invoice_td"><?php echo gettext("Total");?> = <?php echo display_2bill($total_invoice_cost);?>&nbsp;</td>	 </tr>	 <tr class="invoice_subheading">	 <td  align="right" class="invoice_td"><?php echo gettext("VAT");?> = <?php 	 $prvat = ($info_customer[0][13] / 100) * $total_invoice_cost;	 display_2bill($prvat);?>&nbsp;</td>	 </tr>	 <tr class="invoice_subheading">	 <td  align="right" class="invoice_td"><?php echo gettext("Grand Total");?> = <?php echo display_2bill($total_invoice_cost + $prvat);?>&nbsp;</td>	 </tr>	 <tr >	 <td>&nbsp;</td>	 </tr>	 <tr >	 <td  align="left" ><b><?php echo gettext("Status");?></b> :&nbsp; 	 <?php if($info_customer[0][12] == 't') {?>			  <img width="18" height="7" src="<?php echo Images_Path;?>/connected.gif">	 <?php }			else			{	 ?>			  <img width="18" height="7" src="<?php echo Images_Path;?>/terminated.gif">	<?php 			}	?>	 	 &nbsp;</td>	 </tr>	  <tr >	 <td>&nbsp;</td>	 </tr></table>

⌨️ 快捷键说明

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