2017-10-24 1 views
0

私はPHP開発者です。印刷ページが正常に動作しています。最初のページのみを表示するヘッダーコンテンツを非表示にする方法が必要です。非表示のテーブル行分割レコード。次のページの印刷後にテーブルの行を分割してヘッダコンテンツの色を削除する方法pdf

@mediaプリントで可能ですか?私はよく分からないが、この使用

htmlコード

<!-- font awesome css --> 
<meta charset="utf-8"> 
<meta http-equiv="x-ua-compatible" content="ie=edge"> 
<title></title> 
<meta name="description" content=""> 
<meta name="viewport" content="width=device-width, initial-scale=1"> 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> 
<!-- font awesome css --> 
<?php 
session_start(); 

//$fmt = new NumberFormatter('zh_Hans', NumberFormatter::CURRENCY); 
if(isset($_POST['result'])) { 

    $data = $_POST['result']; 

    $proforma_invoice_amount=0; 



    $record = json_decode($data, true); 

    if($record['proforma_amount_c']){ 
    $proforma_invoice_amount=$record['proforma_amount_c']; 
    } 

    //invoice date 
    $yrdata= strtotime($record['active_date']); 
    $inv_date = date('d-M-Y', $yrdata); 

    //invoice due date 

    $invDueDate = strtotime($record['invoice_due_date_c']); 
    if (empty($record['invoice_due_date_c'])) { 
    $due_date = ''; 
    }else { 
    $due_date = date('d/m/Y', $invDueDate); 
    } 

    //country name 
    if ($record['client_location_c'] == 'germany') { 
    $country = 'Germany'; 

    $address = '<span>'.$record['recipient_address'].'</span><br/><span>'.$record['recipient_address_postalcode'].'</span><br/><span>'.$record['recipient_address_city'].'</span>'; 
    }else { 
    $country = 'Romania'; 
    $address = '<span>'.$record['recipient_address'].'</span><br/><span>'.$record['recipient_address_city'].'</span><br/><span>'.$record['recipient_address_state'].' '.$record['recipient_address_country'].'</span><br/><span>Trade registry: '.$record['recipient_tax_no'].'</span><br/><span> Unique no.:'.$record['recipient_vat_id'].'</span>'; 
    } 

    if ($record['recipient_phone_number_c'] == NULL) { 
    $phone = 'phonefa'; 
    }else { 
    $phone = ''; 
    } 
    if ($record['recipient_fax_number_c'] == NULL) { 
    $fax= 'faxfa'; 
    }else { 
    $fax = ''; 
    } 

    //proforma invoice 
    if ($record['proforma_invoice_c'] == 'yes') { 
    $invoice_title = "Proforma Invoice"; 
    }else { 
    $invoice_title = "Invoice On Behalf And In The Name of Service Providers"; 
    } 

    if ($record['region_c'] == 'Non_EU_client_and_freelancer_provider') { 
    $clientvatId = ''; 
    // $region = 'NON EU CLIENT and freelancer provider'; 
    $regClass = 'region-title'; 
    $reverse = 'Reverse Charge to be applied related to VAT.'; 
    $content = 'This invoice includes the advanced cost of the respective guides as well as the commission of GGS GmbH. Regarding the service of the guides legal are established between you and the guides directly. Service non-taxiable in Germany.'; 
    }else if($record['region_c'] == 'Non_EU_client_and_employed_provider'){ 
    $clientvatId = ''; 
    // $region = 'NON EU CLIENT and employed provider'; 
    $regClass = 'region-title'; 
    $reverse = 'Reverse Charge to be applied related to VAT.'; 
    $content = 'Invoiced services are being provided through an employed guide of GGS GmbH. Service non-taxable in Germany.'; 
    }else if($record['region_c'] == 'German_client_and_freelancer_provider'){ 
    $clientvatId = $record['client_vat_id']; 
    // $region = 'GERMAN CLIENT and freelancer provider'; 
    $regClass = 'region-title'; 
    $reverse = ''; 
    $content = 'This invoice includes the advanced cost of the respective guides as well as the commission of GGS GmbH. Regarding the service of the guides, legal relation are established between you and the guides directly. GGS pays taxes analog to the margin taxation conformable to Par.25 UstG.'; 
    }else if($record['region_c'] == 'German_client_and_employed_provider'){ 
    $clientvatId = $record['client_vat_id']; 
// $region = 'GERMAN CLIENT and employed provider'; 
    $regClass = 'region-title'; 
    $reverse = ''; 
    $content = 'Invoiced services are being provided through an employed guide of GGS GmbH.'; 
    }else if($record['region_c'] == 'EU_client_and_freelancer_provider'){ 
    $clientvatId = $record['client_vat_id']; 
    // $region = 'EU CLIENT and freelancer provider'; 
    $regClass = 'region-title'; 
    $reverse = 'Reverse Charge to be applied according to EU regulation.'; 
    $content = 'This invoice includes the advanced cost of the respective guides as well as the commission of GGS GmbH. Regarding the service of the guides legal are established between you and the guides directly. Service non-taxiable in Germany.'; 
    }else if ($record['region_c'] == 'EU_client_and_employed_provider') { 
    $clientvatId = $record['client_vat_id']; 
    // $region = 'EU CLIENT and employed provider'; 
    $regClass = 'region-title'; 
    $reverse = 'Reverse Charge to be applied according to EU regulation.'; 
    $content ='Invoiced services are being provided through an employed guide of GGS GmbH. Service non-taxable in Germany.'; 
    }else { 
    $clientvatId = ''; 
    // $region = ''; 
    $regClass = ''; 
    $reverse = 'Reverse Charge to be applied related to VAT.'; 
    $content = 'This invoice includes the advanced cost of the respective guides as well as the commission of GGS GmbH. Regarding the service of the guides legal are established between you and the guides directly. Service non-taxiable in Germany.'; 
    } 

    //invoice 
    $invoice = $record[0]['clientinvoicedetails']; 
    $vendorDetails = $record[0]['vendorDetails']; 
} 
?> 
<script type="text/javascript"> 
print_order(); 
    function print_order(){ 
    //console.log('test'); 
     window.print('#printable'); 
    document.title= "<?=$record['ginvo_client_invoice_no']?>"; 
    } 

</script> 

<div class="app-box" id="printable"> 
    <div class="container"> 
     <div class="header-wrapper"> 
      <div class="brand"> 
       <img src="themes/default/images/company_logo.png?v=irxcvcunnaqWHVYHqEAgiw&amp;logo_md5=69fbb4688c6fcc37685a678b824f819b" alt="" style="width:150px;"> 
      </div> 
      <div class="country-bg"> 
      </div> 
      <div class="country-name"> 
       <h3><?=$country?></h3> 
      </div> 
     </div> 
     <!--Header content End Here--> 

     <div class="page-content"> 
      <div class="address"> 
       <div class="address-left"> 
        <p><strong>[email protected]</strong></p> 
        <span><?=$record['client_name']?></span><br> 
        <span><?=$record['client_address']?></span><br> 
        <span><?=$record['client_address_city']?></span><br> 
        <span><?=$record['client_address_state']?>, <?=$record['client_address_country']?></span><br> 
        <span><?=$record['client_address_postalcode']?></span><br> 
        <span style="font-weight:bold;margin-top:25px;"><?=$clientvatId?></span> 
       </div> 
       <div class="address-right"> 
        <p><?=$address ?></p> 
        <p> 
         <span><i class="fa fa-phone <?=$phone?>"></i> <?=$record['recipient_phone_number_c'] ?></span><br> 
         <span><i class="fa fa-print <?=$fax?>"></i> <?=$record['recipient_fax_number_c'] ?></span> 
        </p> 
       </div> 
      </div> 
      <!-- <div class="invoice_head-bg"></div> --> 
      <div class="invoice-head"> 
       <div class="invoice_head-bg"></div> 
       <h3><?=$invoice_title?></h3> 
       <p>for the assignment of guided tours, assistances, tour escorts, transfers</p> 
      </div> 

      <div class="invoice-details"> 
       <div class="invoice-number"> 
        <p><strong>Invoice number :</strong> <span><?=$record['ginvo_client_invoice_no']?></span></p> 
        <p><strong>Invoice date :</strong> <span><?=$inv_date?></span></p> 
       </div> 
       <div class="invoice-info"> 
        <span>(please invoice number and date with your payment)</span> 
       </div> 
      </div> 

      <div class="invoice-table"> 
       <table class="table"> 
        <thead> 
         <tr> 
          <th>Group ID</th> 
          <th>Date</th> 
          <th>City</th> 
          <th>Service</th> 
          <th>Duration</th> 
          <th>Note</th> 
          <th>Rate</th> 
         </tr> 
        </thead> 
        <tbody> 
         <?php 
         $count = 0; 
         $index=0; 
         foreach ($invoice as $inv) { 
         $count+= $inv['rate_with_vat']; 
         ?> 
         <tr> 
          <td><?=$inv['group_id']?></td> 
          <td><?=$inv['service_date']?></td> 
          <td><?=$inv['city']?></td> 
          <td><?=$inv['service']?></td> 
          <td><?=$inv['duration']?></td> 
          <td><?=$inv['notes']?></td> 
          <td class="text-right"><span><?php echo "&#0128"; ?></span> <?=$inv['rate_with_vat']?></td> 
         </tr> 
         <?php 
         foreach ($vendorDetails as $vendorDetail) { 
          // print_r($vendorDetail); 
          if($vendorDetail['id']==$inv['vendor_id']){ 
         ?> 
         <tr style="text-align:center;"> 
          <td colspan="7"><?=$vendorDetail['first_name']?>,<?=$vendorDetail['address_street']?>,<?=$vendorDetail['address_city']?>,<?=$vendorDetail['address_state']?>,<?=$vendorDetail['address_country']?>,<?=$vendorDetail['address_postalcode']?></td> 
         </tr> 

         <?php 
         } 
         } 
         $index++; 
         } ?> 
         <tr class="footer"> 
          <td colspan="6" class="text-right" style="text-transform:uppercase;"><strong>Total Sum</strong></td> 
          <td class="text-right"><span><?php echo "&#0128"; ?></span> <strong><?=$count ?></strong></td> 
         </tr> 
         <?php 
         if($proforma_invoice_amount>0&&$record['proforma_invoice_c'] != 'yes'){ 
         ?> 
         <tr class="footer"> 
          <td colspan="6" class="text-right" style="text-transform:uppercase;"><strong>Paid with Proforma</strong></td> 
          <td class="text-right"><span><?php echo "&#0128"; ?></span> <strong><?php echo number_format((float)$proforma_invoice_amount, '2', '.', '');?></strong></td> 
         </tr> 
         <tr class="footer"> 
          <td colspan="6" class="text-right" style="text-transform:uppercase;"><strong>Rest to Pay</strong></td> 
          <td class="text-right"><span><?php echo "&#0128"; ?></span> <strong><?=$count-$proforma_invoice_amount ?></strong></td> 
         </tr> 
         <?php 
         } 
         ?> 
        </tbody> 
       </table> 
      </div> 
      <div class="vat text-right"> 
       <span><?=$reverse?></span> 
      </div> 
      <div class="invoice-include"> 
       <p><?=$content?></p> 
      </div> 

      <div class="due-date"> 
       <p class="">Our invoice falls due immediately and is to be paid in full within</p> 
       <div class="date"><span><?=$due_date ?></span></div> 
      </div> 
      <?php if ($record['client_location_c'] == 'germany'){ ?> 
      <div class="thanks"> 
       <p>Thank you for your order!</p> 
      </div> 
      <?php }else { ?> 
      <div class="romania-cnp"> 
       <p class="">Intocmit de: Andreea loana</p> 
       <div class="cnp"><span>CNP: 2950318151935</span></div> 
      </div> 
      <?php } ?> 

      <div class="manufacture-address"> 
       <?php if ($record['client_location_c'] == 'germany'){ ?> 
       <div class="display-flex"> 
       <div class="text-left"> 
        <p> 
         <span>Global Guide Services GmbH</span><br> 
         <span>Münchner Str. 23</span><br> 
         <span>D-83703 Gmund a. Tegernsee</span><br> 
         <span>Local Court Munich, HRB 223121</span> 
        </p> 
       </div> 
       <div class="text-center"> 
        <p> 
         <span>Managing Director: Siavash Sartipi</span><br> 
         <span><i class="fa fa-phone"></i> +49 151 74327305</span><br> 
         <span><i class="fa fa-print"></i> +49 721 509663197</span><br> 
         <span>www.global-guide-services.com</span> 
        </p> 
       </div> 
       <div class="text-right"> 
        <p> 
         <span>VAT Nr DE 305563525</span><br> 
         <span>Tax Nr 139/127/50609</span><br> 
         <span>IBAN DE41 7001 0080 0697 1208 00</span><br> 
         <span>BIC/SWIFT PBNKDEFF</span> 
        </p> 
       </div> 
       </div> 
       <?php }else { ?> 
       <div class="text-center address_Raif"> 
        <p> 
         <span>Account holder: <label>Global Guides Services SRL,</label> Bank:Raiffeisen</span><br> 
         <span>IBAN RO 92 RZBR 0000 0600 1754 9626 BIC(SWIFT):RZBRROBU</span><br> 
         <span>VAT: RO34622172</span><br> 
        </p> 
       </div> 
       <?php } ?> 
      </div> 

     </div> 
     <!--Page content End Here--> 

    </div> 
</div> 

<style type="text/css"> 


/*@media print 
{ 
    table { page-break-after:auto } 
    tr { page-break-inside:avoid; page-break-after:auto } 
    td { page-break-inside:avoid; page-break-after:auto } 
    thead { display:table-header-group } 
    tfoot { display:table-footer-group } 
}*/ 

@page { 
    size: auto; /* auto is the initial value */ 
    margin: 0 auto;; /* this affects the margin in the printer settings */ 
} 

    body { 
    /*font-family: Aria 'Roboto', sans-serif;*/ 
    font-family: Arial, Verdana, Helvetica, sans-serif; 
    font-size: 12px; 
    margin: 0; 
    background: #efefef; 
    -webkit-print-color-adjust: exact; 
    page-break-after:always; 
    position: relative; 
    } 
    .app-box{ 
    margin-top: 30px; 
    } 

    .container { 
    width: 980px; 
    margin: 0 auto; 
    /*height: 980px;*/ 
    position: relative; 
    } 
    .header-wrapper { 
    /*margin-top: 15px;*/ 
    height: 65px; 
    border-bottom: 3px solid #344d90; 
    clear: both; 
    position: fixed; 
    top: 0; 
    width: 980px; 
    background: #fff; 
    } 

    .header-wrapper .brand { 
    float: left; 
    width: 33%; 
    margin-top: 7px; 
    } 

    .header-wrapper .country-name { 
    float: right; 
    padding: 10px 40px; 
    } 
.header-wrapper .country-name h3 { 
    color: #344d90; 
    z-index: 10000; 
    font-weight: 600; 
    font-size: 18px; 
} 

    .region-title{ 
     width: auto; 
     padding: 1px 22px; 
     float: left; 
     border: 2px solid #f532d4; 
     color: #f532d4; 
     line-height: 0; 
     margin-top: 10px; 
    } 


    .page-content { 
    font-size: 14px; 
    padding: 10px; 
    margin-top: 75px; 
    } 

    .address{ 
    display: flex; 
    justify-content: space-between; 
    line-height: 20px; 
    } 

    .address .address-left { 
    font-size: 16px; 
    } 

    .address .address-right { 
    text-align: right; 
    z-index: 10; 
    } 

    .invoice-head{ 
    text-align: center; 
    position: relative; 
    } 
    .invoice-head .invoice_head-bg { 
    height: 61px; 
    position: absolute; 
    z-index: -1; 
    width: 100%; 
    background: #d4d2d2; 
    /*background: -webkit-linear-gradient(#d4d2d2, rgba(230, 224, 224, 0)); 
    background: -o-linear-gradient(#d4d2d2, rgba(230, 224, 224, 0)); 
    background: -moz-linear-gradient(#d4d2d2, rgba(230, 224, 224, 0)); 
    background: linear-gradient(#d4d2d2, rgba(230, 224, 224, 0));*/ 
    -webkit-print-color-adjust: exact; 
    } 

    .invoice-head h3 { 
    text-transform: uppercase; 
    margin-bottom: 0; 
    font-size: 16px; 
    word-spacing: -2px; 
    padding: 5px; 
    } 

    .invoice-head p{ 
    margin-top: 5px; 
    font-size: 16px; 
    word-spacing: 4px; 
    } 

    .invoice-details{ 
    display: flex; 
    } 

    .invoice-details .invoice-info { 
    margin: 25px 40px; 
    } 

    .table { 
    width: 100%; 
    max-width: 100%; 
    margin-bottom: 1rem; 
    border-collapse: collapse; 
    margin: 4px 0 4px 0; 
    } 

    .table th, .table td { 
    padding: .70rem; 
    vertical-align: top; 
    border-top: 1px solid #eceeef; 
    width: 13%; 
    } 

    .table thead tr { 
    background: #7d93ce; 
    -webkit-print-color-adjust: exact; 
    } 

    .table tbody tr:nth-of-type(even) { 
    background-color: rgba(123, 159, 234, 0.26); 
    -webkit-print-color-adjust: exact; 
    } 

    .table tbody tr.footer { 
    background: #a9b8e2; 
    -webkit-print-color-adjust: exact; 
    } 

    *, ::after, ::before { 
    -webkit-box-sizing: inherit; 
    box-sizing: inherit; 
    } 

    .invoice-include { 
    width: 70%; 
    line-height: 21px; 
    } 

    .due-date{ 
    display: flex; 
    margin-top: -15px; 
    } 

    .due-date .date { 
    margin: 15px 40px; 
    } 
    .romania-cnp{ 
    display: flex; 
    margin-top: 30px; 
    margin-bottom: 30px; 
    } 

    .romania-cnp .cnp { 
    margin: 12px 40px; 
    } 

    .thanks { 
    margin-bottom: 30px; 
    } 

    .manufacture-address { 
    position: fixed; 
    bottom: 0; 
    width: 970px; 
    } 
    .display-flex { 
    display: flex; 
    justify-content: space-between; 
    line-height: 18px; 
    font-size: 14px; 
    position: relative; 
    width: 100%; 
    bottom: 0; 
    margin-top: 30%; 
    clear: both; 
    page-break-after:always; 
     background: #fff; 
    } 

    .manufacture-address .address_Raif{ 
    width: 100%; 
    } 
    .manufacture-address .address_Raif label{ 
    text-transform: uppercase; 
    } 

    .phonefa, .faxfa{ 
    display: none; 
    } 


    /*==== Common Styles =====*/ 

    .text-center { 
    text-align: center; 
    } 

    .text-right { 
    text-align: right; 
    font-style: initial; 
    } 
    .country-bg{ 
    height: 210px; 
    width: 200px; 
    /*right: 181px;*/ 
    position: absolute; 
    right: 0px; 
    background: #bdc9ec; 

    background: -webkit-linear-gradient(#bdc9ec, rgba(107, 113, 181, 0)); 
    background: -o-linear-gradient(#bdc9ec, rgba(107, 113, 181, 0)); 
    background: -moz-linear-gradient(#bdc9ec, rgba(107, 113, 181, 0)); 
    background: linear-gradient(#bdc9ec, rgba(107, 113, 181, 0)); 
    /*-webkit-print-color-adjust: exact;*/ 
    z-index: -1; 
    page-break-before: auto; 
    } 
</style> 
+0

Ple ase read [速い回答を得るために、どのような状況で私の質問に「緊急」や他の同様のフレーズを追加することができますか?](// meta.stackoverflow.com/q/326569) - 要約は、ボランティアに対処する理想的な方法であり、おそらく回答を得ることは非生産的です。これをあなたの質問に追加しないでください。 – halfer

答えて

0

@media print { 
    div.header-wrapper { 
    display: none; 
    } 

    div.header-wrapper:first { 
    display: block; 
    } 
} 

OR

を私はこれまで試したが、動作しません

@media print { 
    div.header-wrapper { 
    display: none; 
    } 

    div.header-wrapper:nth-child(1) { 
    display: block; 
    } 
} 
関連する問題