
<style>

    @media print {
        table ,tbody,thead,tr,td{

        }
        /* th{
            font-size : 30px;
            font-family:  "Helvetica Neue", Helvetica, sans-serif;
        } */
        .col-lg-4
        {

            padding-top:50px !important;
        }

        .panel-heading{
            /* padding-top:30px !important; */
            text-align: center;
            font-weight: bold;
            font-size: 16px;
        }

        .panel-heading2{
            /* padding-top:30px !important; */
            text-align: center;
            text-align: center;
            font-weight: bold;
            font-size: 16px;
        }

        .panel-heading3{
            /* padding-top:30px !important; */
            text-align: center;
            text-align: center;
            font-weight: bold;
            font-size: 16px;
        }
        .clientraw{
            padding-top:30px !important;
            padding-bottom:20px !important;

        }

    }

    .collapsebtn,
    .collapsegovernment{
        float: left;
        margin-top: -4px;
        height: 24px;
    }
    .icon{
        text-align: center;
        margin-bottom: 3px;
        padding-left: 1px;
    }

    .collapsegovernmentbtn{
        float: left;
        margin-top: -5px;
    }

    .nodata{
        background-color: #72B4EC;
        color: white;
        border-radius: 13px;
        margin: 14px;
        font-size: 24px;
        text-align: center;
        padding: 5px;
    }

    .panel-heading2 {
        padding: 5px 15px;
        margin: -15px -15px 15px;
        background-color: rgba(209, 239, 196, 0.58);
        border-bottom: 1px solid #ddd;
        border-top-right-radius: 3px;
        border-top-left-radius: 3px;
    }

    .panel-heading3 {
        padding: 5px 15px;
        /* margin: -15px -15px 15px; */
        background-color: rgb(178, 199, 169);
        border-bottom: 1px solid #ddd;
        border-top-right-radius: 3px;
        border-top-left-radius: 3px;
    }
    .allarearesult{

    }

</style>
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">التقارير</a></li>
            <li class="active">تقارير العملاء بالمناطق / الشركات </li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading">  تقارير العملاء بالمناطق / الشركات 
                بتاريخ: {$today}
                {if $message != ""}
                {$message}
                {/if}
                <a href="{$youtubes[130]->url}" target="_blank" class="hidden-print"><img src="../views/default/assets/img/youtube.png" class="pull-left" alt="Youtube" style="width: 2%;"></a>
            </div>
            <div class="panel-body">
                <form class="form-inline hidden-print" action="clientReportsbyareaController.php?do=allbyclientarea" method="post">
                    <div class="form-group">
                        <label class="sr-only">المحافظة</label>
                        <select class="select2 wdt300"  name="governmentid" id="governmentid" >
                            <option value="-1">اختر المحافظة</option>
                            <option value="-2"> كل المحافظات</option>
                            {foreach $governmentData as $government}
                            <option value="{$government->governmetid}">{$government->governmentname}</option>
                            {/foreach}
                        </select>
                    </div>
                    <div class="form-group areadiv" style="display: none;">
                        <label class="sr-only">المنطقه</label>
                        <select class="select2 wdt300"  name="clientareaid" id="clientareaid" >
                            <option value="-1">اختر منطقه</option>
                            {foreach $allclientareadrop as $myallclientareadrop}
                            <option value="{$myallclientareadrop->id}">{$myallclientareadrop->name}</option>
                            {/foreach}
                        </select>
                    </div>
                    <div class="form-group">
                        <label class="sr-only">إظهار المدين فقط</label>
                        <input type="checkbox" name="showDebit" id="bure" value="1" />
                        <label for="bure"></label>
                    </div>
                    <br>
                    <div class="form-group">
                        <label class="sr-only">من التاريخ</label>
                        <input type="text" class="form-control awdatepicker" autocomplete="off"   data-date-format="yyyy-mm-dd" name="from" >
                    </div>
                    <div class="form-group">
                        <label class="sr-only">إلى التاريخ</label>
                        <input type="text" class="form-control awdatepicker" autocomplete="off"   data-date-format="yyyy-mm-dd" name="to" >
                    </div>
                    <div class="form-group" style="padding-right: 20px;">
                        <label class="sr-only">تاريخ البحث</label><br>
                        <label>  <input value="sysDate" name="searchDate" type="radio" checked>
                            تاريخ السيستم</label>
                        <label>  <input value="userSelectedDate" name="searchDate" type="radio" >
                            تاريخ المستخدم</label>
                    </div>
                    <button type="submit" class="btn btn-primary">بحث</button>
                </form>
                <hr/>
                <div  id="tableWrap">
                    {assign var=b value=1}
                    {foreach $governmentData as $government}
                    {foreach $content_arr as $governiddata}
                    {if $governiddata  eq $government->governmetid}
                    <div class="col-lg-12 ">
                        <div class="panel panel-default panel-m">
                            <div class="panel-heading2 ">  المحافظة {$government->governmentname}</div>
                                <table class="table dataTable table-black">
                                    <thead>
                                        <tr>
                                            <th> اجمالى المبيعات </th>
                                            <th>  اجمالى الخصومات</th>
                                            <th>  اجمالى صافى المبيعات</th>
                                            <th> اجمالى المدفوعات</th>
                                            <th>   اجمالى مديونية العملاء</th>
                                        </tr>
                                    </thead>
                                    <tbody >
                                        <tr>
                                           
                                            <td style='padding-right: 50px;'>{$myTotalbillSumGovernment[$government->governmetid]}</td>
                                            <td style='padding-right: 50px;'>{$myDiscountSumGovernment[$government->governmetid]} </td>
                                            <td style='padding-right: 50px;'>{$myGenSumGovernment[$government->governmetid]} </td>
                                            <td style='padding-right: 50px;'>{$myPaySumSumGovernment[$government->governmetid]}</td>
                                            <td style='padding-right: 50px;'>{$sumDept[$government->governmetid]}</td>
                                        </tr>
                                    </tbody>
                                </table>
                                <button data-itra="{$b}" class="hidden-print collapsegovernmentbtn btn btn-success"><span id="icon" class="glyphicon glyphicon-minus icon"></span></button></div>
                            <div class="panel-body container_div_{$b}" >
                                {assign var=k value=1}
                                {foreach $allclientareadrop as $clintarea}
                                {foreach $dataSelected as $goverarea}
                                {if $goverarea->clientareaid eq $clintarea->id && $goverarea->governmentid  eq $governiddata}
                                <div class=" governmentDiv">
                                    <div class="panel panel-default panel-m">
                                        <!-- Default panel contents -->
                                        <div class="panel-heading "> عملاء منطقه   {$clintarea->name}
                                            <table class="table table-black dataTableClass">
                                                <thead>
                                                    <tr>
                                                        <th> اجمالى المبيعات </th>
                                                        <th> اجمالى الخصومات</th>
                                                        <th> اجمالى صافى المبيعات</th>
                                                        <th> المدفوعات</th>
                                                        <th>  اجمالى مديونية العملاء</th>
                                                    </tr>
                                                </thead>
                                                <tbody >
                                                    <tr>
                                                       
                                                        <td style='padding-right: 50px;'>{$sumAllAreas[$clintarea->id]}</td>
                                                        <td style='padding-right: 50px;'>{$myDiscountSumAllAreas[$clintarea->id]}  </td>
                                                        <td style='padding-right: 50px;'>{$myGenSumAllAreas[$clintarea->id]} </td>
                                                        <td style='padding-right: 50px;'>{$myPaySumAllAreas[$clintarea->id]}</td>
                                                        <td style='padding-right: 50px;'>{$clientdebtAllAreas[$clintarea->id]}</td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                            <button data-itra="{$k}" class="hidden-print collapsebtn btn btn-success"><span id="icon" class="glyphicon glyphicon-minus icon"></span></button></div>
                                        <div class="panel-body main_div_{$k} clientraw" >
                                            <table class="table table-black dataTableClass">
                                                <thead>
                                                    <tr>
                                                        <th>اسم العميل</th>
                                                        <th> المبيعات</th>
                                                        <th> الخصومات</th>
                                                        <th>صافى المبيعات</th>

                                                        <th>المدفوعات</th>
                                                        <th>تاريخ آخر عملية</th>
                                                        <th> مديونية العميل</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    {foreach $clientShowData1 as $data}
                                                    {if $data->clientareaid eq $clintarea->id}
                                                    <tr>
                                                        <td>{$data->clientname} / {$data->clientareaName} </td>
                                                        <td> {$data->myTotalbillSum} </td>
                                                        <td> {$data->myDiscountSum} </td>
                                                        <td> {$data->myGenSum} </td>
                                                        <td>{$data->myPaySum}</td>
                                                        <td>{$data->lastdate}</td>
                                                        <td>{$data->clientdebt}</td>
                                                    </tr>
                                                    {/if}
                                                    {/foreach}
                                                </tbody>
                                            </table>
                                        </div>
                                        <!--panel-body-->
                                    </div>
                                    <!--panel panel-default-->
                                </div>
                                {/if}
                                {capture assign=k}{$k+1}{/capture}
                                {/foreach}
                                {/foreach}
                            </div>
                        </div><!--col-lg-4-->
                    </div><!--col-lg-4-->
                    {/if}
                    {capture assign=b}{$b+1}{/capture}
                    {/foreach}
                    {/foreach}



                    <div class="">
                        <div class="panel panel-default panel-m">
                            <!-- Default panel contents -->
                            <div class="panel-heading3"> الاجمالى العام</div>
                            <div class="panel-body">
                                <table class="table table-black">
                                    <thead>
                                        <tr>
                                            <td></td><td></td>
                                            <th> اجمالى المبيعات </th>
                                            <th> اجمالى الخصومات</th>
                                            <th> اجمالى صافى المبيعات</th>
                                            <th>اجمالى المدفوعات</th>
                                            <th>  اجمالى مديونية العملاء</th>
                                        </tr>
                                    </thead>
                                    <tbody >
                                        <tr>
                                            <td> </td>
                                            <td> </td>
                                            <td style='padding-right: 50px;'>{$totalmyTotalbill}</td>
                                            <td style='padding-right: 50px;'>{$totalmyDiscount} </td>
                                            <td style='padding-right: 50px;'>{$totalmyGenSum} </td>
                                            <td style='padding-right: 50px;'>{$totalmyPaySum}</td>
                                            <td style='padding-right: 50px;'>{$totalsumDept}</td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                            <!--panel-body-->
                        </div>
                        <!--panel panel-default-->
                    </div>
                    <!--col-lg-4-->
                    <!--**********************************************************************-->

                </div><!--col-lg-4-->
                <div class="clearfix"></div>
                <hr />
                <div  class="hidden-print">
                    <div class="col-lg-12">
                        <div class="form-group">
                            <div class="col-lg-4">
                                <button type="button" onClick="print_Custom('mycustomheader');" class="btn btn-success pull-right">طباعة</button>

                                <script type="text/javascript">
                                    var x = document.getElementById("tableWrap").innerHTML;
                                    $(document).ready(function (e) {

                                        document.getElementById("data").value = x;

                                    });
                                </script>
                                <form name="jazx" id="excel" action="http://localhost/newexcel/untitled.php" method="post">
                                    <input type="hidden" name="data" id="data"/>
                                    <!--<br /> <input type="submit" name="button" id="button" class="btn btn-success pull-right" value="ملف اكسل" /></form>-->
                            </div>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>
                <div class="clearfix"></div>
            </div>
        </div>
    </div>
</div>
