paid invoices support
This commit is contained in:
@@ -39,22 +39,27 @@ namespace CebelcaAPI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<string> AddInvoiceHead(string partnerId, string idDocumentExt, DateTime dateSent, DateTime dateServed, DateTime dateToPay)
|
public async Task<string> AddInvoiceHead(string partnerId, string idDocumentExt, DateTime dateSent, DateTime dateServed, DateTime dateToPay, bool paid = false)
|
||||||
{
|
{
|
||||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("sl-SI");
|
Thread.CurrentThread.CurrentCulture = new CultureInfo("sl-SI");
|
||||||
var values = new Dictionary<string, string>
|
var values = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{ "date_sent",dateSent.ToShortDateString() },
|
{ "date_sent",dateSent.ToShortDateString() },
|
||||||
{ "date_served",dateServed.ToShortDateString() },
|
{ "date_served",dateServed.ToShortDateString() },
|
||||||
{ "date_to_pay",dateToPay.ToShortDateString() },
|
{ "date_to_pay", dateToPay.ToShortDateString() },
|
||||||
{ "id_partner", partnerId },
|
{ "id_partner", partnerId },
|
||||||
{ "id_document_ext", idDocumentExt }
|
{ "id_document_ext", idDocumentExt }
|
||||||
};
|
};
|
||||||
|
if (paid)
|
||||||
|
{
|
||||||
|
values.Add("payment", "paid");
|
||||||
|
values.Add("payment_act", "1");
|
||||||
|
}
|
||||||
var ret = await APICall("invoice-sent", "insert-smart-2", values);
|
var ret = await APICall("invoice-sent", "insert-smart-2", values);
|
||||||
var json = JArray.Parse(ret);
|
var json = JArray.Parse(ret);
|
||||||
var retname = (json[0][0] as JObject).Properties().First().Name;
|
var retname = (json[0][0] as JObject).Properties().First().Name;
|
||||||
if (retname != "id")
|
if (retname != "id")
|
||||||
throw new Exception("Error from api: "+ret);
|
throw new Exception("Error from api: " + ret);
|
||||||
var id = json[0][0]["id"].Value<string>();
|
var id = json[0][0]["id"].Value<string>();
|
||||||
return id;
|
return id;
|
||||||
|
|
||||||
@@ -99,7 +104,7 @@ namespace CebelcaAPI
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public async Task<string> AddInvoiceLine(string invoiceId,string title, string measuringUnit, string qty, decimal price, string vat, string discount)
|
public async Task<string> AddInvoiceLine(string invoiceId, string title, string measuringUnit, string qty, decimal price, string vat, string discount)
|
||||||
{
|
{
|
||||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("sl-SI");
|
Thread.CurrentThread.CurrentCulture = new CultureInfo("sl-SI");
|
||||||
var values = new Dictionary<string, string>
|
var values = new Dictionary<string, string>
|
||||||
@@ -121,7 +126,7 @@ namespace CebelcaAPI
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<string> AddPayment(string invoiceId, DateTime dateOfPayment, decimal amount, string paymentMethod )
|
public async Task<string> AddPayment(string invoiceId, DateTime dateOfPayment, decimal amount, string paymentMethod)
|
||||||
{
|
{
|
||||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("sl-SI");
|
Thread.CurrentThread.CurrentCulture = new CultureInfo("sl-SI");
|
||||||
var values = new Dictionary<string, string>
|
var values = new Dictionary<string, string>
|
||||||
@@ -143,7 +148,7 @@ namespace CebelcaAPI
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<string> IssueInvoiceNoFiscalization(string invoiceId, string docType="0")
|
public async Task<string> IssueInvoiceNoFiscalization(string invoiceId, string docType = "0")
|
||||||
{
|
{
|
||||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("sl-SI");
|
Thread.CurrentThread.CurrentCulture = new CultureInfo("sl-SI");
|
||||||
var values = new Dictionary<string, string>
|
var values = new Dictionary<string, string>
|
||||||
@@ -163,7 +168,7 @@ namespace CebelcaAPI
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<string> IssueInvoiceFiscalization(string invoiceId, string idLocation, string opTaxId, string opName, bool test_mode = false )
|
public async Task<string> IssueInvoiceFiscalization(string invoiceId, string idLocation, string opTaxId, string opName, bool test_mode = false)
|
||||||
{
|
{
|
||||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("sl-SI");
|
Thread.CurrentThread.CurrentCulture = new CultureInfo("sl-SI");
|
||||||
var values = new Dictionary<string, string>
|
var values = new Dictionary<string, string>
|
||||||
|
|||||||
Reference in New Issue
Block a user