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.FinOldcar;
import com.tax.file.utils.invoice.GeneralInvoiceCellRead.SingletonHolder;
import com.yxcheng.token.utils.StringUtil;
/** 
 * 二手车票单元格读取具体实现类
 * 
 * */ 
public class OldCarInvoiceCellRead extends AbstractInvoiceCellRead {
	
	
    private OldCarInvoiceCellRead(){
		
	}
	
	public static class SingletonHolder{
		private static OldCarInvoiceCellRead instance = new OldCarInvoiceCellRead();
	}
	
	public static  OldCarInvoiceCellRead getInstance(){
		return SingletonHolder.instance;
	}

	 /** 
     * 根据单元格序号和单元格的值设置发票主模型的值
     * @param invoice 发票模型
     * @param cellNum 单元格序号
     * @param cellValue 单元格值
     * @throws Exception  
     */   
	public static void readCellInvoice(FinOldcar 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.setBuyerCardid(cellValue);
     		break;
     	case 7:
     		invoice.setBuyerAddress(cellValue);
     		break;
     	case 8:
     		invoice.setBuyerPhone(cellValue);
     		break;
     	case 9:
     		invoice.setSellerName(cellValue);
     		break;
     	case 10:
     		invoice.setSellerCardid(cellValue);
     		break;
     	case 11:
     		invoice.setSellerAddress(cellValue);
     		break;
     	case 12:
     		invoice.setSellerPhone(cellValue);
     		break;
     	case 13:
     		invoice.setCarLicense(cellValue);
     		break;
     	case 14:
     		invoice.setRegistrationNo(cellValue);
     		break;
     	case 15:
     		invoice.setCartype(cellValue);
     		break;
     	case 16:
     		invoice.setFrameNo(cellValue);
     		break;
     	case 17:
     		invoice.setMakeModel(cellValue);
     		break;
     	case 18:
     		invoice.setTransferManage(cellValue);
     		break;
     	case 19:
     		invoice.setInvSum(getDoubleValue(cellValue));
     		break;
     	case 20:
     		invoice.setBusinessUnit(cellValue);
     		break;
     	case 21:
     		invoice.setBusinessUnitAddress(cellValue);
     		break;
     	case 22:
     		invoice.setBusinessUnitTaxno(cellValue);
     		break;
     	case 23:
     		invoice.setBusinessUnitBank(cellValue);
     		break;
     	case 24:
     		invoice.setBusinessUnitPhone(cellValue);
     		break;
     	case 25:
     		invoice.setOldcarMarket(cellValue);
     		break;
     	case 26:
     		invoice.setOldcarMarketTaxno(cellValue);
     		break;
     	case 27:
     		invoice.setOldcarMarketAddress(cellValue);
     		break;
     	case 28:
     		invoice.setOldcarMarketBank(cellValue);
     		break;
     	case 29:
     		invoice.setOldcarMarketPhone(cellValue);
     		break;
     	case 30:
     		invoice.setRemark(cellValue);
     		break;
     	case 31:
     		invoice.setBillingName(cellValue);
     		break;
     }

	}

}
