protected void Page_Load(object sender, EventArgs e) { QuickPMWebsite.DatabaseSettings.UpdateDatabaseConnectionString(HttpContext.Current.Profile, Request); QuickPM.Tenant tenant = GetTenant(); if (tenant == null) { return; } QuickPM.Period period = GetPeriod(); if (period.Year == -1 || period.Month == -1) { return; } if (Request.Form["textareamemo"] != null) { QuickPM.ARRecord record = new QuickPM.ARRecord(tenant.TenantId, period.Year, period.Month); string memo = Request.Form["textareamemo"].Trim(); foreach (string rentType in tenant.RentTypes) { int rentTypeIndex = tenant.RentTypes.IndexOf(rentType); record.Adjustments[rentTypeIndex] = Decimal.Parse(Request.Form["Adjustment" + rentType], System.Globalization.NumberStyles.Any); } record.Memo = memo; record.Save(); } }
protected void Page_Load(object sender, EventArgs e) { QuickPM.Tenant tenant= GetTenant(); if(tenant == null){ return; } QuickPM.Period period = GetPeriod(); if(period.Year == -1 || period.Month == -1) { return; } if (Request.Form["textareamemo"] != null) { QuickPM.ARRecord record = new QuickPM.ARRecord(tenant.TenantId, period.Year, period.Month); string memo = Request.Form["textareamemo"].Trim(); foreach (string rentType in tenant.RentTypes) { decimal amount; decimal.TryParse(Request["Adjustment" + rentType], System.Globalization.NumberStyles.Any, System.Globalization.NumberFormatInfo.CurrentInfo, out amount); record.Adjustments[tenant.RentTypes.IndexOf(rentType)] = amount;//Decimal.Parse(Request.Form["Adjustment" + rentType], System.Globalization.NumberStyles.Any); } record.Memo = memo; record.Save(); } //TextBoxMemo.Text = QuickPM.Database.GetARRecord(tenant.TenantId, period.Year, period.Month).Memo.Trim(); //TextBoxMemo.TextMode = TextBoxMode.MultiLine; //if (!Page.IsPostBack) { // NameLabel.Text = Request.Params["Name"]; //} }
public void TestCreateARRecord() { QuickPM.ARRecord arRecord = new QuickPM.ARRecord("1-1", 2008,1); Assert.AreEqual(true, arRecord.NewRecord); arRecord.Save(); arRecord = new QuickPM.ARRecord("1-1", 2008, 1); Assert.AreEqual(false, arRecord.NewRecord); }
public void AppliedRents() { decimal checkAmount = 100m; QuickPM.ARRecord arRecord = new QuickPM.ARRecord("1-1", 2008, 1); QuickPM.Check check = new QuickPM.Check(); check.TenantId = tenantId; check.ARRecordDate = new DateTime(arRecord.Year, arRecord.Month, 1); check.ReceivedDate = DateTime.Today; check.Amount = checkAmount; check.CheckDate = DateTime.Today; check.AutoApply(new QuickPM.Period(arRecord.Year, arRecord.Month)); Dictionary<string, decimal> appliedRents = arRecord.AppliedRents(); Assert.AreEqual(checkAmount, appliedRents[(new QuickPM.Tenant(tenantId)).RentTypes[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; }
protected string GenerateBilling(string tenantId, int year, int month) { QuickPM.Tenant tenant = new QuickPM.Tenant(tenantId); string html = ""; html += "<hr/><br/>"; html += "<p class=\"breakhere\"/>"; html += "<table width=\"80%\">"; html += "<tr>"; html += "<td></td><td>Billing Date:" + DateTime.Now.ToShortDateString() + "</td>"; html += "</tr>"; html += "<td>Name:</td><td>" + tenant.Name + "</td></tr>"; html += "<tr><td>Account#</td><td>" + tenant.TenantId + "</td></tr></table>"; html += "</table>"; html += "<br/>"; html += "<br/>"; html += "<table width=\"80%\">"; html += "<tr>"; html += "<table cellpadding=\"5px\">" + "<br/>"; string billName = tenant.Name; string billAddress = tenant.Address; string billCity = tenant.City; string billState = tenant.State; string billZip = tenant.Zip; if (!tenant.BillSame) { billName = tenant.BillName; billAddress = tenant.BillAddress; billCity = tenant.BillCity; billState = tenant.BillState; billZip = tenant.BillZip; } html += "<tr>"; html += "<td>Billing:</td><td>" + billName + "</td>" + "<td>Regarding:</td><td>" + tenant.Name + "</td>"; html += "</tr>"; html += "<tr>"; html += "<td></td><td>" + billAddress + "</td>" + "<td></td><td>" + tenant.Address + "</td>"; html += "</tr>"; html += "<tr>"; html += "<td></td><td>" + billCity + ", " + billState + " " + billZip + "</td>"; html += "<td></td><td>" + tenant.City + ", " + tenant.State + " " + tenant.Zip + "</td>"; html += "</tr>"; html += "</table>"; html += "<table border=\"1px\">"; Dictionary<string, QuickPM.Bill> billingRecords = QuickPM.Bill.GetBills(tenantId, year, month); html += "<tr><th>Description</th><th>Past Amounts Due</th><th>Current Billing</th><th>Total Due</th></tr>"; QuickPM.ARRecord arRecord = new QuickPM.ARRecord(tenantId, year, month); Dictionary<string, decimal> balanceForward = arRecord.BalanceForward(); decimal totalBalanceForward = 0m; decimal totalCurrentBilling = 0m; decimal totalOutstandingBalance = 0m; foreach (string rentType in tenant.RentTypes) { decimal balForward = balanceForward[rentType]; totalBalanceForward += balForward; totalCurrentBilling += billingRecords[rentType].Amount; totalOutstandingBalance += balForward + billingRecords[rentType].Amount; html += "<tr>\n"; html += "<td>"; html += rentType; html += "</td>"; html += "<td>"; html += "$" + balForward.ToString("n"); html += "</td>"; html += "<td>"; html += "$" + billingRecords[rentType].Amount.ToString("n"); html += "</td>"; html += "<td>"; html += "$" + (balForward + billingRecords[rentType].Amount).ToString("n"); html += "</td>"; html += "</tr>"; } html += "<tr>"; html += "<td>Total</td>"; html += "<td>" + "$" + totalBalanceForward.ToString("n") + "</td>"; html += "<td>" + "$" + totalCurrentBilling.ToString("n") + "</td>"; html += "<td>" + "$" + totalOutstandingBalance.ToString("n") + "</td>"; html += "</tr>"; html += "</table>"; return html; }