<!DOCTYPE html> 
 <html> 
  <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
    <meta content="telephone=no" name="format-detection"> 
    <meta name="apple-mobile-web-app-capable" content="yes"> 
    <meta name="apple-mobile-web-app-status-bar-style" content="black"> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> 
    <style type="text/css"> 
      td { padding: 3px; } 
    </style> 
  </head> 
   <body style="padding: 10px 10px 0px 10px;font-size:24px;font-family:Microsoft YaHei;"> 
     <table width="100%" class="plaintable"> 
      {{ if .__title }}
      <tr> 
        <td align="center" style="font-size:48px;">{{.__title|trim}}</td> 
      </tr> 
      <tr> 
        <td align="center">订货单 {{ .state_text | empty}}</td> 
      </tr> 
      {{else}}
      <tr> 
        <td align="center" style="font-size:48px;">订货单 {{ .state_text | empty}}</td> 
      </tr> 
      {{end}}
     </table> 
     <div style="width:100%;float:left;"> 
       <table width="60%" class="plaintable" style="float:left;"> 
        <tr> 
          <td align="left">单号:</td> 
          <td align="left">{{ .code }}</td> 
          <td align="left">日期:</td> 
          <td align="left">{{ .bill_date }}</td> 
        </tr> 
         <tr> 
           <td align="left" width="10%" nowrap>客户:</td> 
           <td align="left" width="40%" nowrap>{{ .customer_name }} {{ .customer_mobile }}</td> 
           <td align="left" width="10%" nowrap>销售:</td> 
           <td align="left" width="40%" nowrap>{{ .salesman_name | empty }}</td> 
         </tr> 
         <tr> 
          <td align="left">地址:</td> 
          <td align="left" colspan="3">{{ .customer_province | empty }}{{ .customer_city | empty }}{{ .customer_district | empty }}{{ .customer_address | empty }}</td> 
        </tr> 
       </table> 
     </div> 
     <p> 
     <table id="datatable" width="95%" class="plaintable" border="1" cellpadding="0" cellspacing="0"> 
        <colgroup>
          <col width="130"/>
          <col width="auto"/>
          <col width="100"/>
          {{range $si,$sv := (index $.sizes 0)}}
          <col width="70"/>
          {{end}}
          <col width="100"/>
          <col width="100"/>
          <col width="100"/>
        </colgroup>

      {{range $i,$v := .sizes}}
        {{ $title_goods := ``}}
        {{ $title_goods_name := ``}}
        {{ $title_color := ``}}
        {{ $title_price := ``}}
        {{ $title_quantity := ``}}
        {{ $title_amount := ``}}

        {{if eq $i $.sizes_last_index}}
          {{ $title_goods = `货号`}}
          {{ $title_goods_name = `名称`}}
          {{ $title_color = `颜色`}}

          {{ $title_price = `单价`}}
          {{ $title_quantity = `数量`}}
          {{ $title_amount = `金额`}}
        {{end}}

        <tr> 
          <td align="center" nowrap>{{ $title_goods }}</td> 
          <td align="center" nowrap>{{ $title_goods_name }}</td> 
          <td align="center" nowrap>{{ $title_color }}</td> 

          {{range $si,$sv := $v}}
          <td align="center" nowrap>{{ $sv }}</td> 
          {{end}}

        {{if eq $i $.sizes_last_index}}
          <td align="center" nowrap>{{ $title_price }}</td> 
          <td align="center" nowrap>{{ $title_quantity }}</td> 
          <td align="center" nowrap>{{ $title_amount }}</td> 
        {{end}}
        </tr> 
      {{end}}
      
      {{range $d := .detail}}
      <tr> 
      <td align="center" >{{ $d.code }}</td> 
      <td align="center" >{{ $d.name }}</td> 
      <td align="center" >{{ $d.color_name }}</td> 
      {{range $si,$sv := (index $.sizes 0)}}
        <td align="center" >{{ (mapValStr $d (printf `s%d` (addInt $si 1) )) | emptyZero }}</td> 
      {{end}}
      <td align="center">{{ $d.price }}</td> 
      <td align="center">{{ $d.quantity }}</td> 
      <td align="center">{{ $d.amount }}</td> 
      </tr>
      {{end}}

       <tr> 
          <td>合计</td> 
          <td colspan="2"></td> 
          {{range $si,$sv := (index $.sizes 0)}}
            <td align="center"></td> 
          {{end}}
          <td></td> 
          <td align="center" >{{ .bill_quantity }}</td> 
          <td align="center" >{{ .bill_amount }}</td> 
       </tr> 
     </table> 
     </p> 
     <div class="plaintable"> 
      <div>备注: {{ .remark | empty }}</div>
      <div>打印时间: {{ .print_time }}</div>
       {{range $i,$v := .__tails}}
         <div>{{ $v }}</div>
       {{end}}
     </div> 
   </body> 
 </html>