예제 #1
0
        public static void GetLosses()
        {
            //Params: GetTaxManagerStartYear c:\MYOBAO\DataPM _3NG12GEZU AAAAA_T98H 2013 c:\temp\sltest.txt
            if (AEComAPI.paramAry.Length == 6)
            {
                string aoContactId = AEComAPI.paramAry[3];
                int    Year        = int.Parse(AEComAPI.paramAry[4]);
                string outPathName = AEComAPI.paramAry[5]; // Output file name and path

                LossesComDto lossDetails = AEComAPI.aoComAPI.GetLosses(aoContactId, Year);

                System.IO.File.WriteAllText(outPathName, lossDetails.LossesCarriedForward.ToString() + "," + lossDetails.ImputationCreditsCarriedForward.ToString());
            }
        }
예제 #2
0
        public static void UpdateLosses()
        {
            //Params: UpdateLosses c:\MYOBAO\DataPM _3NG12GEZU AAAAA_T98H 2013 I 123.45 23.45 c:\temp\sltest.txt
            if (AEComAPI.paramAry.Length == 9)
            {
                string  aoContactId = AEComAPI.paramAry[3];
                int     year        = int.Parse(AEComAPI.paramAry[4]);
                string  taxTypeCode = AEComAPI.paramAry[5];
                decimal lossBfd     = decimal.Parse(AEComAPI.paramAry[6]);
                decimal impBfd      = decimal.Parse(AEComAPI.paramAry[7]);
                string  outPathName = AEComAPI.paramAry[8]; // Output file name and path

                //Currently only INC tax type can be updated back to TM - ignore other types
                if (taxTypeCode != "I")
                {
                    return;
                }

                LossesComDto lossDetails = new LossesComDto();
                lossDetails.LossesCarriedForward            = lossBfd;
                lossDetails.ImputationCreditsCarriedForward = impBfd;

                TaxTypeComDto[] taxTypes = AEComAPI.aoComAPI.GetTaxTypes();
                TaxTypeComDto   taxType  = taxTypes.Where(o => o.Code.Substring(0, taxTypeCode.Length) == taxTypeCode).FirstOrDefault();
                if (taxType == null)
                {
                    System.IO.File.WriteAllText(outPathName, "UpdateLosses record not found");
                }
                else
                {
                    AEComAPI.aoComAPI.UpdateLosses(aoContactId, year, taxType.TaxTypeId, lossDetails);

                    System.IO.File.WriteAllText(outPathName, "UpdateLosses was processed");
                }
            }
        }