

<style>

    @media print{

        tr > .myblack {
            border: 1px solid black !important;
        }


        .myleft{
            padding-top: 20px !important;
        }

        .mymargin{
            margin-top: -20px !important;
        }
    }
</style>
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">إدارة الفواتير</a></li>
            <li><a href="#">فاتورة الشراء</a></li>
            <li class="active">عرض فاتورة</li>
        </ol>

        <h3>{$billnameAddData->name}</h3>
        <hr />
        <form class="form-horizontal" role="form" action="returnBuyBillController.php?do=show" method="post" id="billform">

            <!-- =========================== START BUY BILL SETTINGS ================================== -->
            <input name="printingpapersize" id="printingpapersize" type="hidden" value="{$Programsettingdata->printingpapersize}" />

            <input type="hidden" name="billnameid" id="billnameid" value="{$billnameid}"/>
            <input type="hidden" name="returnBillSetting" id="returnBillSetting" value="{$billSettingsData[0]->billsettingsvalue}"/>
            <input type="hidden" name="storeSetting" id="storeSetting" value="{$billSettingsData[2]->billsettingsvalue}"/>
            <input type="hidden" name="parcodeSetting" id="parcodeSetting" value="{$billSettingsData[4]->billsettingsvalue}"/>
            <input type="hidden" name="dateSetting" id="dateSetting" value="{$billSettingsData[5]->billsettingsvalue}"/>
            <input type="hidden" name="newProductSetting" id="newProductSetting" value="{$billSettingsData[6]->billsettingsvalue}"/>
            <input type="hidden" name="noteSetting" id="noteSetting" value="{$billSettingsData[7]->billsettingsvalue}"/>
            <input type="hidden" name="productDiscountSetting" id="productDiscountSetting" value="{$billSettingsData[8]->billsettingsvalue}"/>
            <!-- ==========================  END BUY BILL SETTINGS ============================ -->

            <!-- =========================== START GENERAL INFO PANEL =====================-->
            <div class="row">
                <div class="col-lg-8">
                    <div class="form-group mg-bt5"  {if {$billSettingsData[61]->billsettingsvalue} eq 0} style="display:block" {else} style="display:none" {/if}>
                        <label class="col-lg-2 control-label myleft">رقم الفاتورة</label>
                        <div class="col-lg-4">
                            <p class="form-control-static">
                                {$returnbuybillData->returnbuybillSerial}
                            </p>
                        </div>
                    </div>


                    <div class="form-group mg-bt5" {if {$billsettingsData[45]->billsettingsvalue} eq 0}  {else} style="display:none" {/if}>
                        <label class="col-lg-4 control-label">مركز التكلفة </label>
                        <div class="col-lg-8">


                            {foreach $allCostcenter as $myallCostcenter}

                            {if {$returnbuybillData->costcenterid} eq {$myallCostcenter->id}}
                            <p class="form-control-static">

                                {$myallCostcenter->name}
                            </p>

                            {/if}
                            {/foreach}


                        </div>
                    </div>
                    {if $Programsettingdata->clientserial eq 1}
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5">
                        <label class="col-lg-2 control-label myleft">رقم تسلسل الفاتورة</label>
                        <div class="col-lg-4">
                            <p class="form-control-static">
                                {$returnbuybillData->returnbuybillid}
                            </p>
                        </div>
                    </div>
                    {/if}
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5" {if $billSettingsData[5]->billsettingsvalue eq 0} {else} style="display:none !important;" {/if}>
                        <label class="col-lg-2 control-label myleft">تاريخ الفاتورة</label>
                        <div class="col-lg-4">
                            <p class="form-control-static">
                                {$returnbuybillData->returnbuybilldate}
                            </p>
                        </div>
                    </div>
                    <!-- end of form-group-->
                </div>
                <!-- end of bill no-->
                <div class="col-lg-4">
                    <div class="form-group mg-bt5">
                        <label class="col-lg-2 control-label myleft">اسم المورد</label>
                        <div class="col-lg-4">
                            <div id="supplierIdDiv">
                                <p class="form-control-static">
                                    {$returnbuybillData->suppliername}
                                </p>
                            </div>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5 {if $usergroup->hideBillPrices == 1}hidden{/if}  {if  $returnbuybillData->buybilltotaldeptbefor eq '' } hidden-print {/if}" {if {$billSettingsData[56]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                        <label class="col-lg-2 control-label myleft">رصيد الدين</label>
                        <div class="col-lg-4">
                            <div id="debt" class="form-control-static"> {$returnbuybillData->buybilltotaldeptbefor} {$returnbuybillData->returnbuybilltotaldeptbefor} </div>
                        </div>
                    </div>
                    <div class="clearfix"></div>

                    <!-- end of form-group-->
                    <hr class="mg-bt5 mg-tp5 hidden-print "/>
                    <div class="form-group mg-bt5" {if $billSettingsData[2]->billsettingsvalue eq 0}  {else} style="display:none !important;" {/if}>
                        <label class="col-lg-2 control-label myleft">المخزن</label>
                        <div class="col-lg-4">
                            <p class="form-control-static">
                                {$returnbuybillData->storeName}
                            </p>
                        </div>
                    </div>
                    <div class="clearfix"></div>

                    <!-- end of form-group-->
                    <div class="form-group mg-bt5 {if  $returnbuybillData->comment eq '' } hidden-print {/if}">
                        <label class="col-lg-2 control-label myleft">التعليق</label>
                        <div class="col-lg-4">
                            <p class="form-control-static">
                                {$returnbuybillData->comment}
                            </p>
                        </div>
                    </div>
                    <!-- end of form-group-->
                </div>
                <!-- end of client info-->

            </div>
            <!-- =========================== END GENERAL INFO PANEL ====================== -->

            <!-- =========================== START BUY BILL PANEL ======================= -->
            <div class="clearfix"></div>

            <div class="row">
                <div class="row">
                    <hr class="hidden-print"/>

                    <div class="form-group mg-bt5">
                        <label class="col-lg-2 control-label">
                            <h4>المشتريات</h4>
                        </label>
                    </div>


                    <!--                    <div class="col-lg-4">
                                        </div>-->
                </div>
                <!-- end of title row-->
                <div class="table-responsive">
                    <table class="table billtable table-bordered table-black" id="containerpros">
                        <thead>
                            <tr>
                                <th class="wdt120 myblack hidden-print" {if {$billSettingsData[59]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>الباركود</th>
                                <th class="wdt120 myblack">اسم المنتج</th>
                                <th class="wdt240 hidden-print myblack" {if $billSettingsData[7]->billsettingsvalue eq 0} {else} style="display:none !important;" {/if}>ملاحظات</th>
                                <th class="wdt100n myblack" {if {$billSettingsData[53]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>الوحدة</th>

                                <th class="wdt100n myblack" {if {$billSettingsData[64]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>العدد</th>
                                <th class="wdt100n myblack"  {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if} >{$Programsettingdata->scunitname}</th>

                                <th class="wdt100n myblack {if $usergroup->hideBillPrices == 1}hidden{/if}">السعر</th>
                                <!-- <th class="wdt100n myblack {if $usergroup->hideBillPrices == 1}hidden{/if}" {if {$billSettingsData[57]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>الخصم</th> -->
                                <th class="wdt100n myblack {if $usergroup->hideBillPrices == 1}hidden{/if}" {if {$billSettingsData[8]->billsettingsvalue} eq 1}  style="display:none"    {/if}>الخصم</th>
                                <th class="wdt100n myblack {if $usergroup->hideBillPrices == 1}hidden{/if}" {if {$billSettingsData[96]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>ضريبة</th>
                                <th class="wdt100n myblack {if $usergroup->hideBillPrices == 1}hidden{/if}">الاجمالى
                                    <input name="hidden_itr" id="hidden_itr" type="hidden" value="0" />
                                </th>

                            </tr>
                        </thead>
                        <tbody>
                            {foreach $returnbuybilldetailData as $detail}
                            <tr class="aw_td" id="newProduct1">
                                <td class="myblack {if  $detail->Parcode eq '' } hidden-print {/if}" {if {$billSettingsData[59]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>

                                    <div id="parcodeDiv1">  <p class="form-control-static">{$detail->parcode}</p> </div>


                                </td>
                                <td class="myblack" ><div id="productdiv1" class="aw_width aw_mt5">
                                        <p class="form-control-static">
                                            {$detail->productName} / {$detail->productCatName}
                                            {if {$billsettingsData[79]->billsettingsvalue} eq 0}
                                            {if isset($detail->sizeName) && $detail->sizeName !=""}/{$detail->sizeName}{/if}
                                            {if isset($detail->colorName) && $detail->colorName !=""}/{$detail->colorName}{/if}
                                            {/if}
                                        </p>

                                    </div></td>


                                <td class="myblack  {if  $detail->note eq '' } hidden-print {/if}"  {if $billSettingsData[7]->billsettingsvalue eq 0} {else} style="display:none !important;" {/if}>
                                    <p class="form-control-static">
                                        {$detail->note}
                                    </p>
                                </td>

                                <td class="myblack"  {if {$billSettingsData[53]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}><div id="unitDiv1">
                                        <p class="form-control-static">
                                            {$detail->unitName}
                                        </p>
                                    </div></td>

                                <td class="myblack"  {if {$billSettingsData[64]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                                    <p class="form-control-static">
                                        {$detail->returnbuybilldetailquantity}
                                    </p>
                                </td>
                                <td class="myblack" {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}>
                                    <p class="form-control-static"> {$detail->otherdetailquantity}</p>
                                </td>

                                <td class="myblack {if $usergroup->hideBillPrices == 1}hidden{/if}" ><div id="propricechange1">
                                        <p class="form-control-static">
                                            {$detail->returnbuybilldetailprice}
                                        </p>
                                    </div></td>


                                <!-- <td class="myblack {if $usergroup->hideBillPrices == 1}hidden{/if}"  {if $billSettingsData[57]->billsettingsvalue eq 0} {else} style="display:none !important;" {/if}>
                                    <p class="form-control-static">
                                        {$detail->discountvalue}
                                    </p>
                                </td> -->
                                <td class="check_tr_discount {if $usergroup->hideBillPrices == 1}hidden{/if}"  {if $billSettingsData[8]->billsettingsvalue eq 1} style="display:none !important;" {/if}>
                                    <p class="form-control-static">
                                        {$detail->discountvalue}
                                    </p>
                                </td>

                                <td class="myblack {if $usergroup->hideBillPrices == 1}hidden{/if}"  {if $billSettingsData[96]->billsettingsvalue eq 0} {else} style="display:none !important;" {/if}>
                                    <p class="form-control-static">
                                        {$detail->rowtaxper}%
                                    </p>
                                </td>

                                <td class="aw_totalprice myblack {if $usergroup->hideBillPrices == 1}hidden{/if}"><div id="prototal1" class="aw_mt">
                                        <p class="form-control-static">
                                            {$detail->returnbuybilldetailtotalprice}
                                        </p>
                                    </div></td>

                            </tr>
                            {/foreach}
                        </tbody>
                    </table>
                </div>
                <!--        <button type="button" class="btn btn-primary pull-left ft-nor"> إجمالي المشتريات <span class="badge wht-clo"><div id="buyBillTotal">0</div></span></button>
                -->      </div>
            <!-- end of second row-->
            <!-- =========================== END BUY BILL PANEL ==================== -->
            <div class="clearfix"></div>



            <!-- =========================== START TOTAL VALUES PANEL ======================= -->
            <div class="row">
                <div class="col-lg-9">
                </div><!-- end of calucation center-->

                <div class="col-lg-3">
                    <hr class="hidden-print"/>
                    <div class="form-group mg-bt5" {if {$billSettingsData[58]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                        <label class="col-lg-2 control-label">عدد القطع</label>
                        <div class="col-lg-2">
                            <p class="form-control-static" id="totalQty">{$countBillDetails}</p>
                        </div>
                    </div><!-- end of form-group-->
                    <!--   <div class="form-group mg-bt5" {if $billSettingsData[0]->billsettingsvalue eq 0}  {else} style="display:none !important;" {/if}>
                           <label class="col-lg-5 control-label">عدد القطع المرتجعة</label>
                           <div class="col-lg-7">
                             <p class="form-control-static" id="returnTotalQty">0</p>
                           </div>
                           </div>--><!-- end of form-group-->
                    <div class="form-group mg-bt5 {if $usergroup->hideBillPrices == 1}hidden{/if}">
                        <label class="col-lg-2 control-label">الاجمالى العام</label>
                        <div class="col-lg-2">
                            <p class="form-control-static" id="gentotal">{$returnbuybillData->returnbuybilltotalbill}</p>
                        </div>
                    </div><!-- end of form-group-->
                    <div class="form-group mg-bt5 {if $usergroup->hideBillPrices == 1}hidden{/if}" {if {$billSettingsData[57]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                        <label class="col-lg-2 control-label">نوع الخصم</label>
                        <div class="col-lg-2">
                            <p class="form-control-static">
                                {if $returnbuybillData->returnbuybilldiscountrype eq 0}
                                خصم مباشر
                                {else}
                                خصم بنسبه مئويه
                                {/if}
                            </p>

                        </div>
                    </div><!-- end of form-group-->
                    <div class="form-group mg-bt5 {if $usergroup->hideBillPrices == 1}hidden{/if}" {if {$billSettingsData[57]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                        <label class="col-lg-2 control-label">قيمة الخصم</label>
                        <div class="col-lg-2">
                            <p class="form-control-static">
                                {$returnbuybillData->returnbuybilldiscount}
                            </p>

                        </div>
                    </div><!-- end of form-group-->

                    <!------------------------------------------------------>
                    <div class="{if $usergroup->hideBillPrices == 1}hidden{/if}" {if {$billSettingsData[36]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                        <hr class="mg-tp5 mg-bt5 hidden-print"/>
                        <div class="form-group mg-bt5">
                            <label class="col-lg-2 control-label">ضريبه القيمة المضافة</label>
                            <div class="col-lg-2">
                                <label>
                                    <div class="input-group">
                                        {$returnbuybillData->payedtax} %
                                    </div>
                                    <div class="input-group" style="padding-top: 1px;">
                                        {$taxvalue}
                                        {$Programsettingdata->currancy}
                                    </div>
                                </label>
                            </div>
                        </div>


                    </div>


                    <hr class="mg-tp5 mg-bt5 hidden-print"/>
                    <div class="form-group mg-bt5 {if $usergroup->hideBillPrices == 1}hidden{/if}" {if {$billSettingsData[51]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                        <label class="col-lg-2 control-label">الصافى</label>
                        <div class="col-lg-2">
                            <p class="form-control-static" id="gen2total">{$returnbuybillData->returnbuybillaftertotalbill}</p>

                        </div>
                    </div><!-- end of form-group-->
                    <div class="form-group mg-bt5 {if $usergroup->hideBillPrices == 1}hidden{/if}" {if {$billSettingsData[54]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                        <label class="col-lg-2 control-label">المدفوع</label>
                        <div class="col-lg-2">
                            <p class="form-control-static">
                                {$returnbuybillData->returnbuybilltotalpayed}
                            </p>
                        </div>
                    </div><!-- end of form-group-->
                    <hr class="mg-tp5 mg-bt5 hidden-print"/>
                    <div class="form-group mg-bt5 bg-yel {if $usergroup->hideBillPrices == 1}hidden{/if}" {if {$billSettingsData[55]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                        <label class="col-lg-2 control-label">المتبقى</label>
                        <div class="col-lg-2">
                            <p class="form-control-static" id="gen3total">{$returnbuybillData->returnbuybillfinalbill}</p>
                        </div>
                    </div><!-- end of form-group-->
                    <div class="form-group mg-bt5 {if $usergroup->hideBillPrices == 1}hidden{/if}">
                        <label class="col-lg-2 control-label">باقى الدين</label>
                        <div class="col-lg-2">
                            <p class="form-control-static" id="gen4total">{$returnbuybillData->returnbuybilltotaldeptafter}</p>

                        </div>
                    </div><!-- end of form-group-->
                </div><!-- end of totals center-->
            </div><!-- end of fourth row-->


            <div class="row hidden-print">
                <!--                <button type="submit"  class="btn btn-primary">رجوع</button>-->
                {if {$returnbuybillData->deletedbuyid} > 0 && {$returnbuybillData->deletedbuyid} <> NULL && {$returnbuybillData->deletedbuyid} <> ''}
                <a target="_new" href="{$returnbuybillData->controlname}?do=editprint&id={$returnbuybillData->deletedbuyid}">
                    <button type="button" class="btn btn-primary">الايصال القديم</button></a>
                {/if}
                {if {$Programsettingdata->printingpapersize} eq 0}
                <a target="_new" href="buyBillprintController.php?do=returneditprint1&id={$returnbuybillData->returnbuybillid}">
                    <button type="button" class="btn btn-info">طباعه ايصال كبير</button></a>
                {/if}
                {if {$Programsettingdata->printingpapersize} eq 1}
                <a target="_new" href="buyBillprintController.php?do=returneditprint&id={$returnbuybillData->returnbuybillid}">
                    <button type="button" class="btn btn-info">طباعه ايصال</button></a>
                {/if}
            </div><!-- end of fifth row-->


            <!-- =========================== END TOTAL VALUESPANEL ====================== -->
        </form>



    </div>
</div>
