/**
 * Created by zhang on 2018/3/22.
 */
let mongoose = require("mongoose");
let subSchema = require("../all_schemas/bills_sub_schemas");
let deleteSchema = require('../all_schemas/delete_schema');
let Schema = mongoose.Schema;
let billsSchema = new Schema({
    ID: String,
    ParentID: String,
    NextSiblingID: String,
    projectID: Number,
    serialNo: Number,
    chapterID: Number,
    billsLibId: Number,
    code: String,
    fullCode: String,
    type:{type: Number,default:4},//1 :大项费用 2：分部 3分项 4清单;5补项
    isAdd:{type: Number,default:0},//1 true 0 false是否新增
    name: String,
    unit: String,
    quantity: String, // Decimal
    quantityEXP:String,//工程量表达式
    feeRateID:Number,
    feeRate:String,
    isFromDetail:{type: Number,default:0},//1 true 0 false
    programID: Number,
    calcBase: String,
    calcBaseValue: String,     // 计算基数表达式的值
    // 工程量计算规则
    ruleText: String,
    // 说明
    comments: String,
    // 调价
    xs_Labour: String, // Decimal
    xs_Material: String, // Decimal
    xs_Machine: String, // Decimal
    xs_FeeRate: String, // Decimal
    xs_LabourPrice: String, // Decimal
    xs_MaterialPrice: String, // Decimal
    xs_MachinePrice: String, // Decimal
    isTender_Labour: Boolean,
    isTender_Material: Boolean,
    isTender_Machine: Boolean,
    tenderTargetPrice: String, // Decimal
    tenderTargetUnitPrice: String, // Decimal
    tenderTargetUnitPrice: String, // Decimal
    //工作内容//zhong 2017-8-31
    jobContentText: String, //清单工作内容列显示文本, 减少第一次拉数据时的循环次数
    jobContent: [subSchema.jobContentSchema],
    //项目特征
    itemCharacterText: String,//清单项目特征列显示文本
    itemCharacter: [subSchema.itemCharacterSchema],
    // 费用字段
    fees: [subSchema.feesSchema],
    // 标记字段
    flags: [subSchema.flagsSchema],
    installationKey:String,//用来记录安装增加费的关联字段
    deleteInfo: deleteSchema,
    isEstimate:{type: Number,default:0},       // 1 true 0 false 是否暂估
    remark:String
});

mongoose.model("bills", billsSchema);