/// <summary>
        /// Convert DAL Contract object to value object
        /// </summary>
        /// <param name="contract">DAL Contract object</param>
        /// <param name="invoiceDate">Invoice date</param>
        public InvoiceHeaderVO(Contract contract, DateTime invoiceDate, int?DocumentTypeID)
        {
            ContractId     = contract.ID;
            ContractNumber = contract.ContractNumber;
            RecordType     = Constants.HEADER;
            CompanyId      = contract.CompanyID;
            CompanyName    = contract.OACompany.CompanyName;
            Field          = String.Join("|", new string[12]);
            Currency       = contract.Currency.CurrencyName;
            CustomerCode   = contract.OACustomer.CustomerID;
            DivisionId     = contract.Division.DivisionID;
            Reference      = !string.IsNullOrEmpty(contract.POReferenceNo) ? contract.POReferenceNo : Constants.ADVANCE_MAINT;
            VatCode        = contract.OACustomer.VatCode;
            DivisionName   = contract.Division.DivisionName;
            //Set Document type based on DocumentTypeID
            this.DocumentTypeID = DocumentTypeID;
            if (DocumentTypeID == 1)
            {
                DocumentTypeCR = contract.Division.DocumentTypeCR;
                DocumentTypeIN = contract.Division.DocumentTypeIN;
            }
            else if (DocumentTypeID == 2)
            {
                DocumentTypeCR = contract.Division.DepositDocumentTypeCR;
                DocumentTypeIN = contract.Division.DepositDocumentTypeIN;
            }
            InvoiceCustomerId = contract.InvoiceCustomerID;
            CustomerName      = contract.OACustomer.CustomerName;
            Status            = "S";
            DocumentDate      = Convert.ToString(invoiceDate.ToShortDateString());

            InvoiceDetailVos  = new List <InvoiceDetailVO>();
            FooterBillingLine = new InvoiceBillingLineVO();

            //Footer line for all companies
            FooterBillingLine.RecordType   = Constants.RECORD_TYPE_X;;
            FooterBillingLine.DocumentType = "HSINV";
            FooterBillingLine.Fields       = String.Join("|", new string[21]);
            FooterBillingLine.Fields       = "Yes|No";

            //Added one Extra footer Line 'T' for ComapnyId = 102
            if (contract.CompanyID == 102)
            {
                FooterBillingLine.RecordTypeForT   = Constants.RECORD_TYPE_T;
                FooterBillingLine.DocumentTypeForT = Constants.DOCUMENT_TYPE_MASE;
                FooterBillingLine.Field3           = "10000";
                FooterBillingLine.VatCode          = "0.00";
            }
            //else
            //{
            //    FooterBillingLine.RecordType = Constants.RECORD_TYPE_X; ;
            //    FooterBillingLine.DocumentType = "HSINV";
            //    FooterBillingLine.Fields = String.Join("|", new string[21]);
            //    FooterBillingLine.Fields = "Yes|No";
            //}
        }
        /// <summary>
        /// Create clone object to invoice header
        /// </summary>
        /// <param name="invoiceHeaderVO">Invoice header value object</param>
        /// <param name="invoiceDate">Invoice date</param>
        public InvoiceHeaderVO(InvoiceHeaderVO invoiceHeaderVO, DateTime invoiceDate)
        {
            ContractId        = invoiceHeaderVO.ContractId;
            ContractNumber    = invoiceHeaderVO.ContractNumber;
            RecordType        = Constants.HEADER;
            CompanyId         = invoiceHeaderVO.CompanyId;
            Field             = String.Join("|", new string[12]);
            Currency          = invoiceHeaderVO.Currency;
            CustomerCode      = invoiceHeaderVO.CustomerCode;
            DivisionId        = invoiceHeaderVO.DivisionId;
            Reference         = !string.IsNullOrEmpty(invoiceHeaderVO.Reference) ? invoiceHeaderVO.Reference : Constants.ADVANCE_MAINT;
            VatCode           = invoiceHeaderVO.VatCode;
            PostingPeriod     = invoiceHeaderVO.PostingPeriod;
            PostingYear       = invoiceHeaderVO.PostingYear;
            DocumentTypeID    = invoiceHeaderVO.DocumentTypeID;
            DocumentTypeCR    = invoiceHeaderVO.DocumentTypeCR;
            DocumentTypeIN    = invoiceHeaderVO.DocumentTypeIN;
            InvoiceCustomerId = invoiceHeaderVO.InvoiceCustomerId;
            CustomerName      = invoiceHeaderVO.CustomerName;
            DivisionName      = invoiceHeaderVO.DivisionName;

            Status       = "S";
            DocumentDate = Convert.ToString(invoiceDate.ToShortDateString());

            InvoiceDetailVos  = new List <InvoiceDetailVO>();
            FooterBillingLine = new InvoiceBillingLineVO();

            //Footer line for all companies
            FooterBillingLine.RecordType   = Constants.RECORD_TYPE_X;
            FooterBillingLine.DocumentType = "HSINV";
            FooterBillingLine.Fields       = String.Join("|", new string[21]);
            FooterBillingLine.Fields       = "Yes|No";

            //Added one Extra footer Line 'T' for ComapnyId = 102
            if (invoiceHeaderVO.CompanyId == 102)
            {
                FooterBillingLine.RecordTypeForT   = Constants.RECORD_TYPE_T;
                FooterBillingLine.DocumentTypeForT = Constants.DOCUMENT_TYPE_MASE;
                FooterBillingLine.Field3           = "10000";
                FooterBillingLine.VatCode          = "0.00";
            }
            //else
            //{
            //    FooterBillingLine.RecordType = Constants.RECORD_TYPE_X;
            //    FooterBillingLine.DocumentType = "HSINV";
            //    FooterBillingLine.Fields = String.Join("|", new string[21]);
            //    FooterBillingLine.Fields = "Yes|No";
            //}
        }
 /// <summary>
 /// Default constructor
 /// </summary>
 public InvoiceDetailVO()
 {
     InvoiceGlDetails    = new InvoiceGLDetailVO();
     InvoiceBillingLines = new InvoiceBillingLineVO();
     NominalLinesList    = new List <InvoiceGLDetailVO>();
 }