I am not able to create sales documents in version 10 of ERP Primavera using the engines. I'm getting an error invoking the Actualiza
method:
Unable to save document. 0-The best overloaded method match for 'double.Parse (string)' has some invalid arguments
Using the example provided in github the error is the same
Thisistheeventwheretheerrorisbeinggenerated:
PriEngine.Engine.Vendas.Documentos.Actualiza(invoice,refstrAvisos);
Code
privatevoidCmdSave_Click(objectsender,EventArgse){VndBEDocumentoVendainvoice=newVndBEDocumentoVenda();stringstrAvisos=string.Empty;invoice.Tipodoc=txtTipoDoc.Text;invoice.Entidade=txtEntidade.Text;invoice.TipoEntidade="C";
invoice.Serie = txtSerie.Text;
// To save the document as draft set this flag to true
//invoice.Rascunho = true ;
try
{
if (checkBox1.Checked)
{
// Set all the entity related information.
PriEngine.Engine.Vendas.Documentos.PreencheDadosRelacionados(invoice);
}
if (listView1.Items.Count > 0)
{
foreach (ListViewItem item in listView1.Items)
{
VndBELinhasDocumentoVenda linhas = new VndBELinhasDocumentoVenda();
double qtd = Convert.ToDouble(item.SubItems[1].Text);
// Add new line to the invoice and set all the item related information.
PriEngine.Engine.Vendas.Documentos.AdicionaLinha(invoice, item.SubItems[0].Text, ref qtd);
linhas = invoice.Linhas;
linhas.GetEdita(1).Desconto1 = 10;
}
if (txtobs.Text.Length > 0)
{
PriEngine.Engine.Vendas.Documentos.AdicionaLinhaEspecial(invoice, vdTipoLinhaEspecial.vdLinha_Comentario, 0, txtobs.Text);
}
}
else
{
MessageBox.Show("There are no items.");
}
PriEngine.Engine.Vendas.Documentos.CalculaValoresTotais(invoice);
// Save the document as draft.
// PriEngine.Engine.Comercial.Vendas.ActualizaRascunho(invoice, ref strAvisos);
PriEngine.Engine.Vendas.Documentos.Actualiza(invoice, ref strAvisos);
if (strAvisos.Length > 0)
{
MessageBox.Show("Error writing document. \n" + strAvisos);
}
else
{
MessageBox.Show("Document saved with success.");
}
}
catch (Exception ex)
{
MessageBox.Show("Unable to save document. \n" + ex.Message);
}
}