Example #1
0
 public static void AfterChange_Order(fmIDocCacheKKMPayment instance)
 {
     if (instance.Order != null)
     {
         foreach (fmIDocCacheKKMPaymentLine line in instance.Lines)
         {
             line.Order = instance.Order;
         }
     }
 }
Example #2
0
 public static void AfterChange_Operation(fmIDocCacheKKMPayment instance)
 {
     if (instance.Operation != null)
     {
         foreach (fmIDocCacheKKMPaymentLine line in instance.Lines)
         {
             line.Operation = instance.Operation;
         }
     }
 }
Example #3
0
        public static void AfterConstruction(fmIDocCacheKKMPayment instance, IObjectSpace os)
        {
            instance.Date = CommonMethods.DateTimeNow();
            IList <fmIDocCacheKKM> kkms = os.GetObjects <fmIDocCacheKKM>();

            foreach (fmIDocCacheKKM kkm in kkms.Where(x => x.DateFrom <= instance.Date && instance.Date <= x.DateTo))
            {
                instance.KKMs.Add(kkm);
            }
            RefreshLines(os, instance);
        }
Example #4
0
        public static void RefreshLines(IObjectSpace os, fmIDocCacheKKMPayment instance)
        {
            IList <csNDSRate> rates = os.GetObjects <csNDSRate>();
            csNDSRate         vat18 = rates.FirstOrDefault(x => x.Numerator == 18);
            csNDSRate         vat10 = rates.FirstOrDefault(x => x.Numerator == 10);

            foreach (fmIDocCacheKKM kkm in instance.KKMs)
            {
                fmIDocCacheKKMPaymentLine line = instance.Lines.FirstOrDefault(x => x.KKM == kkm);
                if (line == null)
                {
                    line = os.CreateObject <fmIDocCacheKKMPaymentLine>();
                    instance.Lines.Add(line);
                    line.KKM     = kkm;
                    line.VatRate = vat18;
                    //
                    line = os.CreateObject <fmIDocCacheKKMPaymentLine>();
                    instance.Lines.Add(line);
                    line.KKM     = kkm;
                    line.VatRate = vat10;
                }
            }
        }
Example #5
0
 public static Int32 Get_Month(fmIDocCacheKKMPayment instance)
 {
     return(instance.Date.Year * 100 + instance.Date.Month);
 }