示例#1
0
        public static void GetInterimTaxDetails()
        {
            //Params: GetInterimTaxDetails c:\MYOBAO\DataPM _3NG12GEZU AAAAA_T98H 2014 I c:\temp\sltest.txt
            string aoContactId = AEComAPI.paramAry[3];
            int    year        = int.Parse(AEComAPI.paramAry[4]);
            string taxTypeCode = AEComAPI.paramAry[5];
            string outPathName = AEComAPI.paramAry[6];
            string outString   = string.Empty;

            if (AEComAPI.paramAry.Length == 7)
            {
                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, "GetInterimTaxDetails record not found.");
                }
                else
                {
                    InterimTaxDetailsComDto interimTaxDetails = AEComAPI.aoComAPI.GetInterimTaxDetails(aoContactId, year, taxType.TaxTypeId);

                    Type interimTaxDetailType = interimTaxDetails.GetType();
                    foreach (PropertyInfo provisionalTaxInfo in interimTaxDetailType.GetProperties())
                    {
                        outString = outString + "," + provisionalTaxInfo.GetValue(interimTaxDetails, null);
                    }
                    outString = outString.Substring(1);
                    System.IO.File.WriteAllText(outPathName, outString);
                }
            }
        }
示例#2
0
        public static void HasEstimateForYear()
        {
            //TODO check this method existance in COMAPI !!!
            //Params: HasEstimateForYear c:\MYOBAO\DataPM _3NG12GEZU AAAAA_T98H 2013 I c:\temp\sltest.txt
            string aoContactId = AEComAPI.paramAry[3];
            int    year        = int.Parse(AEComAPI.paramAry[4]);
            string taxTypeCode = AEComAPI.paramAry[5];
            string outPathName = AEComAPI.paramAry[6];   // Output file name and path

            if (AEComAPI.paramAry.Length == 7)
            {
                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, "HasEstimateForYear record not find");
                }
                else
                {
                    //TODO check this method existance in COMAPI !!!
                    // bool assessedDate = AEComAPI.aoComAPI.HasEstimateForYear(aoContactId, year, taxTypeId);
                    // System.IO.File.WriteAllText(outPathName, assessedDate.ToString());
                }
            }
        }
示例#3
0
        public static void AddTaxDocumentTransaction()
        {
            //Params: AddTaxDocumentTransaction c:\MYOBAO\DataPM _3NG12GEZU AAAAA_T98H 2013 IR3 True I 0830 12.34 01/01/2015 payment c:\temp\sltest.txt
            string   aoContactId        = AEComAPI.paramAry[3];
            short    year               = short.Parse(AEComAPI.paramAry[4]);
            string   formTypeCode       = AEComAPI.paramAry[5];
            bool     isPrimary          = Boolean.Parse(AEComAPI.paramAry[6]);
            string   taxTypeCode        = AEComAPI.paramAry[7];
            string   taxTransactionType = AEComAPI.paramAry[8];
            decimal  amount             = Decimal.Parse(AEComAPI.paramAry[9]);
            DateTime effectiveDate      = DateTime.Parse(AEComAPI.paramAry[10]);
            string   comment            = AEComAPI.paramAry[11];
            string   outPathName        = AEComAPI.paramAry[12]; // Output file name and path

            if (AEComAPI.paramAry.Length == 13)
            {
                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, "AddTaxDocumentTransaction record not found.");
                }
                else
                {
                    TaxDocumentTransactionComDto taxDocumentTransaction = new TaxDocumentTransactionComDto()
                    {
                        TaxTypeId          = taxType.TaxTypeId,
                        TaxTransactionType = taxTransactionType,
                        Amount             = amount,
                        EffectiveDate      = effectiveDate,
                        Comment            = comment
                    };

                    AEComAPI.aoComAPI.OpenTaxDocument(aoContactId, year, formTypeCode, isPrimary);
                    AEComAPI.aoComAPI.AddTaxDocumentTransaction(taxDocumentTransaction);
                    AEComAPI.aoComAPI.SaveTaxDocument();
                    System.IO.File.WriteAllText(outPathName, "AddTaxDocumentTransaction was processed.");
                }
            }
        }
示例#4
0
        public static void AddTaxDocumentTransferTransaction()
        {
            //Params: AddTaxDocumentTransferTransaction c:\MYOBAO\DataPM _3NG12GEZU I 100 01/01/2015 advance 069038638 31/03/2015 S c:\temp\sltest.txt
            string   taxTypeCode            = AEComAPI.paramAry[3];
            decimal  amount                 = Decimal.Parse(AEComAPI.paramAry[4]);
            DateTime effectiveDate          = DateTime.Parse(AEComAPI.paramAry[5]);
            string   comment                = AEComAPI.paramAry[6];
            string   otherPartyIrdNo        = AEComAPI.paramAry[7];
            DateTime otherPartyTaxPeriodEnd = DateTime.Parse(AEComAPI.paramAry[8]);
            string   otherPartyTaxTypeCode  = AEComAPI.paramAry[9];
            string   outPathName            = AEComAPI.paramAry[10]; // Output file name and path

            if (AEComAPI.paramAry.Length == 11 && !string.IsNullOrEmpty(otherPartyIrdNo.ToString()))
            {
                TaxTypeComDto[] taxTypes          = AEComAPI.aoComAPI.GetTaxTypes();
                TaxTypeComDto   taxType           = taxTypes.Where(o => o.Code.Substring(0, taxTypeCode.Length) == taxTypeCode).FirstOrDefault();
                TaxTypeComDto   otherPartyTaxType = taxTypes.Where(o => o.Code.Substring(0, taxTypeCode.Length) == otherPartyTaxTypeCode).FirstOrDefault();
                if (taxType == null || otherPartyTaxType == null)
                {
                    System.IO.File.WriteAllText(outPathName, "AddTaxDocumentTransferTransaction record not found.");
                }
                else
                {
                    TaxDocumentTransferTransactionComDto taxDocumentTransferTransaction = new TaxDocumentTransferTransactionComDto()
                    {
                        TaxTypeId              = taxType.TaxTypeId,
                        Amount                 = amount,
                        EffectiveDate          = effectiveDate,
                        Comment                = comment,
                        OtherPartyIrdNo        = otherPartyIrdNo,
                        OtherPartyTaxPeriodEnd = otherPartyTaxPeriodEnd,
                        OtherPartyTaxTypeId    = otherPartyTaxType.TaxTypeId
                    };

                    AEComAPI.aoComAPI.AddTaxDocumentTransferTransaction(taxDocumentTransferTransaction);
                    System.IO.File.WriteAllText(outPathName, "AddTaxDocumentTransferTransaction was processed.");
                }
            }
        }
示例#5
0
        public static void GetAssessedDate()
        {
            //Params: GetAssessedDate c:\MYOBAO\DataPM _3NG12GEZU AAAAA_T98H 2013 I c:\temp\sltest.txt
            string aoContactId = AEComAPI.paramAry[3];
            int    year        = int.Parse(AEComAPI.paramAry[4]);
            string taxTypeCode = AEComAPI.paramAry[5];
            string outPathName = AEComAPI.paramAry[6];   // Output file name and path

            if (AEComAPI.paramAry.Length == 7)
            {
                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, "GetAssessedDate record not find");
                }
                else
                {
                    DateTime assessedDate = AEComAPI.aoComAPI.GetAssessedDate(aoContactId, year, taxType.TaxTypeId);
                    System.IO.File.WriteAllText(outPathName, assessedDate.ToString());
                }
            }
        }
示例#6
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");
                }
            }
        }