bug fix in sell docs print and add card samery to sellprint invoice

This commit is contained in:
Hesabix 2025-06-30 11:47:19 +00:00
parent 2f38d5dc6b
commit ab07489f57
2 changed files with 47 additions and 24 deletions

View file

@ -759,6 +759,23 @@ class SellController extends AbstractController
} }
} }
$pdfPid = 0; $pdfPid = 0;
// فیلد جدید وضعیت حساب مشتری
$personItems = $entityManager->getRepository(HesabdariRow::class)->findBy(['bid' => $acc['bid'], 'person' => $person]);
$accountStatus = [];
$bs = 0;
$bd = 0;
foreach ($personItems as $item) {
$bs += $item->getBs();
$bd += $item->getBd();
}
if ($bs > $bd) {
$accountStatus['label'] = 'بستانکار';
$accountStatus['value'] = $bs - $bd;
} else {
$accountStatus['label'] = 'بدهکار';
$accountStatus['value'] = $bd - $bs;
}
if ($params['pdf'] == true || $params['printers'] == true) { if ($params['pdf'] == true || $params['printers'] == true) {
$note = ''; $note = '';
if ($printSettings) { if ($printSettings) {
@ -768,6 +785,7 @@ class SellController extends AbstractController
$acc['bid'], $acc['bid'],
$this->getUser(), $this->getUser(),
$this->renderView('pdf/printers/sell.html.twig', [ $this->renderView('pdf/printers/sell.html.twig', [
'accountStatus' => $accountStatus,
'bid' => $acc['bid'], 'bid' => $acc['bid'],
'doc' => $doc, 'doc' => $doc,
'rows' => array_map(function ($row) { 'rows' => array_map(function ($row) {

View file

@ -70,7 +70,7 @@
<p> <p>
<b>نام: <b>نام:
</b> </b>
{{ bid.legalName }} {% if bid.legalName is not empty %}{{ bid.legalName }}{% endif %}
</p> </p>
</td> </td>
<td class="center"> <td class="center">
@ -78,27 +78,27 @@
<b> <b>
شناسه ملی: شناسه ملی:
</b> </b>
{{ bid.shenasemeli }} {% if bid.shenasemeli is not empty %}{{ bid.shenasemeli }}{% endif %}
</p> </p>
</td> </td>
<td class="center"> <td class="center">
<p> <p>
<b>شماره ثبت: <b>شماره ثبت:
</b> </b>
{{ bid.shomaresabt }} {% if bid.shomaresabt is not empty %}{{ bid.shomaresabt }}{% endif %}
</p> </p>
</td> </td>
<td class="center"> <td class="center">
<p> <p>
<b>شماره اقتصادی: <b>شماره اقتصادی:
</b> </b>
{{ bid.codeeghtesadi }} {% if bid.codeeghtesadi is not empty %}{{ bid.codeeghtesadi }}{% endif %}
</p> </p>
</td> </td>
<td class="center"> <td class="center">
<p> <p>
<b>تلفن / نمابر:</b> <b>تلفن / نمابر:</b>
{{ bid.tel }} {% if bid.tel is not empty %}{{ bid.tel }}{% endif %}
</p> </p>
</td> </td>
</tr> </tr>
@ -106,17 +106,14 @@
<td class="" colspan="1"> <td class="" colspan="1">
<p> <p>
<b>کد پستی:</b> <b>کد پستی:</b>
{{ bid.postalcode }} {% if bid.postalcode is not empty %}{{ bid.postalcode }}{% endif %}
</p> </p>
</td> </td>
<td class="" colspan="3"> <td class="" colspan="3">
<p> <p>
<b>آدرس: <b>آدرس:
</b> </b>
استان {% if bid.ostan is not empty %}استان {{ bid.ostan }}{% endif %}{% if bid.shahrestan is not empty %}، شهر {{ bid.shahrestan }}{% endif %}{% if bid.address is not empty %}، {{ bid.address }}{% endif %}
{{ bid.ostan }}، شهر
{{ bid.shahrestan }}،
{{ bid.address }}
</p> </p>
</td> </td>
</tr> </tr>
@ -138,34 +135,34 @@
<b>نام: <b>نام:
</b> </b>
{% if person.prelabel is not null %}{{ person.prelabel.label }}{% endif %} {% if person.prelabel is not null %}{{ person.prelabel.label }}{% endif %}
{{ person.nikename }} {% if person.nikename is not empty %}{{ person.nikename }}{% endif %}
</p> </p>
</td> </td>
<td class="center"> <td class="center">
<p> <p>
<b> شناسه ملی: <b> شناسه ملی:
</b> </b>
{{ person.shenasemeli }} {% if person.shenasemeli is not empty %}{{ person.shenasemeli }}{% endif %}
</p> </p>
</td> </td>
<td class="center"> <td class="center">
<p> <p>
<b>شماره ثبت: <b>شماره ثبت:
</b> </b>
{{ person.sabt }} {% if person.sabt is not empty %}{{ person.sabt }}{% endif %}
</p> </p>
</td> </td>
<td class="center"> <td class="center">
<p> <p>
<b>شماره اقتصادی: <b>شماره اقتصادی:
</b> </b>
{{ person.codeeghtesadi }} {% if person.codeeghtesadi is not empty %}{{ person.codeeghtesadi }}{% endif %}
</p> </p>
</td> </td>
<td class="center"> <td class="center">
<p> <p>
<b>تلفن / نمابر:</b> <b>تلفن / نمابر:</b>
{{ person.tel }} {% if person.tel is not empty %}{{ person.tel }}{% endif %}
</p> </p>
</td> </td>
</tr> </tr>
@ -173,17 +170,14 @@
<td class="" colspan="1"> <td class="" colspan="1">
<p> <p>
<b>کد پستی:</b> <b>کد پستی:</b>
{{ person.postalcode }} {% if person.postalcode is not empty %}{{ person.postalcode }}{% endif %}
</p> </p>
</td> </td>
<td class="" colspan="3"> <td class="" colspan="3">
<p> <p>
<b>آدرس: <b>آدرس:
</b> </b>
استان {% if person.ostan is not empty %}استان {{ person.ostan }}{% endif %}{% if person.shahr is not empty %}، شهر {{ person.shahr }}{% endif %}{% if person.address is not empty %}، {{ person.address }}{% endif %}
{{ person.ostan }}، شهر
{{ person.shahr }}،
{{ person.address }}
</p> </p>
</td> </td>
</tr> </tr>
@ -310,6 +304,17 @@
</li> </li>
</ul> </ul>
{% endif %} {% endif %}
{# فیلد جدید وضعیت حساب مشتری #}
{% if accountStatus is defined %}
<h4 class="">
وضعیت حساب مشتری با احتساب این فاکتور:
{{ accountStatus.value | number_format}}
{{ doc.money.shortName }}
{{ accountStatus.label }}
</h4>
{% endif %}
</div> </div>
</h4> </h4>
</td> </td>