public InvoiceViewModel() : base(NumberOfRowsInInvoicesGrid) { _contoData = new ContoData(); Clients = new List <Client>(_contoData.ClientsGet()); InvoiceDate = DateTime.Today; Measures = new List <Measures>(_contoData.MeasuresGet()); var invoiceRowId = Guid.NewGuid(); InvoiceRows = new List <NewInvoiceContent> { new NewInvoiceContent(invoiceRowId) { Rows = new List <NewInvoiceMaterialRow> { new NewInvoiceMaterialRow { MasterId = invoiceRowId } } } }; Initialize(OnPropertyChanged, _contoData.InvoicesMasterGet); AppProperties.FormHaveModifications = false; }
public static void ExportSelfInvoicesPdf(SelfInvoices selfInvoices) { var contoData = new ContoData(); var fileName = string.Format("Fattura_{0}_{1}.pdf", selfInvoices.InvoiceNumber, selfInvoices.InvoiceYear); using (var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None)) using (var doc = new Document(PageSize.A4, 25, 25, 30, 30)) using (PdfWriter writer = PdfWriter.GetInstance(doc, fs)) { doc.Open(); // get template and add to page var templateReader = new PdfReader(PdfResources.Autofattura_Template); PdfTemplate background = writer.GetImportedPage(templateReader, 1); ExportPdfSelfInvoice(selfInvoices, contoData, doc, writer, background); doc.Close(); writer.Close(); fs.Close(); } string path = Environment.ExpandEnvironmentVariables(@"%ProgramFiles(x86)%"); const string pathToExecutable = @"\Adobe\Adobe Reader\Reader\AcroRd32.exe"; //RunExecutable(string.Concat(path, pathToExecutable), @"/p """ + fileName + ""); RunExecutable(string.Concat(path, pathToExecutable), @"" + fileName + ""); }
public MainViewModel() { _contoData = new ContoData(); var settings = _contoData.GetSettings(); if (settings != null) { InvoiceOwnerAddress = settings.InvoiceOwnerAddress; InvoiceOwnerCity = settings.InvoiceOwnerCity; InvoiceOwnerFiscalCode = settings.InvoiceOwnerFiscalCode; InvoiceOwnerName = settings.InvoiceOwnerName; InvoiceOwnerPostalCode = settings.InvoiceOwnerPostalCode; InvoiceOwnerVatCode = settings.InvoiceOwnerVatCode; InvoiceMaxCost = settings.MaxInvoiceValue; } SelfInvoiceButtonStyle = Application.Current.Resources["MainMenuButtonStyle"] as Style; InvoiceButtonStyle = Application.Current.Resources["InvoiceMenuButtonStyle"] as Style; CashButtonStyle = Application.Current.Resources["CashMenuButtonStyle"] as Style; MaterialsButtonStyle = Application.Current.Resources["MaterialsMenuButtonStyle"] as Style; ClientsButtonStyle = Application.Current.Resources["ClientsMenuButtonStyle"] as Style; SelfInvoiceCommand = new RelayCommand(SelfInvoice_Executed); InvoiceCommand = new RelayCommand(InvoiceCommand_Executed); CashFlowCommand = new RelayCommand(CashFlowCommand_Executed); ClientsCommand = new RelayCommand(ClientsCommand_Executed); MaterialsCommand = new RelayCommand(MaterialsCommand_Executed); }
public MaterialsViewModel() : base(NumberOfRowsInMaterialsGrid) { _contoData = new ContoData(); Measures = new List <Measures>(_contoData.MeasuresGet()); ExistingMeasures = new List <Measures>(_contoData.MeasuresGet()); Initialize(OnPropertyChanged, _contoData.MaterialsGet); UpdatePanelVisibility = Visibility.Collapsed; }
public static void CreateFirstPdf() { var contoData = new ContoData(); //FileStream fs = new FileStream("Chapter1_example.pdf", FileMode.Create, FileAccess.Write, FileShare.None); //Document doc = new Document(); //PdfWriter writer = PdfWriter.GetInstance(doc, fs); using (FileStream fs = new FileStream("Chapter1_example.pdf", FileMode.Create, FileAccess.Write, FileShare.None)) using (Document doc = new Document(PageSize.A4, 25, 25, 30, 30)) using (PdfWriter writer = PdfWriter.GetInstance(doc, fs)) { doc.Open(); PdfReader templateReader = new PdfReader(PdfResources.Autofattura_Template); PdfTemplate background = writer.GetImportedPage(templateReader, 1); doc.NewPage(); var pcb = writer.DirectContentUnder; pcb.AddTemplate(background, 0, 0); pcb = writer.DirectContent; pcb.BeginText(); pcb.SetFontAndSize(Font, 10); pcb.SetTextMatrix(469, 650); pcb.ShowText(DateTime.Now.ToString("dd/MM/yyyy")); pcb.SetTextMatrix(469, 613); pcb.ShowText("6306/13"); /* ANAGRAFICA CLIENTE AUTOFATTURA */ SelfInvoiceOwner(pcb, contoData.GetSettings()); SelfInvoiceDescription(pcb, "Rottame rame"); SelfInvoiceQuantity(pcb, 0.18M); SelfInvoiceMaterialPrice(pcb, 4720.02M); SelfInvoiceAmount(pcb, 849.60M); TaxableAmount(pcb, 849.60M); TotalAmount(pcb, 849.60M); pcb.EndText(); doc.Close(); writer.Close(); fs.Close(); string path = Environment.ExpandEnvironmentVariables(@"%ProgramFiles(x86)%"); string pathToExecutable = @"\Adobe\Adobe Reader\Reader\AcroRd32.exe"; RunExecutable(string.Concat(path, pathToExecutable), @"/p ""Chapter1_example.pdf"""); } }
public CashFlowViewModel() { _contoData = new ContoData(); AddWithdrawCommand = new RelayCommand(AddWithdrawCommand_Executed); AddCostCommand = new RelayCommand(AddCostCommand_Executed); WithdrawDate = DateTime.Now; CostDate = DateTime.Now; SelfInvoices = new CollectionView(_contoData.CashFlowSelfInvoices()); Balance = _contoData.CashFlowBalance(); }
public ClientsViewModel() { _contoData = new ContoData(); _completeList = new List <Client>(_contoData.ClientsGet()); NumberOfPages = (int)Math.Ceiling((double)_completeList.Count / NumberOfRowsInClientsGrid); SetClientsList(); AddClientCommand = new RelayCommand(AddClientCommand_Executed); RemoveClientCommand = new RelayCommand(RemoveClientCommand_Executed); ModifyClientCommand = new RelayCommand(ModifyClientCommand_Executed); UpdateClientCommand = new RelayCommand(UpdateClientCommand_Executed); UpdateClientCloseCommand = new RelayCommand(UpdateClientCommandClose_Executed); UpdatePanelVisibility = Visibility.Collapsed; }
public SettingsViewModel() { _contoData = new ContoData(); var settings = _contoData.GetSettings(); if (settings != null) { InvoiceOwnerAddress = settings.InvoiceOwnerAddress; InvoiceOwnerCity = settings.InvoiceOwnerCity; InvoiceOwnerFiscalCode = settings.InvoiceOwnerFiscalCode; InvoiceOwnerName = settings.InvoiceOwnerName; InvoiceOwnerPostalCode = settings.InvoiceOwnerPostalCode; InvoiceOwnerVatCode = settings.InvoiceOwnerVatCode; InvoiceMaxCost = settings.MaxInvoiceValue; } }
//ITC Avant Garde Gothic // Print with acrobat reader snippet // http://www.codeproject.com/Tips/598424/How-to-Silently-Print-PDFs-using-Adobe-Reader-and public static void ExportSelfInvoicesPdf(List <SelfInvoices> selfInvoices) { var contoData = new ContoData(); using (var fs = new FileStream("Fatture.pdf", FileMode.Create, FileAccess.Write, FileShare.None)) using (var doc = new Document(PageSize.A4, 25, 25, 30, 30)) using (PdfWriter writer = PdfWriter.GetInstance(doc, fs)) { doc.Open(); // get template and add to page var templateReader = new PdfReader(PdfResources.Autofattura_Template); PdfTemplate background = writer.GetImportedPage(templateReader, 1); foreach (var selfInvoice in selfInvoices) { ExportPdfSelfInvoice(selfInvoice, contoData, doc, writer, background); } doc.Close(); writer.Close(); fs.Close(); } }
public SelfInvoiceViewModel() : base(NumberOfRowsInSelfInvoicesGrid) { _contoData = new ContoData(); ModifySelfInvoiceCommand = new RelayCommand(ModifySelfInvoiceCommand_Executed); UpdateSelfInvoiceCloseCommand = new RelayCommand(UpdateSelfInvoiceCommandClose_Executed); UpdateSelfInvoiceCommand = new RelayCommand(UpdateSelfInvoiceCommand_Executed); RemoveSelfInvoiceCommand = new RelayCommand(RemoveSelfInvoiceCommand_Executed); InvoiceDate = DateTime.Now; InvoiceYear = DateTime.Now.Year; VatExempt = true; Materials = new List <Material>(_contoData.MaterialsGet()); ExistingMaterials = new List <Material>(Materials); Measures = new List <Measures>(_contoData.MeasuresGet()); ExistingMeasures = new List <Measures>(_contoData.MeasuresGet()); Initialize(OnPropertyChanged, _contoData.SelfInvoicesMasterGet); UpdatePanelVisibility = Visibility.Collapsed; }
public CashFlowViewModel() : base(NumberOfRowsInCashFlowsGrid) { _contoData = new ContoData(); DepositCommand = new RelayCommand(DepositCommand_Executed); CostCommand = new RelayCommand(CostCommand_Executed); FilterGridCommand = new RelayCommand(FilterGridCommand_Executed); ExportPdf = new RelayCommand(ExportPdf_Executed); AddSelfInvoiceToPrintCommand = new RelayCommand(AddSelfInvoiceToPrintCommand_Executed); GridFilterMonths = new Dictionary <int, string> { { 1, "Gennaio" }, { 2, "Febbraio" }, { 3, "Marzo" }, { 4, "Aprile" }, { 5, "Maggio" }, { 6, "Giugno" }, { 7, "Luglio" }, { 8, "Agosto" }, { 9, "Settembre" }, { 10, "Ottobre" }, { 11, "Novembre" }, { 12, "Dicembre" }, }; var lastDate = _contoData.CashFlowGetLastDateTime(); GridFilterSelectedYear = lastDate.Year; GridFilterSelectedMonth = lastDate.Month; DepositDate = DateTime.Today; CostDate = DateTime.Today; Initialize(OnPropertyChanged, _contoData.CashFlowGetYearMonth, lastDate.Year, lastDate.Month); SelfInvoicePrintButtonVisibility = Visibility.Collapsed; }
private static void ExportPdfSelfInvoice(SelfInvoices selfInvoices, ContoData contoData, Document doc, PdfWriter writer, PdfTemplate background) { var material = contoData.MaterialGet(selfInvoices.MaterialId); doc.NewPage(); var pcb = writer.DirectContentUnder; pcb.AddTemplate(background, 0, 0); pcb = writer.DirectContent; pcb.BeginText(); pcb.SetFontAndSize(Font, 10); // invoice date pcb.SetTextMatrix(469, 650); pcb.ShowText(selfInvoices.InvoiceDate.ToString("dd/MM/yyyy")); // invoice number pcb.SetTextMatrix(469, 613); pcb.ShowText(string.Format("{0}/{1}", selfInvoices.InvoiceNumber, selfInvoices.InvoiceYear.ToString(CultureInfo.InvariantCulture).Substring(2))); // invoice owner SelfInvoiceOwner(pcb, contoData.GetSettings()); // material description SelfInvoiceDescription(pcb, material.Description); SelfInvoiceQuantity(pcb, selfInvoices.Quantity); SelfInvoiceMaterialPrice(pcb, material.Price.HasValue ? material.Price.Value : 0); SelfInvoiceAmount(pcb, selfInvoices.InvoiceCost); TaxableAmount(pcb, selfInvoices.InvoiceCost); TotalAmount(pcb, selfInvoices.InvoiceCost); pcb.EndText(); }
public SettingsObjectDataProvider() { _dataAccessLayer = new ContoData(); }
public CustomerObjectDataProvider() { _dataAccessLayer = new ContoData(); }
public MaterialsObjectDataProvider() { _dataAccessLayer = new ContoData(); }