Exemplo n.º 1
0
 partial void InvoiceDate_Changed()
 {
     InvoiceDue = InvoiceDate.AddDays(30);
     // If the ShipDate is earlier than the new InvoiceDate, update it
     if (ShipDate < InvoiceDate)
     {
         ShipDate = InvoiceDate.AddDays(2);
     }
 }
        internal void Populate_InspHireInvoice(Dictionary <string, string> invoice)
        {
            DateTime tmpDateTime;
            Decimal  tmpDecimal;
            double   tmpDouble;

            InvoiceAccount = invoice["ACCT"];
            AccountName    = invoice["ACCTNAME"];

            InvoiceId = invoice["INVNO"];
            if (!string.IsNullOrEmpty(InvoiceId) && InvoiceId.IndexOf(".") != -1)
            {
                InvoiceId = InvoiceId.Substring(0, InvoiceId.IndexOf("."));
            }

            if (DateTime.TryParse(invoice["DATE"], out tmpDateTime))
            {
                InvoiceDate = tmpDateTime;
            }

            // invoice["SETTDAYS"] ??
            if (Double.TryParse(invoice["SETTDAYS"], out tmpDouble))
            {
                DueDate = InvoiceDate.AddDays(tmpDouble);
            }

            if (DueDate < DateTime.Now)
            {
                DaysOverdue = (DateTime.Now - DueDate).Days;
            }

            //SalesBalanceMST ?? I dont think this is used sitewide

            if (Decimal.TryParse(invoice["VAT"], out tmpDecimal))
            {
                SumTaxMST = tmpDecimal;
            }
            if (Decimal.TryParse(invoice["GOODS"], out tmpDecimal))
            {
                InvoiceAmountMST = tmpDecimal;
            }

            if (Decimal.TryParse(invoice["AMTPAID"], out tmpDecimal))
            {
                AMTPAID = (int)tmpDecimal;
            }
            IsPaid = AMTPAID == InvoiceAmountMST;

            SalesType = invoice["INVTYPE"];

            ContactPersonId = SPCODE = invoice["SPCODE"];
            SalesId         = CONTNO = invoice["CONTNO"];
        }