private CreateDocument CreateWayBill(Car car, DateTime date, int idInvoice = 0) { CreateDocument waybill = new CreateDocument(car); Driver driver = null; if (idInvoice != 0) { InvoiceList invoiceList = InvoiceList.getInstance(); Invoice invoice = invoiceList.getItem(idInvoice); DriverList driverList = DriverList.getInstance(); driver = driverList.getItem(Convert.ToInt32(invoice.DriverToID)); } waybill.createWaybill(date, driver); try { if (_type == WayBillType.Day) waybill.AddRouteInWayBill(date, Fields.All); } catch (NullReferenceException ex) { MessageBox.Show(ex.Message, "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Information); waybill.Exit(); throw; } return waybill; }
private void CreateWayBill(Car car, Actions action, Fields fields) { CreateDocument excelWayBill = new CreateDocument(car); try { excelWayBill.createWaybill(dtpDate.Value, null); excelWayBill.AddRouteInWayBill(dtpDate.Value, fields); if (action == Actions.Print) excelWayBill.Print(); else excelWayBill.Show(); } catch (NullReferenceException ex) { MessageBox.Show(ex.Message, "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Information); excelWayBill.Exit(); } if (car == list[index]) LoadWayBillCurrent(); }
private ToolStripMenuItem CreateShowActFuelCard() { ToolStripMenuItem item = CreateItem("Акт передачи топливной карты"); item.Click += delegate { Car car = _dgvMain.GetCar(); if (car == null) MessageBox.Show("Для формирования акта выберите ячейку в таблице", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning); else { InvoiceList invoiceList = InvoiceList.getInstance(); Invoice invoice = invoiceList.getItem(_dgvMain.GetID()); if (invoice == null) { MessageBox.Show("Для формирования акта необходимо перейти на страницу \"Перемещения\"", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } CreateDocument doc = new CreateDocument(car, invoice); doc.ShowActFuelCard(); } }; return item; }
private ToolStripMenuItem CreatePrint() { ToolStripMenuItem item = CreateItem("Печать"); item.ShortcutKeys = Keys.Control | Keys.P; item.Click += delegate { CreateDocument doc = new CreateDocument(); doc.CreateExcelFromDGV(_dgvMain.GetDGV()); doc.Print(); }; return item; }
private CreateDocument DgvToExcel() { CreateDocument doc = new CreateDocument(); doc.CreateExcelFromAllDGV(_dgvMain.GetDGV()); doc.CreateHeader("Справочник \"" + _mainStatus.ToString() + "\""); return doc; }
private ToolStripMenuItem CreateShowPolicyList() { ToolStripMenuItem item = CreateItem("Сформировать таблицу страхования"); item.Click += delegate { CreateDocument doc = new CreateDocument(); doc.CreatePolicyTable(); }; return item; }
private ToolStripMenuItem CreateShowNotice() { ToolStripMenuItem item = CreateItem("Извещение о страховом случае"); item.Click += delegate { Car car = _dgvMain.GetCar(); if (car == null) return; if (_mainStatus.Get() == Status.DTP) { DTPList dtpList = DTPList.getInstance(); DTP dtp = dtpList.getItem(_dgvMain.GetID()); CreateDocument doc = new CreateDocument(car); doc.showNotice(dtp); } else MessageBox.Show("Для формирования извещения необходимо перейти на вид \"ДТП\"", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning); }; return item; }
private void messageToolStripMenuItem_Click(object sender, EventArgs e) { int idDTP = 0; int.TryParse(_dgvDTP.Rows[_dgvDTP.SelectedCells[0].RowIndex].Cells[0].Value.ToString(), out idDTP); DTP dtp = dtpList.getItem(idDTP); CreateDocument doc = new CreateDocument(_car); doc.showNotice(dtp); }