OnurEvren
Bilen birisini bulmuşken sorayım 😃
https://prnt.sc/unkeGiPQrOlD
bu birim fiyat kısmını göndermeme rağmen içi boş görünüyor fatura kesildiğin de uyumsoft fiyat göndermiyorsundur diyor ama öyle olsa genel toplam da da bir şey yazmaması gerekir.
protected function prepareSoapBody(Invoice $invoice)
{
$user = $invoice->user;
$totalPayment = $invoice->total_amount - $invoice->tax;
$taxTotal = $invoice->tax;
$taxPercent = ($invoice->tax / $invoice->amount) * 100;
$title = $invoice->webinar->slug ?? 'Eğitim';
$address = $user->address ?? 'Test Adres';
$mobilePhone = $invoice->mobile ?? 5558558585;
$fullNameParts = explode(' ', $user->full_name, 2);
$firstName = $fullNameParts[0];
$lastName = isset($fullNameParts[1]) ? $fullNameParts[1] : '';
if (strlen($user->identity_number) == 10) {
$identifierType = "VKN";
$invoicePerson = '
<PartyName>
<Name xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">' . htmlspecialchars($invoiceName, ENT_XML1, 'UTF-8') . '</Name>
</PartyName>';
} else {
$identifierType = "TCKN";
$invoicePerson = '
<Person>
<FirstName xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">' . htmlspecialchars($firstName, ENT_XML1, 'UTF-8') . '</FirstName>
<FamilyName xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">' . htmlspecialchars($lastName, ENT_XML1, 'UTF-8') . '</FamilyName>
</Person>';
}
return <<<XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SendInvoice xmlns="http://tempuri.org/">
<userInfo Username="{$this->username}" Password="{$this->password}"/>
<invoices>
<InvoiceInfo LocalDocumentId="{$invoice->invoice_number}">
<Invoice>
<ProfileID xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">TICARIFATURA</ProfileID>
<ID xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$invoice->invoice_number}</ID>
<CopyIndicator xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">false</CopyIndicator>
<IssueDate xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$invoice->created_at->format('Y-m-d')}</IssueDate>
<IssueTime xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$invoice->created_at->format('H:i:s')}</IssueTime>
<InvoiceTypeCode xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">SATIS</InvoiceTypeCode>
<Note xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">""</Note>
<DocumentCurrencyCode xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">TRY</DocumentCurrencyCode>
<LineCountNumeric xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">1</LineCountNumeric>
<AccountingSupplierParty xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
<Party>
<PartyIdentification>
<ID schemeID="VKN" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">9000068418</ID>
</PartyIdentification>
<PartyName>
<Name xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">Fitnes Akademi</Name>
</PartyName>
<PostalAddress>
<StreetName xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$address}</StreetName>
<CitySubdivisionName xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$address}</CitySubdivisionName>
<CityName xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$address}</CityName>
<Country>
<Name xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">Türkiye</Name>
</Country>
</PostalAddress>
<PartyTaxScheme>
<TaxScheme>
<Name xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$address}</Name>
</TaxScheme>
</PartyTaxScheme>
</Party>
</AccountingSupplierParty>
<AccountingCustomerParty xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
<Party>
<PartyIdentification>
<ID schemeID="TCKN" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$user->identity_number}</ID>
</PartyIdentification>
'.$invoicePerson.'
<PostalAddress>
<StreetName xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$user->street}</StreetName>
<CitySubdivisionName xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$user->district}</CitySubdivisionName>
<CityName xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$user->city}</CityName>
<Country>
<Name xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$user->country}</Name>
</Country>
</PostalAddress>
<PartyTaxScheme>
<TaxScheme>
<Name xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$user->city}</Name>
</TaxScheme>
</PartyTaxScheme>
<Contact>
<Telephone xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">$mobilePhone</Telephone>
<ElectronicMail xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$user->email}</ElectronicMail>
</Contact>
</Party>
</AccountingCustomerParty>
<TaxTotal xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
<TaxAmount currencyID="TRY" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$taxTotal}</TaxAmount>
<TaxSubtotal>
<TaxAmount currencyID="TRY" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$taxTotal}</TaxAmount>
<Percent xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$taxPercent}</Percent>
<TaxCategory>
<TaxScheme>
<Name xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">KDV</Name>
<TaxTypeCode xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">0015</TaxTypeCode>
</TaxScheme>
</TaxCategory>
</TaxSubtotal>
</TaxTotal>
<LegalMonetaryTotal xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
<LineExtensionAmount currencyID="TRY" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$totalPayment}</LineExtensionAmount>
<TaxExclusiveAmount currencyID="TRY" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$totalPayment}</TaxExclusiveAmount>
<TaxInclusiveAmount currencyID="TRY" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$invoice->total_amount}</TaxInclusiveAmount>
<PayableAmount currencyID="TRY" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$invoice->total_amount}</PayableAmount>
</LegalMonetaryTotal>
<InvoiceLine xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
<ID xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">1</ID>
<InvoicedQuantity unitCode="NIU" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">1</InvoicedQuantity>
<LineExtensionAmount currencyID="TRY" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$totalPayment}</LineExtensionAmount>
<TaxTotal>
<TaxAmount currencyID="TRY" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$taxTotal}</TaxAmount>
<TaxSubtotal>
<TaxAmount currencyID="TRY" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$taxTotal}</TaxAmount>
<TaxCategory>
<TaxScheme>
<Name xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">KDV</Name>
<TaxTypeCode xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">0015</TaxTypeCode>
</TaxScheme>
</TaxCategory>
</TaxSubtotal>
</TaxTotal>
<Item>
<Description xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">""</Description>
<Name xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$title}</Name>
<Price>
<PriceAmount currencyID="TRY" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">{$totalPayment}</PriceAmount>
</Price>
</Item>
</InvoiceLine>
</Invoice>
<TargetCustomer VKN="{$user->identity_number}" Alias="" Title="test"/>
<EArchiveInvoiceInfo DeliveryType="Electronic"/>
<Scenario>Automated</Scenario>
</InvoiceInfo>
</invoices>
</SendInvoice>
</soapenv:Body>
</soapenv:Envelope>
XML;
}