/// <summary> /// Bill has been updated if the Last Action date in the history file is later than the Last Action date /// in the latest bill report. /// </summary> /// <param name="bill">Chamber and bill number concatenated, as in "AB8"</param> /// <param name="history">The latest history file</param> /// <param name="history_last_action">The date of the last action</param> /// <returns>true if the bill has been updated, false otherwise</returns> protected bool IsUpdated(BillReport bill, List <BillHistoryRow> history, out string history_last_action) { bool result = false; history_last_action = null; if (bill.IsNotDead() && bill.IsNotChaptered()) { // Get the latest action as shown in the latest bill report string last_action_date_string = Regex.Replace(bill.LastAction, @"(\d{1,2} \w{3,} \d{4}).*", "$1").ToString(); if (!DateTime.TryParse(last_action_date_string, out DateTime bill_last_action_date)) { throw new ApplicationException($"BillReportBase.IsUpdated: Invalid datetime in bill - {bill.LastAction}"); } // Get the latest action as shown in the history file string bill_id = bill.Measure.Replace("-", string.Empty); // change.BillID doesn't have the dash var selected = (from item in history where (item.BillID.EndsWith(bill_id)) select item).ToList(); selected.Sort((a, b) => a.SequenceAsInt().CompareTo(b.SequenceAsInt())); var latest_change = selected.Last(); if (latest_change != null) { if (!DateTime.TryParse(latest_change.ActionDate, out DateTime history_action_date)) { throw new ApplicationException($"BillReportBase.IsUpdated: Invalid datetime in history - {latest_change.ActionDate}"); } result = history_action_date > bill_last_action_date; history_last_action = DateOnly(latest_change.ActionDate); } } return(result); }
public List <BillReport> UnpaidBillReport(DateTime firstDate, DateTime secondDate) { SqlConnection connection = new SqlConnection(connectionString); string query = "spUnpaidBillReport '" + firstDate + "','" + secondDate + "'"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); List <BillReport> testReport = new List <BillReport>(); while (reader.Read()) { BillReport report = new BillReport(); report.BillNo = Convert.ToInt32(reader["BillNo"].ToString()); report.Mobile = reader["MobileNo"].ToString(); report.Patient = reader["Name"].ToString(); report.BillAmount = double.Parse(reader["DueAmount"].ToString()); testReport.Add(report); } reader.Close(); connection.Close(); return(testReport); }
public void TestNewOrChangePrefix(string right_answer, string week_start, string week_end, string report_file_path) { if (File.Exists(report_file_path)) { BaseController.EnsureGlobalData(); // Report constructor requires GlobalHistoryTable var range = new Scout2.WeeklyReport.WeeklyReport.DateRange(week_start, week_end); var report = new BillReport(report_file_path); var answer = BillUtils.NewOrChangePrefix(range, report); switch (right_answer) { case "New": Assert.True(answer.Contains("NEW"), $"TestNewOrChangePrefix: {answer} is not correct, should contain NEW."); break; case "Update": Assert.True(answer.Contains("UPDATED"), $"TestNewOrChangePrefix: {answer} is not correct, should contain UPDATED."); break; case "None": Assert.True(answer.Length == 0, $"TestNewOrChangePrefix: {answer} is not correct, should be of 0 length."); break; default: Assert.True(false, $"TestNewOrChangePrefix: {answer} is not a valid NewOrChangePrefix response."); break; } } else { Assert.True(false, $"TestNewOrChangePrefix: {report_file_path} does not exist."); } }
private void LoadDealerBillBreakupCount() { BillReport dealerBillReport = SharedRepo.DBRepo.GetDealerBillReport(_dealerBillId); if (dealerBillReport == null) { MessageBox.Show("Could not load breakup count"); return; } txtDealerName.Text = dealerBillReport.PersonName; txtBillDate.Text = dealerBillReport.BillDate; txtTotalBillAmount.Text = dealerBillReport.TotalAmount.ToString(); txtTotalBreakupCount.Text = dealerBillReport.BreakupCount.ToString(); txtTotalBreakupAmount.Text = dealerBillReport.BreakupSum.ToString(); if (dealerBillReport.BreakupSum == dealerBillReport.TotalAmount) { txtTotalBreakupAmount.BackColor = Color.LightGreen; } else if (dealerBillReport.BreakupSum > dealerBillReport.TotalAmount) { txtTotalBreakupAmount.BackColor = Color.Red; } else { txtTotalBreakupAmount.BackColor = Color.Orange; } }
private Control CreatePageContainer(Control control, out bool absoluteSet) { absoluteSet = false; foreach (Control ctrl in control.Controls) { BillReport r = ctrl as BillReport; if (r != null) { pagesCount += r.PagesCount; if (pageHeight == WebUnit.Empty) { pageHeight = r.PageHeight; } } } HtmlGenericControl result = new HtmlGenericControl("div"); result.Style[HtmlTextWriterStyle.Width] = "100%"; result.Style[HtmlTextWriterStyle.Padding] = "0cm"; result.Style[HtmlTextWriterStyle.BorderWidth] = "0cm"; result.Style[HtmlTextWriterStyle.Margin] = "0cm"; if (!pageHeight.IsEmpty) { result.Style[HtmlTextWriterStyle.Top] = new WebUnit((pageHeight.Value * slipPages), pageHeight.Type).ToString(); result.Style[HtmlTextWriterStyle.Position] = "absolute"; absoluteSet = true; } result.Controls.Add(control); slipPages = pagesCount; return(result); }
private void button3_Click(object sender, EventArgs e) { //Khởi tạo built mà mở ReportView lên để khởi tạo; //Truyền dữ liệu theo cấu trúc như demo if (chooseTable != null && chooseTable.Table.TableStatus == true) { string voucher = textBox3.Text; string IDKH = textBox2.Text; if (CustomerController.getController().checkExist(IDKH)) { chooseTable.endBill(IDKH); } else { chooseTable.endBill(""); } if (voucher != "") { String[] listVoucher = voucher.Trim().Split(','); foreach (var item in listVoucher) { Voucher v = VoucherController.getController().checkExist(item); if (v != null && v.Status != true) { chooseTable.addVoucher(v); } } } chooseTable.makeBill(); List <BillReport> list = new List <BillReport>(); int i = 0; chooseTable.ListFood.ForEach(item => { BillReport br = new BillReport(); br.FoodName = item.FoodName; br.Price = item.Price; br.Count = chooseTable.ListBill_Info[i].FoodCount; i++; list.Add(br); }); new ReportView(list, chooseTable.bill).ShowDialog(this); chooseTable.clearTable(); Discount = 0; textBox5.Text = "0"; textBox2.Text = ""; textBox3.Text = ""; } }
private void dgvBillList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.ColumnIndex == ColBreakupSum.Index) { BillReport dealerBillReport = (BillReport)dgvBillList.Rows[e.RowIndex].DataBoundItem; if (dealerBillReport.BreakupSum > dealerBillReport.TotalAmount) { e.CellStyle.BackColor = RAG_Red; } else if (dealerBillReport.BreakupSum < dealerBillReport.TotalAmount) { e.CellStyle.BackColor = RAG_Amber; } } DataGridView_Selected_Cell_CellFormatting(sender, e); }
public OrderDeliverer(string billingReport) { try { billReport = JsonConvert.DeserializeObject <BillReport>(billingReport); // 1. Извлечь из базы данные заказа // 2. Разослать из заказа ссылки на контент } catch (Exception exc) { } }
public void TestDateFromLastAction(string right_answer, string report_file_path) { if (File.Exists(report_file_path)) { BaseController.EnsureGlobalData(); // Report constructor requires GlobalHistoryTable var report = new BillReport(report_file_path); var correct = DateTime.Parse(right_answer); var answer = BillUtils.DateFromLastAction(report); Assert.True(correct.Year == answer.Year && correct.Month == answer.Month && correct.Day == answer.Day, $"TestNewOrChangePrefix: {answer.ToShortDateString()} is not correct, should be {correct.ToShortDateString()}."); } else { Assert.True(false, $"TestNewOrChangePrefix: {report_file_path} does not exist."); } }
private void btnPrint_Click(object sender, EventArgs e) { try { BillReportDesign billForm = new BillReportDesign(); CrystalReports.BillReport report = new BillReport(); #region oldCode TextObject text1 = (TextObject)report.ReportDefinition.Sections["Section3"].ReportObjects["txtSubTot"]; text1.Text = txtSubTotal.Text.ToString(); TextObject text2 = (TextObject)report.ReportDefinition.Sections["Section3"].ReportObjects["txtDis"]; text2.Text = txtDiscount.Text.ToString(); TextObject text3 = (TextObject)report.ReportDefinition.Sections["Section3"].ReportObjects["txtVAT"]; text3.Text = txtVat.Text.ToString(); TextObject text4 = (TextObject)report.ReportDefinition.Sections["Section3"].ReportObjects["txtGrandTot"]; text4.Text = txtGrandTotal.Text.ToString(); TextObject text5 = (TextObject)report.ReportDefinition.Sections["Section3"].ReportObjects["txtPaidAmou"]; text5.Text = txtPaidAmount.Text.ToString(); TextObject text6 = (TextObject)report.ReportDefinition.Sections["Section3"].ReportObjects["txtReturnAmou"]; text6.Text = txtReturnAmount.Text.ToString(); #endregion report.Database.Tables["BillData"].SetDataSource(transactionDT); billForm.crystalReportViewer1.ReportSource = report; billForm.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public IActionResult ReportViewer() { var Source = _billingManagementService.GetBillDetailByBillCode(88); BillReport rep = new BillReport(); rep.DataSource = Source.Data; BillReport1 report = new BillReport1(); Parameter parameter = new Parameter() { }; report.Parameters.Add(new DevExpress.XtraReports.Parameters.Parameter { Name = "BillId", Type = typeof(System.DateTime), Value = 88 }); return(View(rep)); }
public override void Tick() { base.Tick(); if (this.IsHashIntervalTick(10) && Active) { if (thingQueue.Count > 0 && OutputComp.CurrentCell.Walkable(Map) && (OutputComp.CurrentCell.GetFirstItem(Map)?.TryAbsorbStack(thingQueue[0], true) ?? GenPlace.TryPlaceThing(thingQueue[0], OutputComp.CurrentCell, Map, ThingPlaceMode.Direct))) { thingQueue.RemoveAt(0); } if (currentBillReport != null) { currentBillReport.workLeft -= 10f * ProductionSpeedFactor; if (currentBillReport.workLeft <= 0) { try { ProduceItems(); currentBillReport.bill.Notify_IterationCompleted(buildingPawn, currentBillReport.selected); Notify_RecipeCompleted(currentBillReport.bill.recipe); } catch (Exception ex) { Log.Error($"Error producing items for {GetUniqueLoadID()}: " + ex); } finally { currentBillReport = null; } } } else if (this.IsHashIntervalTick(60)) { if ((currentBillReport = CheckBills()) != null) { Notify_BillStarted(); } } } }
/// <summary> /// Given a bill report, returns the contents of the report as a single string. /// This is not unit tested. It is too simple to require testing and the necessary mock isn't worth the effort. /// </summary> /// <param name="report">BillReport telling chamber and bill number, specifying bill, allowing bill report to be read</param> /// <returns></returns> public static string ContentsFromBillReport(BillReport report) { string path = $"{Path.Combine(Config.Instance.HtmlFolder, BillUtils.EnsureNoLeadingZerosBill(report.Measure))}.html"; return(FileUtils.FileContents(path)); }
public override void Tick() { base.Tick(); if (this.IsHashIntervalTick(10) && Active) { if (thingQueue.Count > 0 && OutputComp.CurrentCell.Walkable(Map) && (OutputComp.CurrentCell.GetFirstItem(Map)?.TryAbsorbStack(thingQueue[0], true) ?? GenPlace.TryPlaceThing(thingQueue[0], OutputComp.CurrentCell, Map, ThingPlaceMode.Direct))) { thingQueue.RemoveAt(0); } if (currentBillReport != null) { currentBillReport.workLeft -= 10f * ProductionSpeedFactor; if (currentBillReport.workLeft <= 0) { try { ProduceItems(); currentBillReport.bill.Notify_IterationCompleted(buildingPawn, currentBillReport.selected); Notify_RecipeCompleted(currentBillReport.bill.recipe); } catch (Exception ex) { Log.Error($"Error producing items for {GetUniqueLoadID()}: " + ex); } finally { currentBillReport = null; } } } else if (this.IsHashIntervalTick(60)) { if ((currentBillReport = CheckBills()) != null) { Notify_BillStarted(); } } } // Effect. if (currentBillReport != null) { var ext = this.def.GetModExtension <AssemblerDefModExtension>(); if (this.effecter == null) { this.effecter = (ext == null ? currentBillReport.bill.recipe?.effectWorking : ext.GetEffecter(this.currentBillReport.bill.recipe))?.Spawn(); } if (this.sound == null) { this.sound = (ext == null ? currentBillReport.bill.recipe?.soundWorking : ext.GetSound(this.currentBillReport.bill.recipe))?.TrySpawnSustainer(this); } this.effecter?.EffectTick(this, this); this.sound?.SustainerUpdate(); if (this.GetComp <CompGlowerPulse>() != null) { this.GetComp <CompGlowerPulse>().Glows = true; } } else { if (this.effecter != null) { this.effecter.Cleanup(); this.effecter = null; } if (this.sound != null) { this.sound.End(); this.sound = null; } if (this.GetComp <CompGlowerPulse>() != null) { this.GetComp <CompGlowerPulse>().Glows = false; } } }
/// <summary> /// Build GlobalData.BillRows from scratch. /// The steps for this are /// 1. Import the BILL_TBL.dat data into GlobalData.BillRows. This fills 9 of the 15 BillRow fields. /// </summary> /// <param name="form1">The main (Form1) display form. Display messages and progress here.</param> /// <param name="path_bill_tbl">Fully-qualified path to BILL_TBL.dat</param> /// <param name="mostRecentEachBill">For each bill, the Bill_Identifier identifying the most recent version</param> private void BuildBillRowsTable(Form1 form1, string path_bill_tbl, List <BillProfile> profiles) { // Import BILL_TBL.dat, which is the legislative site's information on bills before the legislature. // Trim all non-bill items during the import -- we want only type AB and SB (Assembly and Senate Bills) var bill_table_wrapper = new Bill_Tbl_Wrapper(); bill_table_wrapper.ReadYourself(); // Import BILL_TBL.dat List <BillRow> rows_with_positions = BillRow.RowsetByQuery("Select * from Billrows Where Position <> ''"); List <BillRow> all_rows = BillRow.RowSet(); List <string> reports = BillUtils.HtmlFolderContents(); // Re-create GlobalData.BillRows, using data from bill_table_wrapper and elsewhere. GlobalData.BillRows.Clear(); List <string> SkipIf = new List <String>() { "Chaptered", "Died", "Enrolled", "Failed", "Failed Passage in Committee", "Vetoed" }; foreach (var item in bill_table_wrapper) { // Don't process bills that will not progress further in the legislature. //string result = SkipIf.FirstOrDefault(s => s == item.Current_status); //if (result != null) continue; // Use data from bill_table_wrapper. Some fields are left blank. var bill_row = new BillRow(); bill_row.MeasureType = item.Measure_type; // e.g. AB bill_row.MeasureNum = BillUtils.Ensure4DigitNumber(item.Measure_num); // e.g. 0010 bill_row.Bill = $"{bill_row.MeasureType}{BillUtils.EnsureNoLeadingZerosBill(bill_row.MeasureNum)}"; // e.g. AB10 //bill_row.Lob = item.; //bill_row.NegativeScore = item; //bill_row.PositiveScore = item; //bill_row.Position = item; // Hand Entered, e.g. Monitor bill_row.BillVersionID = VersionID(item); // e.g. 20190AB199INT //bill_row.Author = item; //bill_row.Title = item; bill_row.Location = item.Current_location; // e.g. CX08 bill_row.Location2nd = item.Current_secondary_loc; // e.g. Committee bill_row.MeasureState = item.Measure_state; // e.g. Amended Assembly bill_row.CurrentHouse = item.Current_house; // e.g. Assembly bill_row.CurrentStatus = item.Current_status; // e.g. In Committee Process // Obtain the author, title, lob file path, and positive/negative scores from the profile for this bill var four_digit_billid = BillUtils.Ensure4DigitNumber(bill_row.Bill); var profile = (from x in profiles where x.Identifier.BillID == four_digit_billid select x).First(); if (profile != null) { bill_row.Author = profile.Identifier.Author; bill_row.Title = profile.Identifier.Title; bill_row.Lob = profile.Identifier.LobPath; bill_row.NegativeScore = profile.NegScore; bill_row.PositiveScore = profile.PosScore; } else { throw new ApplicationException($"InitializeBillRows.BuildBillRowsTable: Bill {bill_row.Bill} is present in bill_table_wrapper, but not in GlobalData.Profiles."); } // Fill in the Position data -- the position we are taking on this bill. If we have a position, it is // in one of two places // 1. The database BillRows table (not all bills have a report), or var pos = (from x in rows_with_positions where x.Bill == bill_row.Bill select x).FirstOrDefault(); if (pos != null) { bill_row.Position = pos.Position; } // 2. If that table hasn't been updated, in the actual report // If the two are in conflict, the bill report wins. var short_id = BillUtils.EnsureNoLeadingZerosBill(bill_row.Bill); var report_file = (from x in reports where x.Contains($"{short_id}.html") select x).FirstOrDefault(); if (report_file != null) { var report = new BillReport(report_file); bill_row.Position = report.Position; } // Add this row to GlobalData.BillRows GlobalData.BillRows.Add(bill_row); } // Sort the table before returning it. Ordered by bill ID, e.g. AB0001, communicates well GlobalData.BillRows = GlobalData.BillRows.OrderBy(a => a.Bill).ToList(); }
/// <summary> /// In the "Highest Priority", "Oppose", "Modify/Monitor" and "Prediction" sections of the weekly report, bills that are /// new or have been updated are shown with a red prefix of NEW or UPDATED. This makes them stand out from all the /// other bills listed in the report. /// /// If the bill's first review date was during this past week, the NEW prefix is shown. /// if the date of the bill's last action was during this past week, the UPDATED prefix is shown. /// </summary> /// <param name="past_week">Starting and ending dates of the previous week</param> /// <param name="report">The contents of an individual bill report</param> /// <returns></returns> public static string NewOrChangePrefix(WeeklyReport.WeeklyReport.DateRange past_week, BillReport report) { const string prefix_new = "<span style=\"color: #ff0000\">NEW</span><br />"; const string prefix_update = "<span style=\"color: #ff0000\">UPDATED</span><br />"; string report_contents = BillUtils.ContentsFromBillReport(report); string prefix = BillUtils.IsNewThisWeek(report_contents, past_week) ? prefix_new : string.Empty; if (prefix.Length == 0) { var dt = DateFromLastAction(report); prefix = DateUtils.DateIsInPastWeek(dt, past_week) ? prefix_update : CheckManualUpdate(report.Measure); } return(prefix); }
/// <summary> /// Obtain the date of the last action shown in a BillReport /// </summary> /// <param name="report">A BillReport struct generated from an actual bill report</param> /// <returns>The date of the last action</returns> public static DateTime DateFromLastAction(BillReport report) { var text_date = Regex.Match(report.LastAction, @"^\w+\s+\w+\s+\w+").ToString(); return((DateTime.TryParse(text_date, out DateTime result)) ? result : default(DateTime)); }