コード例 #1
0
        public RtiTaxYearRowData(string sPeriod, string sAmountPaid, string sAmountDue)
        {
            var ci = new CultureInfo("en-GB", false);

            const string    sOneMonthPattern = @"(\d+)[^ ]+ (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)";
            MatchCollection match            = Regex.Matches(sPeriod, "^" + sOneMonthPattern + " - " + sOneMonthPattern + "$");

            if (match.Count != 1)
            {
                throw new HarvesterException("Unexpected format in period cell.");
            }

            GroupCollection grp = match[0].Groups;

            if (grp.Count != 5)
            {
                throw new HarvesterException("Unexpected format in period cell.");
            }

            DayStart   = Convert.ToInt32(grp[1].Value);
            MonthStart = DateTime.ParseExact(grp[2].Value, "MMM", ci).Month;

            DayEnd   = Convert.ToInt32(grp[3].Value);
            MonthEnd = DateTime.ParseExact(grp[4].Value, "MMM", ci).Month;

            AmountPaid = AThrasher.ParseGBP(NormaliseAmountStr(sAmountPaid));
            AmountDue  = AThrasher.ParseGBP(NormaliseAmountStr(sAmountDue));
        }         // constructor
コード例 #2
0
        }         // BusinessDetails

        private bool ReturnDetails(HtmlNode oNode, VatReturnSeeds seeds)
        {
            HtmlNode oDL = oNode.SelectSingleNode("dl");

            if (oDL == null)
            {
                Warn("Return details not found.");
                return(false);
            }             // if

            var dlp = new DLParser(oDL, true, VerboseLogging, this);

            if (!dlp.Success)
            {
                Info("DL parser failed, not setting return details fields.");
                return(false);
            }             // if

            foreach (KeyValuePair <string, string> pair in dlp.Data)
            {
                if (pair.Key.Length > 1)
                {
                    decimal nAmount = AThrasher.ParseGBP(pair.Value);
                    seeds.ReturnDetails[pair.Key.Substring(0, pair.Key.Length - 1)] = new Coin(nAmount, "GBP");
                    Debug("VatReturnSeeds.ReturnDetails[{0}] = {1}", pair.Key, nAmount);
                }         // if
            }             // foreach

            return(true);
        } // ReturnDetails
コード例 #3
0
        }         // BusinessDetails

        private bool ReturnDetails()
        {
            var oSeeds = (VatReturnSeeds)Seeds;

            for (int i = 1; i <= 9; i++)
            {
                string sValueFieldName = string.Format("returnDetailsDto.vatReturnForm.box{0}.display{1}", i, i <= 5 ? "Amount" : "Pounds");

                decimal nAmount = AThrasher.ParseGBP(Read(sValueFieldName));

                string sFieldName = string.Format("{0} (Box {1})", Read("vatBox" + i + "Pdf"), i);

                oSeeds.ReturnDetails[sFieldName] = new Coin(nAmount, "GBP");

                Debug("VatReturnSeeds.ReturnDetails[{0}] = {1}", sFieldName, nAmount);
            }             // foreach

            return(true);
        }         // ReturnDetails