/* public bool verificaData() * { * Invoice ivlast = _invoiceController.ListALLAsNoTracking().LastOrDefault(); * if(ivlast != null) * { * if(ivlast.DataCadastro > DateTime.Now) * { * MessageBox.Show("Verifique se a data do Sistema está correta..!"); * return false; * } * } * return true; * }*/ public void salvar() { //Series serie = _serieController.ListALLAsNoTracking()[cmbSerie.SelectedIndex]; try { CalcCodigoFaturaAtual(); obs = txtDescricao.Text; string invoiceNo = getInvoiceTypeTipo() + " " + _serieController.ListALLAsNoTracking()[cmbSerie.SelectedIndex].Serie + "/" + _codigoFaturaAtual; DateTime dataAtual = DateTime.Now; //string GrossTotal = (TotalIva + totalIncidencia).ToString("F").Replace(',', '.'); string GrossTotal = (totGeral).ToString("F3").Replace(',', '.'); // string dadosHash2 = dataAtual.ToString("yyyy-MM-dd") + ";" + dataAtual.ToString("yyyy-MM-ddTHH:mm") + ";" + invoiceNo + ";" + (TotalIva + totalIncidencia).ToString("N2").Replace(",", ".") + ";"; string dadosHash = dataAtual.ToString("yyyy-MM-dd") + ";" + dataAtual.ToString("yyyy-MM-ddTHH:mm:ss") + ";" + invoiceNo + ";" + GrossTotal + ";"; dadosHash += lastInvoice != null ? lastInvoice.Hash : ""; //dadosHash = lastInvoice != null ? dadosHash + lastInvoice.Hash : dadosHash; string Hash = Methods.gerarHash(dadosHash, invoiceNo); Invoice invoice = new Invoice() { InvoiceDate = dataAtual.ToString("yyyy-MM-dd"), Codigo = _codigoFaturaAtual, ClienteId = ClienteID, SeriesId = idSerie, InvoiceNo = invoiceNo, TipoDocumentoId = idTipoDocumento, Desconto = totDescontoProducts, Observacao = obs, TotalImposto = TotalIva, TotalIncidencia = totalIncidencia, TotalLiquidar = cmbInvoiceType.Text == "FT" ? totalIncidencia + TotalIva : 0, UserId = UserCurrent.getCurrentUser().Id, Troco = troco, ValorPago = valorPago, FormaPagamentoId = cmbInvoiceType.Text == "FT" ? "CD" : cmbInvoiceType.Text == "PP" || cmbInvoiceType.Text == "FP" ? null : _paymentWays.ListALLAsNoTracking()[cmbPaymentMechanism.SelectedIndex].Id, DataCadastro = dataAtual, Hash = Hash, DataVencimento = dtVencimento.Enabled ? dtVencimento.Value : DateTime.Now, }; _invoiceController.insert(invoice); invoice = _invoiceController.getForInvoiceNo(invoiceNo); int idFatura = invoice != null ? invoice.Id : 0; if (idFatura == 0) { MessageBox.Show("Fatura Nula"); } _invoiceController.Dispose(); _invoiceController = new InvoiceController(); /*string dadosHash = invoice.InvoiceDate + ";" + invoice.DataCadastro.ToString("yyyy-MM-ddTHH:mm:ss") + ";" + invoice.InvoiceNo + ";" + invoice.TotalGeral.ToString("N2").Replace(",", ".") + ";"; * string dadosHash2 = invoice.InvoiceDate + ";" + invoice.DataCadastro.ToString("yyyy-MM-ddTHH:mm") + ";" + invoice.InvoiceNo + ";" + invoice.TotalGeral.ToString("N2").Replace(",", ".") + ";"; * dadosHash = lastInvoice != null ? dadosHash2 + lastInvoice.Hash : dadosHash; * invoice.Hash = Methods.gerarHash(dadosHash);*/ CurrentAccountSystem currentAccountSystem = _currentAcountSystemController.ListALL()[cmbConta.SelectedIndex]; currentAccountSystem.Saldo += invoice.TotalGeral; _currentAcountSystemController.update(currentAccountSystem); foreach (var item in __listaSelected) { Stock stock = _stock.getStockArmazemProduct(item.ProdutoId, item.Stock.ArmazemId); stock.Quantidade -= item.Quantidade; _stock.update(stock); string movitoISE = null; Product product = _products.getOne(item.ProdutoId); if (product.MotivoISEId != null) { movitoISE = product.MotivoISE.MencaoFatura; } ProductSales productSale = new ProductSales() { Preco = item.Preco, FaturaId = idFatura, ProductId = item.ProdutoId, Desconto = item.Desconto, Descricao_Produto = product.Descricao, Quantidade = item.Quantidade, StockId = item.StockId, Taxa = product.CodigoTaxa.Taxa, Unidade = product.UnidadeBase.Simbolo, MotivoISEId = product.MotivoISEId, MotivoIsencao = movitoISE, }; _sales.insert(productSale); } __listaSelected.Clear(); gdvControlProducts.DataSource = __listaSelected; gdvControlProducts.RefreshDataSource(); CalcCodigoFaturaAtual(); print(idFatura); } catch (Exception error) { MessageBox.Show(error.Message); } }
public Dictionary <string, object> Drill(string action, string drilledSeries) { BindData(); return(PivotChart.GetJsonData(action, ProductSales.GetSalesData(), drilledSeries)); }
public ActionResult MultipleChart() { return(View(ProductSales.GetData())); }
public int update(ProductSales productSales) { return(_productSalesRepo.update(productSales)); }
public Dictionary <string, object> Initialize(string action, string currentReport, string customObject) { BindData(); return(PivotChart.GetJsonData(action, ProductSales.GetSalesData())); }
public int insert(ProductSales productSales) { return(_productSalesRepo.insert(productSales)); }
public int delete(ProductSales productSales) { return(_productSalesRepo.remove(productSales)); }
public AuditFileMasterFiles masterFiles() { var groupListProduct = _productSalesController.ListALL(). Where(c => c.DataCadastro.Date >= dataInicio.Date && c.DataCadastro.Date <= dataFinal.Date && c.Fatura.TipoDocumento.SalesInvoices).ToList(). GroupBy(c => c.ProductId); var groupListProductCustomer = _productSalesController.ListALL(). Where(c => c.DataCadastro.Date >= dataInicio.Date && c.DataCadastro.Date <= dataFinal.Date && c.Fatura.TipoDocumento.SalesInvoices).ToList(). GroupBy(c => c.Fatura.ClienteId); AuditFileMasterFilesProduct[] auditFileProduct = new AuditFileMasterFilesProduct[groupListProduct.Count()]; AuditFileMasterFilesCustomer[] auditFileCustomer = new AuditFileMasterFilesCustomer[groupListProductCustomer.Count()]; AuditFileMasterFilesTaxTableEntry[] auditTaxTable; /* foreach (var item in groupList) * { * * Console.WriteLine(item.Key); * foreach (var prodSale in item) * { * Console.WriteLine(" * - " + prodSale.Product.Descricao); * } * }*/ List <TabelaImposto> tabela_taxas = new List <TabelaImposto>(); int i = 0; string imposto; string impostoType; string impostoDescricao; foreach (var item in groupListProduct) { ProductSales p = item.ToList()[0]; string cod = p.Product.Codigo_Barra != "" && p.Product.Codigo_Barra != null ? p.Product.Codigo_Barra : p.Product.Id.ToString(); auditFileProduct[i] = new AuditFileMasterFilesProduct() { ProductCode = p.Product.Id.ToString(), ProductDescription = p.Descricao_Produto, ProductType = p.Product.TipoArtigo.Tipo, ProductNumberCode = cod, ProductGroup = p.Product.Categoria.Categoria }; imposto = p.Product.CodigoTaxa.Code; impostoType = p.Product.CodigoTaxaId == 3 ? "NS" : "IVA"; impostoDescricao = p.Product.CodigoTaxa.Descricao; tabela_taxas.Add(new TabelaImposto() { TaxType = impostoType, TaxCode = imposto, TaxCodeDescription = impostoDescricao, Taxa = decimal.Parse(p.Taxa.ToString()), }); i++; } var groupTabela_taxas = tabela_taxas.GroupBy(c => c.TaxCode).ToList(); auditTaxTable = new AuditFileMasterFilesTaxTableEntry[groupTabela_taxas.Count()]; i = 0; foreach (var item in groupTabela_taxas) { auditTaxTable[i] = new AuditFileMasterFilesTaxTableEntry() { TaxType = item.ToList()[0].TaxType, TaxCountryRegion = "AO", TaxCode = item.ToList()[0].TaxCode, TaxPercentage = item.ToList()[0].Taxa.ToString("F3").Replace(",", "."), Description = item.ToList()[0].TaxCodeDescription, }; i++; } List <Customer> _customers = new List <Customer>(); i = 0; int contFinal = 0; foreach (var item in groupListProductCustomer) { Customer c = item.ToList()[0].Fatura.Cliente; if ((c.Nif.Contains("9999999") || c.Nif == string.Empty)) { contFinal++; } bool isOnlist = false; foreach (var itemCustomer in _customers) { if (itemCustomer.Id == c.Id) { isOnlist = true; } } if (!isOnlist) { if ((c.Nif.Contains("9999999") || c.Nif == string.Empty) && contFinal == 1) { _customers.Add(finalCustomer); } else if (!c.Nif.Contains("9999999") && c.Nif.Length > 6) { _customers.Add(c); } else { isOnlist = true; } } if (!isOnlist) { bool finalCl = c.Nif == string.Empty || c.Nif.Contains("9999999"); string endereco = c.Endereco != null && c.Endereco != "" ? c.Endereco : "Nao definido"; string contaCorrente = c.Conta_Corrente != null && c.Conta_Corrente != string.Empty ? c.Conta_Corrente : "Desconhecido"; string siglaPais = new CountryController().getOne(c.Cidade.PaisId).Sigla; auditFileCustomer[i] = new AuditFileMasterFilesCustomer() { CustomerID = finalCl ? finalCustomer.Id.ToString() : c.Id.ToString(), CustomerTaxID = finalCl ? finalCustomer.Nif : c.Nif, CompanyName = finalCl ? finalCustomer.Cliente : c.Cliente, SelfBillingIndicator = "0", AccountID = finalCl ? finalCustomer.Conta_Corrente : contaCorrente, BillingAddress = new AuditFileMasterFilesCustomerBillingAddress() { City = finalCl ? finalCustomer.Cidade.Cidade : c.Cidade.Cidade, Country = finalCl ? "AO" : siglaPais, PostalCode = finalCl ? finalCustomer.Postal : c.Postal, AddressDetail = finalCl ? "Nao definido" : endereco, }, }; i++; } } return(new AuditFileMasterFiles() { Product = auditFileProduct, Customer = auditFileCustomer, TaxTable = auditTaxTable, }); }
public Dictionary <string, object> Initialize(string action, string customObject) { htmlHelper.PivotReport = BindDefaultData(); return(htmlHelper.GetJsonData(action, ProductSales.GetSalesData())); }
public Dictionary <string, object> DropNode(string action, string args) { return(pivotClient.GetJsonData(action, ProductSales.GetSalesData(), args)); }
public Dictionary <string, object> FetchMembers(string action, string currentReport, string customObject, string headerTag) { pivotClient.PopulateData(currentReport); return(pivotClient.GetJsonData(action, ProductSales.GetSalesData(), headerTag)); }
public Dictionary <string, object> ToolbarOperations(string action, string args) { return(pivotClient.GetJsonData(action, ProductSales.GetSalesData(), args)); }
public Dictionary <string, object> ValueSorting(string action, string valueSorting, string currentReport, string customObject) { pivotClient.PopulateData(currentReport); return(pivotClient.GetJsonData(action, ProductSales.GetSalesData(), valueSorting)); }
public Dictionary <string, object> Sorting(string action, string currentReport, string sortedHeaders) { pivotClient.PopulateData(currentReport); return(pivotClient.GetJsonData(action, ProductSales.GetSalesData(), sortedHeaders)); }
public Dictionary <string, object> Initialize(string action, string clientParams) { BindData(); return(pivotClient.GetJsonData(action, ProductSales.GetSalesData(), clientParams)); }
public Dictionary <string, object> Filtering(string action, string filterParams, string currentReport, string customObject) { pivotClient.PopulateData(currentReport); return(pivotClient.GetJsonData(action, ProductSales.GetSalesData(), filterParams)); }