package com.tax.file.utils.invoice;

import java.text.SimpleDateFormat;

import com.tax.file.model.FinInvoice;
import com.tax.file.model.FinInvoiceDetail;
import com.tax.file.model.FinVehicle;
import com.tax.file.utils.invoice.SpecialInvoiceCellRead.SingletonHolder;
import com.yxcheng.token.utils.StringUtil;
/** 
 * 机动车票单元格读取具体实现类
 * 
 * */ 
public class CarInvoiceCellRead extends AbstractInvoiceCellRead {
	
    private CarInvoiceCellRead(){
		
	}
	
	public static class SingletonHolder{
		private static CarInvoiceCellRead instance = new CarInvoiceCellRead();
	}
	
	public static  CarInvoiceCellRead getInstance(){
		return SingletonHolder.instance;
	}

	 /** 
     * 根据单元格序号和单元格的值设置发票主模型的值
     * @param invoice 发票模型
     * @param cellNum 单元格序号
     * @param cellValue 单元格值
     * @throws Exception  
     */ 
	public static void readCellVehicle(FinVehicle invoice, int cellNum, String cellValue) throws Exception{
		
	switch(cellNum){
     	case 1:
     		invoice.setInvKind(cellValue);
     		break;
     	case 2:
     		invoice.setInvNum(cellValue);
     		break;
     	case 3:
     		if(StringUtil.isNotEmpty(cellValue)){
     			invoice.setInvDate(new SimpleDateFormat("yyyy-MM-dd").parse(cellValue));
     		}
     		break;
     	case 4:
     		invoice.setInvStatus(getInvStatus(cellValue));
     		break;
     	case 5:
     		invoice.setBuyerName(cellValue);
     		break;
     	case 6:
     		invoice.setCardid(cellValue);
     		break;
    	case 7:
     		invoice.setBuyerTaxno(cellValue);
     		break;	
     	case 8:
     		invoice.setCartype(cellValue);
     		break;
     	case 9:
     		invoice.setMakeModel(cellValue);
     		break;
     	case 10:
     		invoice.setMakeAddress(cellValue);
     		break;
     	case 11:
     		invoice.setCertificationNo(cellValue);
     		break;
     	case 12:
     		invoice.setImportBookNo(cellValue);
     		break;
     	case 13:
     		invoice.setInspectionNo(cellValue);
     		break;
     	case 14:
     		invoice.setEngineNo(cellValue);
     		break;
     	case 15:
     		invoice.setFrameNo(cellValue);
     		break;
     	case 16:
     		invoice.setInvSum(getDoubleValue(cellValue));
     		break;
     	case 17:
     		invoice.setSellerName(cellValue);
     		break;
     	case 18:
     		invoice.setPhoneNo(cellValue);
     		break;
     	case 19:
     		invoice.setSellerTaxno(cellValue);
     		break;
     	case 20:
     		invoice.setAccount(cellValue);
     		break;
     	case 21:
     		invoice.setAddress(cellValue);
     		break;
     	case 22:
     		invoice.setBank(cellValue);
     		break;
     	case 23:
     		invoice.setInvvate(cellValue);
     		break;
     	case 24:
     		invoice.setInvVat(getDoubleValue(cellValue));
     		break;
     	case 25:
     		invoice.setCompetentTaxName(cellValue);
     		break;
     	case 26:
     		invoice.setCompetentTaxCode(cellValue);
     		break;
     	case 27:
     		invoice.setInvCost(getDoubleValue(cellValue));
     		break;
     	case 28:
     		invoice.setTaxReceiptNo(cellValue);
     		break;
     	case 29:
     		invoice.setTonnage(cellValue);
     		break;
     	case 30:
     		invoice.setMaxCapacity(cellValue);
     		break;
     }

	}
}
