Skip to content

Commit

Permalink
Update EFatura & EIrsaliye id feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Onur Evren committed Nov 24, 2023
1 parent 29bd77f commit 1ced282
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/EFatura.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ public function __construct()
xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"></Invoice>');
}

public function info($profileId,$itemType,$note,$currency,$issueDate,$issueTime,$lineCount): void
public function info($profileId,$itemType,$note,$currency,$issueDate,$issueTime,$lineCount,$id = null): void
{
$this->xml->addChild('cbc:UBLVersionID', '2.1', 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$this->xml->addChild('cbc:CustomizationID', 'TR1.2', 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$this->xml->addChild('cbc:ProfileID', $profileId, 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$this->xml->addChild('cbc:ID', '', 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$this->xml->addChild('cbc:ID', $id, 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$this->xml->addChild('cbc:CopyIndicator', 'false', 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$this->xml->addChild('cbc:UUID', '', 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$this->xml->addChild('cbc:IssueDate', $issueDate, 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
Expand Down
24 changes: 14 additions & 10 deletions src/EIrsaliye.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Evrenonur;
class EIrsaliye
{
Expand All @@ -17,19 +18,20 @@ public function __construct()
xmlns="urn:oasis:names:specification:ubl:schema:xsd:DespatchAdvice-2"></DespatchAdvice>');
}

public function info($profileId,$itemType,$issueDate,$issueTime,$lineCount): void
public function info($profileId, $itemType, $issueDate, $issueTime, $lineCount, $id = null): void
{
$this->xml->addChild('cbc:UBLVersionID', '2.1', 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$this->xml->addChild('cbc:CustomizationID', 'TR1.2', 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$this->xml->addChild('cbc:ProfileID', $profileId, 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$this->xml->addChild('cbc:ID', '', 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$this->xml->addChild('cbc:ID', $id, 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$this->xml->addChild('cbc:CopyIndicator', 'false', 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$this->xml->addChild('cbc:UUID', '', 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$this->xml->addChild('cbc:IssueDate', $issueDate, 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$this->xml->addChild('cbc:IssueTime', $issueTime, 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$this->xml->addChild('cbc:DespatchAdviceTypeCode', $itemType, 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$this->xml->addChild('cbc:LineCountNumeric', $lineCount, 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
}

public function additionalDocumentReference($value): void
{
$additionalDocumentReference = $this->xml->addChild('cac:AdditionalDocumentReference');
Expand All @@ -44,9 +46,10 @@ public function additionalDocumentReference($value): void
$embeddedDocumentBinaryObject->addAttribute('mimeCode', 'application/xml');
$embeddedDocumentBinaryObject->addAttribute('encodingCode', 'Base64');
$embeddedDocumentBinaryObject->addAttribute('characterSetCode', 'UTF-8');
$embeddedDocumentBinaryObject->addAttribute('filename', uniqid() .'.xslt');
$embeddedDocumentBinaryObject->addAttribute('filename', uniqid() . '.xslt');
}
public function despatchSupplierParty($webSite,$vkn,$ticaretSicilNo ,$mersisNo,$name,$adres,$ilce,$il,$postakodu = null,$ulke= null,$vergiDairesi= null,$telefon= null,$fax= null,$mail= null): void

public function despatchSupplierParty($webSite, $vkn, $ticaretSicilNo, $mersisNo, $name, $adres, $ilce, $il, $postakodu = null, $ulke = null, $vergiDairesi = null, $telefon = null, $fax = null, $mail = null): void
{
$accountingSupplierParty = $this->xml->addChild('cac:DespatchSupplierParty', null, 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2');

Expand Down Expand Up @@ -94,7 +97,8 @@ public function despatchSupplierParty($webSite,$vkn,$ticaretSicilNo ,$mersisNo,$
$contact->addChild('cbc:Telefax', $fax, 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$contact->addChild('cbc:ElectronicMail', $mail, 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
}
public function deliveryCustomerParty($webSite,$vkn,$name,$adres,$ilce,$il,$postakodu = null,$ulke= null,$vergiDairesi= null,$telefon= null,$fax= null,$mail= null)

public function deliveryCustomerParty($webSite, $vkn, $name, $adres, $ilce, $il, $postakodu = null, $ulke = null, $vergiDairesi = null, $telefon = null, $fax = null, $mail = null)
{
$accountingCustomerParty = $this->xml->addChild('cac:DeliveryCustomerParty', null, 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2');
// Party öğesi
Expand Down Expand Up @@ -182,7 +186,7 @@ public function createShipment($shipmentID, $valueAmount, $licensePlateID, $driv
$despatch->addChild('cbc:ActualDespatchDate', $despatchDate, 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$despatch->addChild('cbc:ActualDespatchTime', $despatchTime, 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');

if ($transportEquipmentIDs != null){
if ($transportEquipmentIDs != null) {
$transportHandlingUnit = $shipment->addChild('cac:TransportHandlingUnit', null, 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2');
foreach ($transportEquipmentIDs as $equipmentID) {
$transportEquipment = $transportHandlingUnit->addChild('cac:TransportEquipment', null, 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2');
Expand All @@ -208,7 +212,7 @@ public function addDespatchLine(
$buyersItemIdentification = null,
$sellersItemIdentification = null,
$additionalItemIdentification = null,
)
)
{
$despatchLine = $this->xml->addChild('cac:DespatchLine', null, 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2');

Expand All @@ -228,7 +232,7 @@ public function addDespatchLine(
$orderLineReference->addChild('cbc:LineID', $orderLineReferenceLineID, 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');


if ($itemName != null && $itemDescription != null && $brandName != null && $buyersItemIdentification != null && $sellersItemIdentification != null){
if ($itemName != null && $itemDescription != null && $brandName != null && $buyersItemIdentification != null && $sellersItemIdentification != null) {
$item = $despatchLine->addChild('cac:Item', null, 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2');
$item->addChild('cbc:Description', $itemDescription, 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$item->addChild('cbc:Name', $itemName, 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
Expand All @@ -242,14 +246,14 @@ public function addDespatchLine(
$sellersItemIdentificationLine = $item->addChild('cac:SellersItemIdentification', null, 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2');
$sellersItemIdentificationLine->addChild('cbc:ID', $sellersItemIdentification, 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');

if ($additionalItemIdentification != null){
if ($additionalItemIdentification != null) {
foreach ($additionalItemIdentification as $itemIdentification) {
$additionalItemIdentificationLine = $item->addChild('cac:AdditionalItemIdentification', null, 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2');
$additionalItemIdentificationLine->addChild('cbc:ID', $itemIdentification['id'], 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2')->addAttribute('schemeID', $itemIdentification['value']);
}
}

}else{
} else {
$item = $despatchLine->addChild('cac:Item', null, 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2');
$item->addChild('cbc:Name', $itemName, 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
}
Expand Down

0 comments on commit 1ced282

Please sign in to comment.