protected void GRD_ASSETS_SelectedIndexChanged(object sender, EventArgs e) { InsertItems(BillID, "Asset Fee: " + GRD_ASSETS.SelectedDataKey["AssetType"].ToString(), Convert.ToDouble(GRD_ASSETS.SelectedDataKey["Amount"].ToString())); GRD_BillItems.DataBind(); }
private void SetDefaultItems() { //for rent fees GetPeriodicalFee(TenantID); if (PeriodType == 1 || PeriodType == 2) { //Adds Rent Fee To Bill if Not Existing SqlParameter[] BIDParam = { new SqlParameter("@BID", BillID) }; bool RentIsAlreadyInBill = DataAccess.DetermineIfExisting("SELECT * FROM Bill_Items WHERE Particular='MONTHLY RENT FEE' AND BillID=@BID", BIDParam, ConnString); if (!RentIsAlreadyInBill) { InsertItems(BillID, "MONTHLY RENT FEE", Fee); } } else if (PeriodType == 3) { SqlParameter[] BIDParam = { new SqlParameter("@BID", BillID) }; bool RentIsAlreadyInBill = DataAccess.DetermineIfExisting("SELECT * FROM Bill_Items WHERE Particular='DAILY RENT FEES' AND BillID=@BID", BIDParam, ConnString); if (!RentIsAlreadyInBill) { //Adds Rent Fee To Bill if Not Existing int NoOfDays = (ContractEnd - ContractStart).Days; double TotalFee = Convert.ToDouble(NoOfDays) * Fee; InsertItems(BillID, "DAILY RENT FEES", TotalFee); } } //SETS VIOLATIONS SqlDS_Violations.SelectCommand = "SELECT Employees.UN, Violations.Title, Violations.Description, Violations.Fine, Violations.DateTime FROM Violations INNER JOIN Employees ON Violations.EmployeeID = Employees.EmployeeID WHERE (Violations.TenantID = @TID) AND (Violations.Fine!='' OR Violations.Fine!=0 OR Violations.Fine IS NOT NULL)"; //For Prev. Balances if (UnpaidBal != 0) { //Adds Rent Fee To Bill if Not Existing SqlParameter[] BIDParam = { new SqlParameter("@BID", BillID) }; bool BalIsAlreadyInBill = DataAccess.DetermineIfExisting("SELECT * FROM Bill_Items WHERE Particular='UNSETTLED BALANCE' AND BillID=@BID", BIDParam, ConnString); if (!BalIsAlreadyInBill) { if (PeriodType == 1 || PeriodType == 2) { InsertItems(BillID, "UNSETTLED BALANCE", UnpaidBal + (Fee * 0.15)); } else { InsertItems(BillID, "UNSETTLED BALANCE", UnpaidBal); } } if (PeriodType == 1 || PeriodType == 2) { lblPrevBalance.Text = "Php " + UnpaidBal.ToString() + " + Penalty: Php " + (Fee * 0.15); } else { lblPrevBalance.Text = "Php " + UnpaidBal.ToString(); } } else { lblPrevBalance.Text = "No unsettled balance."; } GRD_BillItems.DataBind(); }
protected void GRD_VIOLATIONS_SelectedIndexChanged(object sender, EventArgs e) { InsertItems(BillID, GRD_VIOLATIONS.SelectedDataKey["Title"].ToString(), Convert.ToDouble(GRD_VIOLATIONS.SelectedDataKey["Fine"].ToString())); GRD_BillItems.DataBind(); }