Exemplo n.º 1
0
 protected bool HasDup(QuickPM.PropertyUnit unit, List<QuickPM.PropertyUnit> units)
 {
     int count = 0;
     foreach(QuickPM.PropertyUnit u in units)
     {
         if(u.Id == unit.Id)
         {
             count++;
         }
     }
     return count > 1;
 }
Exemplo n.º 2
0
    public void SetPolicyAndLimitDescription(DropDownList policyDescription, DropDownList limitDescription, QuickPM.InsurancePolicy.PolicyCategories policyCategory)
    {
        string[] autoPolicyDescriptions = new string[] { "Any Auto", "All Owned Autos", "Scheduled Autos", "Hired Autos", "Non-Owned Autos" };
        string[] autoLimitDescriptions = new string[] { "Combined Single Limit (Ea Accident)", "Bodily Injury (Per Person)", "Property Damage (Per Accident)" };

        string[] garagePolicyDescriptions = new string[] { "Any Auto" };
        string[] garageLimitDescriptions = new string[] { "Auto Only - Ea Accident", "Other Than Auto Ea Accident", "Other Than Auto Only Agg" };

        string[] generalPolicyDescriptions = new string[] { "Commercial General Liability" };
        string[] generalLimitDescriptions = new string[] { "Each Occurrence", "Damage To Rented Premises (Ea Occurence)", "Med Exp (Any one person)", "Personal & Adv Injury", "General Aggreate", "Products - Comp/Op Agg" };

        string[] umbrellaPolicyDescriptions = new string[] { "Occur" };
        string[] umbrellaLimitDescriptions = new string[] { "Each Occurence", "Aggragate" };

        string[] policyDescriptions = null;
        string[] limitDescriptions = null;
        policyDescription.Items.Clear();
        limitDescription.Items.Clear();
        ListItemCollection policyItems = policyDescription.Items;
        ListItemCollection limitItems = limitDescription.Items;
        switch (policyCategory)
        {
            case QuickPM.InsurancePolicy.PolicyCategories.Automobile:
                policyDescriptions = autoPolicyDescriptions;
                limitDescriptions = autoLimitDescriptions;
                break;
            case QuickPM.InsurancePolicy.PolicyCategories.Garage:
                policyDescriptions = garagePolicyDescriptions;
                limitDescriptions = garageLimitDescriptions;
                break;
            case QuickPM.InsurancePolicy.PolicyCategories.General:
                policyDescriptions = generalPolicyDescriptions;
                limitDescriptions = generalLimitDescriptions;
                break;
            case QuickPM.InsurancePolicy.PolicyCategories.Umbrella:
                policyDescriptions = umbrellaPolicyDescriptions;
                limitDescriptions = umbrellaLimitDescriptions;
                break;
            default:
                break;
        }

        foreach (string _policyDescription in policyDescriptions)
        {
            policyItems.Add(_policyDescription);
        }

        foreach (string _limitDescription in limitDescriptions)
        {
            limitItems.Add(_limitDescription);
        }
    }
Exemplo n.º 3
0
    protected decimal GetMoniesCollected(QuickPM.Period beginPeriod, QuickPM.Period endPeriod)
    {
        decimal moniesCollected = 0m;
        for (QuickPM.Period p = beginPeriod; p <= endPeriod; p = p.AddMonth())
        {
            QuickPM.ARRecord arRecord = new QuickPM.ARRecord(tenant.TenantId, p.Year, p.Month);

            foreach (string rentType in tenant.RentTypes)
            {
                moniesCollected += arRecord.Received(tenant.RentTypes.IndexOf(rentType));
            }
        }
        return moniesCollected;
    }
Exemplo n.º 4
0
    protected string GetExpenseItemHtml(QuickPM.ExpenseItem ei, string postfixText, string color, List<decimal> expenseTotals, List<decimal> monthlyTotals)
    {
        string html = "";
        int i = eb.ExpenseItems.IndexOf(ei);
        //foreach(QuickPM.ExpenseItem sei in eb.GetSubExpenseItems(ei))
        //{
            string anchor = "";//ei.ChartOfAccount.ToString();
            color = color == "fff" ? "ddd" : "fff";

            html += "<tr>";
            string whitespace = (ei.IsSubCOA || postfixText != "" ? "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" : "");
            html += "<td><a name=" + anchor + "></a>" + whitespace + ei.GetShortCOADescription() + postfixText + "(<a href=" +  EditExpenseItemUrl(ei) + ">edit</a>,";

            if (ei.IsSubCOA || postfixText == "")
            {
                html += "<a href=\"javascript:__doPostBack('DeleteExpense','" + ei.COADescription + "')\"" + "onclick=\"javascript: return confirm('Delete?')\">delete</a>";
            }
            html +=")</td>";

            for (int p = 0; p < ei.expenses.Count; p++)
            {
                expenseTotals[i] += ei.expenses[p];
                monthlyTotals[p] += ei.expenses[p];
                html += "<td align=\"right\"><input type=\"text\" style=\"background-color:#";
                html += color + ";border-width:1px;border-style:ridge;border-color:Silver\" ";
                html += "name=\"" + ei.ChartOfAccount.ToString() + "-" + p.ToString() + "\" ";
                html += "id=\"" + ei.ChartOfAccount.ToString() + "-" + p.ToString() + "\" ";
                html += "size=\"" + ei.expenses[p].ToString("c").Length + "\" ";
                html += "value=\"" + ei.expenses[p].ToString("c") + "\"/></td>";
            }

            html += "<td>";
            html += "<a href=\"javascript:__doPostBack('SaveExpenses','" + ei.ChartOfAccount + "')\" onclick=\"\">save</a></td>";
            html += "</tr>";
        //}
        return html;
    }
Exemplo n.º 5
0
 protected void UpdatePersonControl(QuickPM.Person contact, Tenant_PersonControl person)
 {
     person.CellPhone = contact.CellPhone;
     person.Address = contact.Address;
     person.Email = contact.Email;
     person.Fax = contact.Fax;
     person.HomePhone = contact.HomePhone;
     person.Name = contact.Name;
     person.OfficePhone = contact.OfficePhone;
     person.Title = contact.Title;
 }
Exemplo n.º 6
0
 protected void UpdateContact(QuickPM.Person contact, Tenant_PersonControl person)
 {
     contact.CellPhone = person.CellPhone;
     contact.Address = person.Address;
     contact.Email = person.Email;
     contact.Fax = person.Fax;
     contact.HomePhone = person.HomePhone;
     contact.Name = person.Name;
     contact.OfficePhone = person.OfficePhone;
     contact.Title = person.Title;
 }
    protected decimal GetPropertyUnitsShare(QuickPM.PropertyUnit unit, int chartOfAccount)
    {
        List<QuickPM.TenantReconciliation> tenantRecons = QuickPM.TenantReconciliation.Find<QuickPM.TenantReconciliation>("ExpenseBudgetId", eb.Id);
        int totalParcipSqFt = 0;
        bool unitPays = false;
        foreach (QuickPM.TenantReconciliation recon in tenantRecons)
        {
            if (!recon.ExpenseParticipation.ContainsKey(chartOfAccount) || recon.ExpenseParticipation[chartOfAccount] == QuickPM.TenantReconciliation.DoesntParticipate)
            {
                continue;
            }
            if (recon.ExpenseParticipation[chartOfAccount] == QuickPM.TenantReconciliation.LandlordPays || recon.ExpenseParticipation[chartOfAccount] == QuickPM.TenantReconciliation.TenantPays)
            {
                totalParcipSqFt += recon.GetPropertyUnit().SqFt;
            }
            if (recon.UnitNumber == unit.UnitNumber && recon.TenantId == unit.GetCurrentTenantId())
            {
                if (recon.ExpenseParticipation[chartOfAccount] != QuickPM.TenantReconciliation.DoesntParticipate)
                {
                    unitPays = true;
                }
            }

        }
        if (!unitPays)
        {
            return 0m;
        }
        decimal share = ((decimal)unit.SqFt / (decimal)totalParcipSqFt);
        return totalParcipSqFt > 0 ? share * eb.GetCOATotal(chartOfAccount) : 0m;
    }
    protected string CreateUnitHtml(QuickPM.PropertyUnit unit, out int sqFt)
    {
        string html = "<tr>";
        if (unit.GetCurrentTenantId() != "")
        {
            html += "<td>" + "<a href=\"" + Page.ResolveUrl("~/Tenant/BasicLeaseInfo.aspx?tenantid=" + unit.GetCurrentTenantId()) + "\">" + new QuickPM.Tenant(unit.GetCurrentTenantId()).GetShortName() + "</a>" + "</td>";
        }
        else
        {
            html += "<td>" + "<a href=\"" + Page.ResolveUrl("~/Property/Units.aspx?PropertyId=" + unit.PropertyId) + "\">" + unit.UnitNumber + " (Vacant)</a></td>";
        }
        sqFt = unit.SqFt;
        html += "<td>" + unit.SqFt.ToString() + "</td>";
        QuickPM.TenantReconciliation recon = QuickPM.TenantReconciliation.GetRecon(unit, eb);
        decimal total = 0m;
        foreach (QuickPM.ExpenseItem ei in eb.ExpenseItems)
        {
            decimal shareAmount = GetPropertyUnitsShare(unit, ei.ChartOfAccount);
            string share = shareAmount.ToString("c");
            int parcip = QuickPM.TenantReconciliation.DoesntParticipate;
            bool hasKey = false;
            foreach(int chartOfAccount in recon.ExpenseParticipation.Keys){
                if(chartOfAccount == ei.ChartOfAccount && recon.ExpenseParticipation[chartOfAccount] == QuickPM.TenantReconciliation.DoesntParticipate){
                    share = "";
                    hasKey = true;
                }
                if(chartOfAccount == ei.ChartOfAccount){
                    parcip = recon.ExpenseParticipation[chartOfAccount];
                    hasKey = true;
                }
            }
            if (!hasKey)
            {
                share = "";
            }
            html += "<td>";
            html += "<select>";
            string[] optionText = new string[3];
            optionText[QuickPM.TenantReconciliation.DoesntParticipate] = "Doesn't Participate";
            optionText[QuickPM.TenantReconciliation.LandlordPays] = "Landlord Pays";
            optionText[QuickPM.TenantReconciliation.TenantPays] = "Tenant Pays";
            total += shareAmount;

            for(int p = 0; p <= 2; p++)
            {
                string tmpshare = p == QuickPM.TenantReconciliation.DoesntParticipate ? "" : share;
                string selectedText = p == parcip ? "selected=\"selected\"" : "";
                html += "<option value=\"" + p + "\" onclick=\"javascript:__doPostBack('ExpenseSelectionChanged','" +
                    unit.Id.ToString() + ";" + p + ";" + ei.ChartOfAccount + "')\"" +
                    selectedText + ">" + optionText[p] + " " + tmpshare + "</option>";
            }

            html += "</select>";
            html += "</td>";

        }
        html += "<td>";
        html += total.ToString("c");
        html += "</td>";
        html += "<td>";
        html += "<a href=\"" + Page.ResolveUrl("~/Property/ReconciliationAndBudget/TenantRecon.aspx?tenreconid=" + recon.Id + "&PropertyId=" + property.Id) + "\">View</a>";
        html += "</td>";
        html += "</tr>";
        return html;
    }
Exemplo n.º 9
0
    protected LatLng GetTenantLatLng(QuickPM.Tenant tenant)
    {
        double lat, lng;
        if (tenant == null)
        {
            return null;
        }
        string address = tenant.Address + "," + tenant.City + "," + tenant.State + "," + "USA";
        string requestUrl = "http://maps.google.com/maps/geo?q=" + Server.UrlEncode(address) +
                        "&output=csv&oe=utf8&sensor=false&key=" + apiKey;
        WebRequest webRequest = WebRequest.Create(requestUrl);
        WebResponse response = webRequest.GetResponse();
        System.IO.StreamReader reader = new System.IO.StreamReader(response.GetResponseStream());
        string line = reader.ReadLine();
        if (line.Trim().Length == 0)
        {
            return null;
        }
        string[] tmp = line.Split(new char[] { ',' });
        if (tmp.Length != 4)
        {
            return null;
        }
        //int statusCode = int.Parse(tmp[0]);
        //int accuracy = int.Parse(tmp[1]);
        lat = double.Parse(tmp[2]);
        lng = double.Parse(tmp[3]);
        if (lat == 0 || lng == 0)
        {

            return null;
        }
        return new LatLng(lat, lng);
    }
Exemplo n.º 10
0
 private string GenerateReport(List<string> rentTypes, QuickPM.Period beginPeriod, QuickPM.Period endPeriod)
 {
     QuickPM.Tenant tenant = new QuickPM.Tenant(GetTenantId());
     List<int> rentTypeIndices = new List<int>();
     foreach (string rentType in rentTypes)
     {
         rentTypeIndices.Add(tenant.RentTypes.IndexOf(rentType));
     }
     return QuickPMWebsite.AppCode.Reports.TenantCashReceipts(GetTenantId(), rentTypeIndices, beginPeriod.Year,
         beginPeriod.Month, endPeriod.Year,
         endPeriod.Month);
 }
Exemplo n.º 11
0
 private string GenerateReport(QuickPM.Property property, List<int> rentTypeIndices, QuickPM.Period beginPeriod, QuickPM.Period endPeriod)
 {
     return QuickPMWebsite.AppCode.Reports.PropertyCashReceipts(property, beginPeriod, endPeriod, rentTypeIndices);
 }
Exemplo n.º 12
0
 protected string GenerateReport(QuickPM.Period beginPeriod, QuickPM.Period endPeriod)
 {
     return QuickPMWebsite.AppCode.Reports.TenantReceivedChecks(GetTenantId(), beginPeriod, endPeriod, this.Page);
 }
Exemplo n.º 13
0
    protected string CreateInsurancePoliciesHtml(QuickPM.InsurancePolicy.PolicyCategories category)
    {
        string html = "<table cellpadding=\"10px\">";
        html += "<tr>";
        html += "<th>Insurer</th>";
        html += "<th>Insurance Type</th>";
        html += "<th>Policy Number</th>";
        html += "<th>Policy Period</th>";
        html += "<th>Limits</th>";
        html += "</tr>";
        if (policies != null)
           {
               foreach (QuickPM.InsurancePolicy ip in policies)
               {
                   if (ip.PolicyCategory != category)
                   {
                       continue;
                   }

                   html += "<tr>";
                   html += "<td>";
                   html += ip.Insurer.Trim();
                   html += "</td>";
                   html += "<td>";
                   html += ip.PolicyDescription;
                   html += "</td>";
                   html += "<td>";
                   html += ip.PolicyNumber;
                   html += "</td>";
                   html += "<td>";
                   html += ip.BeginDate.ToShortDateString() + "-" + ip.EndDate.ToShortDateString();
                   html += "</td>";
                   html += "<td>";
                   html += ip.LimitAmount.ToString("c");
                   html += "<br />";
                   html += ip.LimitDescription;
                   html += "</td>";
                   html += "</tr>";

              }
           }
        html += "</table>";
        return html;
    }
Exemplo n.º 14
0
 protected DateTime? FindChanges(QuickPM.Tenant tenant, string rentType)
 {
     if (!tenant.RentTypes.Contains(rentType))
     {
         return null;
     }
     List<QuickPM.BillingRecord> billingRecords = QuickPM.BillingRecord.GetBillingRecords(tenant.TenantId, tenant.RentTypes.IndexOf(rentType));
     //List<DateTime> billingStartDates = new List<DateTime>();
     //List<DateTime> billingEndDates = new List<DateTime>();
     DateTime closestDate = DateTime.MaxValue;
     foreach (QuickPM.BillingRecord billingRecord in billingRecords)
     {
         if (billingRecord.StartDate >= DateTime.Today)
         {
             if (billingRecord.StartDate - DateTime.Today < closestDate - DateTime.Today)
             {
                 closestDate = billingRecord.StartDate;
             }
         }
         if (billingRecord.EndDate >= DateTime.Today)
         {
             if (billingRecord.EndDate - DateTime.Today < closestDate - DateTime.Today)
             {
                 closestDate = billingRecord.EndDate;
             }
         }
     }
     if (closestDate == DateTime.MaxValue)
     {
         return null;
     }
     return closestDate;
 }
Exemplo n.º 15
0
    protected List<DateTime> FindChanges(QuickPM.Property property)
    {
        List<string> tenantIds = property.GetTenantIds();
        List<DateTime> adjustments = new List<DateTime>();
        foreach (string tenantId in tenantIds)
        {

            if (FindChanges(tenantId).HasValue)
            {
                adjustments.Add(FindChanges(tenantId).Value);
            }
        }
        adjustments.Sort();
        return adjustments;
    }
Exemplo n.º 16
0
 protected void RemoveDups(QuickPM.PropertyUnit unit, List<QuickPM.PropertyUnit> units)
 {
     int count = 0;
     for(int i = 0; i < units.Count; i++)
     {
         QuickPM.PropertyUnit u = units[i];
         if(unit.Id == u.Id)
         {
             count++;
             if(count > 1)
             {
                 units.RemoveAt(i);
                 i--;
             }
         }
     }
 }
Exemplo n.º 17
0
 protected string EditExpenseItemUrl(QuickPM.ExpenseItem ei)
 {
     return "ExpenseItem.aspx?beginyear=" + eb.BeginPeriod.Year + "&beginmonth=" + eb.BeginPeriod.Month + "&endyear=" + eb.EndPeriod.Year + "&endmonth=" + eb.EndPeriod.Month + "&PropertyId=" + PropertyId + "&ebid=" + eb.Id + "&COADescription=" + HttpUtility.UrlEncode(ei.COADescription);
 }
Exemplo n.º 18
0
 protected string GetPropertyAddress(QuickPM.Property p)
 {
     List<string> tenantIds = p.GetTenantIds();
     foreach (string tenantId in tenantIds)
     {
         QuickPM.Tenant t = new QuickPM.Tenant(tenantId);
         if (t.Address != "")
         {
             return t.GetFullAddress();
         }
     }
     return "";
 }