Introduction


Below you can find an example of an application by which you can create PHP general journal in Yuki through the Accounting-ProcessJournal(sessionID, administrationID, xmlDoc) method.  


Example


<?php
$webservice_url = 'http://api.yukiworks.be/ws/Accounting.asmx?WSDL';
$key = 'VERVANGEN MET WEBSERVICEACCESSKEY';
$admin_id = 'VERVANGEN MET ADMINISTRATIONID';
$sess_id = '';

try
{

        $xml = '<Journal xmlns="urn:xmlns:http://www.theyukicompany.com:journal"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<AdministrationID>' . $admin_id . '</AdministrationID>
<AdministrationCoCNumber>12345672</AdministrationCoCNumber>
<DocumentSubject>Trx import april</DocumentSubject>
<JournalType>EndOfYearCorrection</JournalType>
<JournalEntry>
<ContactName>Apple Sales International</ContactName>
<ContactCode>9921</ContactCode>
<EntryDate>2012-12-31</EntryDate>
<GLAccount>45310</GLAccount>
<Amount>22.22</Amount>
<Description>Inkopen hardware</Description>
</JournalEntry>
<JournalEntry>
<ContactName>Apple Sales International</ContactName>
<ContactCode>9921</ContactCode>
<EntryDate>2012-12-31</EntryDate>
<GLAccount>45310</GLAccount>
<Amount>-22.22</Amount>
<Description>Retour hardware</Description>
</JournalEntry>
</Journal>';

$soap = new SoapClient($webservice_url);
$res = $soap->Authenticate(array('accessKey' => $key));
if (!isset($res->AuthenticateResult)) exit();
$sess_id = $res->AuthenticateResult;

$xmlvar = new SoapVar('<ns1:xmlDoc>'.$xml.'</ns1:xmlDoc>', XSD_ANYXML);
$res = $soap->ProcessJournal(array('sessionID' => $sess_id, 'administrationID' => $admin_id, 'xmlDoc' => $xmlvar));

print_r($res);
}
catch(SoapFault $fault)
{
print $fault->faultstring;
}
?>