static function graph()
    {
        $bulan = addslashes($_GET['m']);
        if ($bulan == "") {
            $bulan = date("F Y");
            $days_ago = date('Y-m-01');
            // hard-coded '01' for first day
            $days_now = date('Y-m-t');
        } else {
            $bulan = urldecode($bulan);
            $days_ago = date('Y-m-01', strtotime($bulan));
            // hard-coded '01' for first day
            $days_now = date('Y-m-t', strtotime($bulan));
        }
        $numberDays = cal_days_in_month(CAL_GREGORIAN, date('n', strtotime($bulan)), date('Y', strtotime($bulan)));
        $days_ago = date('Y-m-01', strtotime($bulan));
        // hard-coded '01' for first day
        $days_now = date('Y-m-01', strtotime('+1 month', strtotime($bulan)));
        //user acquisitions
        $ll = new MTranDetail();
        $arrUserNew = $ll->getWhere("(detail_date BETWEEN '{$days_ago}' AND '{$days_now}')");
        //    //new device
        //    $dev = new DeviceModel();
        //    $arrDevNew = $dev->getWhere(" (firstlogin BETWEEN '$days_ago' AND '$days_now') ");
        //
        //    //device active
        //    $dlog = new DeviceLogger();
        //    global $db;
        //    $q ="SELECT DISTINCT log_dev_id FROM {$dlog->table_name} WHERE (log_date BETWEEN '$days_ago' AND '$days_now')";
        ////        $arrDevActive = $db->query($q,2);
        //    $arrDevActive = $dlog->getWhere(" (log_date BETWEEN '$days_ago' AND '$days_now') ");
        //
        ////        count($arrDevActive);
        //    //user active
        //
        //    $acclog = new LL_AccountLogger();
        //    $q ="SELECT DISTINCT log_acc_id	 FROM {$acclog->table_name} WHERE (log_date BETWEEN '$days_ago' AND '$days_now')";
        ////        $arrUserActive= $db->query($q,2);
        //    $arrUserActive = $acclog->getWhere("(log_date BETWEEN '$days_ago' AND '$days_now')");
        //        count($arrUserActive);
        $arrStats["Orders"] = $arrUserNew;
        //    $arrStats["Active Users"] = $arrUserActive;
        //    $arrStats["New Devices"] = $arrDevNew;
        //    $arrStats["Active Devices"] = $arrDevActive;
        $t = time();
        $mtrans = new MTranDetail();
        global $db;
        $q = "SELECT SUM(detail_price_total) as total, COUNT(*) AS num FROM {$mtrans->table_name}";
        $arrSales = $db->query($q, 1);
        ?>


            <div class="box-header with-border">
                <h3 class="box-title">Monthly Recap Report</h3>

                <div class="box-tools pull-right">
                    <?php 
        $start = new DateTime('11 months ago');
        // So you don't skip February if today is day the 29th, 30th, or 31st
        $start->modify('first day of this month');
        $end = new DateTime();
        $interval = new DateInterval('P1M');
        $period = new DatePeriod($start, $interval, $end);
        ?>
                    <select id="apptimeselector_<?php 
        echo $t;
        ?>
">
                        <?php 
        foreach ($period as $dt) {
            ?>
                            <option value="<?php 
            echo urlencode($dt->format('F Y'));
            ?>
" <?php 
            if ($dt->format('F Y') == $bulan) {
                echo "selected";
            }
            ?>
>
                                <?php 
            echo $dt->format('F Y') . "<br>";
            ?>
                            </option>
                        <?php 
        }
        ?>

                    </select>
                    <script>
                        $("#apptimeselector_<?php 
        echo $t;
        ?>
").change(function(){
                            var slc = $("#apptimeselector_<?php 
        echo $t;
        ?>
").val();
                            openLw("App","<?php 
        echo _SPPATH;
        ?>
Mdashboard/main?m="+slc,"fade");
                        });
                    </script>
                </div>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
                <div class="row">
                    <div class="col-md-8">
                        <p class="text-center">
                            <strong>Sales: <?php 
        echo $bulan;
        ?>
</strong>
                        </p>

                        <div class="chart">
                            <!-- Sales Chart Canvas -->
                            <?php 
        $data = self::getAppStats($arrStats, $days_ago, $days_now);
        ?>
                        </div>
                        <!-- /.chart-responsive -->
                    </div>
                    <!-- /.col -->
                    <div class="col-md-4">
                        <p class="text-center">
                            <strong>Goal Completion</strong>
                        </p>

                        <div class="progress-group">
                            <span class="progress-text">Add Products to Cart</span>
                            <span class="progress-number"><b>160</b>/200</span>

                            <div class="progress sm">
                                <div class="progress-bar progress-bar-aqua" style="width: 80%"></div>
                            </div>
                        </div>
                        <!-- /.progress-group -->
                        <div class="progress-group">
                            <span class="progress-text">Complete Purchase</span>
                            <span class="progress-number"><b>310</b>/400</span>

                            <div class="progress sm">
                                <div class="progress-bar progress-bar-red" style="width: 80%"></div>
                            </div>
                        </div>
                        <!-- /.progress-group -->
                        <div class="progress-group">
                            <span class="progress-text">Visit Premium Page</span>
                            <span class="progress-number"><b>480</b>/800</span>

                            <div class="progress sm">
                                <div class="progress-bar progress-bar-green" style="width: 80%"></div>
                            </div>
                        </div>
                        <!-- /.progress-group -->
                        <div class="progress-group">
                            <span class="progress-text">Send Inquiries</span>
                            <span class="progress-number"><b>250</b>/500</span>

                            <div class="progress sm">
                                <div class="progress-bar progress-bar-yellow" style="width: 80%"></div>
                            </div>
                        </div>
                        <!-- /.progress-group -->
                    </div>
                    <!-- /.col -->
                </div>
                <!-- /.row -->
            </div>
            <!-- ./box-body -->
            <div class="box-footer">
                <div class="row">
                    <div class="col-sm-3 col-xs-6">
                        <div class="description-block border-right">
                            <span class="description-percentage text-green"><i class="fa fa-caret-up"></i> 17%</span>
                            <h5 class="description-header">IDR <?php 
        echo idr($arrSales->total);
        ?>
</h5>
                            <span class="description-text">TOTAL REVENUE</span>
                        </div>
                        <!-- /.description-block -->
                    </div>
                    <!-- /.col -->
                    <div class="col-sm-3 col-xs-6">
                        <div class="description-block border-right">
                            <span class="description-percentage text-yellow"><i class="fa fa-caret-left"></i> 0%</span>
                            <h5 class="description-header">IDR <?php 
        echo idr($arrSales->total / $arrSales->num);
        ?>
</h5>
                            <span class="description-text">AVERAGE ORDER</span>
                        </div>
                        <!-- /.description-block -->
                    </div>
                    <!-- /.col -->
                    <div class="col-sm-3 col-xs-6">
                        <div class="description-block border-right">
                            <span class="description-percentage text-green"><i class="fa fa-caret-up"></i> 20%</span>
                            <h5 class="description-header">$24,813.53</h5>
                            <span class="description-text">MONTHLY REVENUE</span>
                        </div>
                        <!-- /.description-block -->
                    </div>
                    <!-- /.col -->
                    <div class="col-sm-3 col-xs-6">
                        <div class="description-block">
                            <span class="description-percentage text-red"><i class="fa fa-caret-down"></i> 18%</span>
                            <h5 class="description-header">1200</h5>
                            <span class="description-text">MONTHLY ATV</span>
                        </div>
                        <!-- /.description-block -->
                    </div>
                </div>
                <!-- /.row -->
            </div>
            <!-- /.box-footer -->




    <style>
        ul.legend li{
            list-style: none;
            line-height: 30px;
        }
        ul.legend li div{
            float: left;
            margin-top: 10px;
            margin-right: 15px;
        }
        .legend-item{
            float: left;
            margin: 10px;
            line-height: 30px;
            margin-right: 5px;
        }
        .legend-item div{
            float: left;
            margin-top: 10px;
            margin-right: 5px;
        }
        .breadcrumb {
            padding: 8px 15px;
            margin-bottom: 20px;
            list-style: none;
            background-color: #f5f5f5;
            border-radius: 4px;
        }
        .breadcrumb {
            float: right;
            background: transparent;
            margin-top: 0;
            margin-bottom: 0;
            font-size: 12px;
            padding: 7px 5px;
            position: absolute;
            top: 15px;
            right: 10px;
            border-radius: 2px;
        }
        .description-block>.description-header{
            font-size: 25px;
        }
    </style>

<?php 
    }
Пример #2
0
  <th><?php 
echo idr($tot['t_beli']);
?>
</th>
  <th></th>
  <th><?php 
echo idr($tot['t_jualreal']);
?>
</th>
  <th><?php 
echo idr($tot['t_diskon']);
?>
</th>
  <th></th>
  <th><?php 
echo idr($tot['t_jual']);
?>
</th>
  <th><?php 
echo idr($tot['t_untung']);
?>
</th>
  <th></th>
  </tr>
</table>
</div>
<br/><br/>
<hr size="4" color="#000000" />
(s) : satuan
</body>
</html>
Пример #3
0
            $no++;
        }
        $total = yposSQL('SHOW', 'ypos_penjualandtl', 'DISTINCT SUM(qty) AS t_qty, SUM(harga_jual) AS t_harga', "kd_penjualan='{$kode}' && 1=1")->fetch_array();
        ?>
    <tr>
    <td colspan="3" align="center">Sub Total</td>
    <td align="center"><?php 
        echo @$total['t_qty'];
        ?>
</td>
    <td align="right"><?php 
        echo idr(@$total['t_harga']);
        ?>
</td>
    <td align="right"><?php 
        echo idr(@$ed['sttl']);
        ?>
</td>
    <td></td>
  </tr>
  <tr>
    <td colspan="6" align="center"></td>
    <td align="center">
    <a href="#dialog-proses" id="<?php 
        echo $ed['kode'];
        ?>
" class="proses" data-toggle="modal"><img src="images/proses.png" border="0"/></a>
    </td>
  </tr>
</table>
<!-- awal untuk modal dialog -->
Пример #4
0
    function revenue()
    {
        $vp = new VpTransaction();
        global $db;
        $q = "SELECT SUM(order_value) as total FROM {$vp->table_name} WHERE order_status = '1'  OR order_status = '2'";
        $arrRev = $db->query($q, 1);
        $mon = isset($_GET['mon']) ? addslashes($_GET['mon']) : date("n");
        //        pr($arrRev);
        ?>
        <h1>Total Revenue</h1>
        <h1>IDR <?php 
        echo idr($arrRev->total);
        ?>
</h1>

        Month : <select id="mon_m">
            <?php 
        for ($x = 1; $x < 13; $x++) {
            ?>
                <option <?php 
            if ($mon == $x) {
                echo "selected";
            }
            ?>
 value="<?php 
            echo $x;
            ?>
"><?php 
            echo $x;
            ?>
</option>
            <?php 
        }
        ?>
        </select>


        <button id="change_m" class="btn btn-default">Change Month</button>
        <script>
            $('#change_m').click(function(){

                openLw("Revenue",'<?php 
        echo _SPPATH;
        ?>
FinanceBE/revenue?mon='+$('#mon_m').val(),'fade');
            });
        </script>

        <?php 
        $q = "select SUM(order_value) as total from {$vp->table_name} where month(order_date) = " . $mon . " AND (order_status = '1'  OR order_status = '2')";
        $arrRev = $db->query($q, 1);
        ?>
        <hr>
        <h2>Revenue This Month</h2>
        <h2>IDR <?php 
        echo idr($arrRev->total);
        ?>
</h2>
        <?php 
        $arrs = $vp->getWhere("month(order_date) = " . $mon . " AND (order_status = '1'  OR order_status = '2')");
        //        pr($arrs);
        ?>
        <div class="table-responsive">
            <table class="table">
                <thead>
                    <tr>
                        <th>order_id</th>
                        <th>order_app_id</th>
                        <th>order_acc_id</th>
                        <th>order_date</th>
                        <th>order_value</th>
                        <th>order_paket_id</th>
                        <th>order_status</th>
                        <th>order_message</th>
                        <th>order_status_from</th>
                    </tr>
                </thead>
                <tbody>
                <?php 
        foreach ($arrs as $vp) {
            ?>
                    <tr>
                        <td><?php 
            echo $vp->order_id;
            ?>
</td>
                        <td><?php 
            echo $vp->order_app_id;
            ?>
</td>
                        <td><?php 
            echo $vp->order_acc_id;
            ?>
</td>
                        <td><?php 
            echo $vp->order_date;
            ?>
</td>
                        <td><?php 
            echo $vp->order_value;
            ?>
</td>
                        <td><?php 
            echo $vp->order_paket_id;
            ?>
</td>
                        <td><?php 
            echo $vp->order_status;
            ?>
</td>
                        <td><?php 
            echo $vp->order_message;
            ?>
</td>
                        <td><?php 
            echo $vp->order_status_from;
            ?>
</td>
                    </tr>
                    <?php 
        }
        ?>
                </tbody>
            </table>
        </div>
        <?php 
    }
    function payfor()
    {
        $id = addslashes($_GET['app_id']);
        $acc = new App2Acc();
        $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id AND ac_app_id = '{$id}' ", array("AppAccount"));
        if (count($apps) < 1) {
            die("hacking attempt");
        } else {
            $app = $apps[0];
        }
        $paket = new Paket();
        $paket->getByID($app->app_paket_id);
        ?>
        <div class="container attop" style="text-align: center;" >
            <div class="col-md-8 col-md-offset-2">
                <h4 style="margin-bottom: 0px; padding-bottom: 0px;" class="hype">Payment For</h4>
                <h1 class="hype" style="margin-bottom: 20px; margin-top: 10px;"><?php 
        echo $app->app_name;
        ?>
</h1>
                <h1 style="background-color: #efefef; padding: 10px; margin: 10px;" class="hype">Total : Rp.<?php 
        echo idr($paket->paket_price * 12);
        ?>
 </h1>
                <small><a href="">upgrade package</a></small>
                <h3 style="margin-top: 50px;" class="hype">Please Choose Payment Method to complete App Registration</h3>

                <a href="<?php 
        echo _SPPATH;
        ?>
VeritransPay/pay?app_id=<?php 
        echo $app->app_id;
        ?>
" style="width: 100%; margin: 5px;" class="btn btn-info btn-lg">Pay with Veritrans (Credit Card, ATM, Klikpay, dll)</a>
                 <a href="javascript:$('#cc').fadeToggle();" style="width: 100%; margin: 5px;" class="btn btn-info btn-lg">Credit card</a>
                <div id="cc" style="display: none; background-color: #efefef; padding: 30px; ">

                    <form accept-charset="UTF-8"  autocomplete="off" class="form-horizontal" role="form"  id="new_cc" method="post" novalidate="novalidate">

                        <input type="hidden" name="appprice" value="<?php 
        echo ceil($paket->paket_price * 12 / 14000);
        ?>
">
                        <input type="hidden" name="appdescr" value="Payment StageCom Paket <?php 
        echo $paket->paket_name;
        ?>
 ID : <?php 
        echo $app->app_id;
        ?>
">
                        <input type="hidden" name="appid" value="<?php 
        echo $app->app_id;
        ?>
">
                        <div style="margin:0;padding:0;display:inline">
                            <input name="utf8" type="hidden" value="&#x2713;" />
                            <input name="authenticity_token" type="hidden" value="vpVuNuIt9fRZzLm0eE0gk4h249k0nZPB/WEXWn9ETwg=" />
                        </div>


                        <p>Your credit card information is stored safely with PayPal.</p>
                        <div class="form-group">
                            <label class="control-label col-sm-4" for="user_credit_card_name">
                                <abbr title="required">*</abbr> Name</label>
                            <div class="col-sm-8">
                                <input class="form-control" id="user_credit_card_name" name="user[credit_card][name]" size="150" type="text" value="<?php 
        echo Account::getMyName();
        ?>
" />

                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-4" for="user_credit_card_type">
                                <abbr title="required">*</abbr> Type</label>
                            <div class="col-sm-8">
                                <select class="form-control" id="user_credit_card_type" name="user[credit_card][type]">
                                    <option value=""></option>
                                    <option value="visa" selected>visa</option>
                                    <option value="mastercard">mastercard</option>
                                    <option value="discover">discover</option>
                                    <option value="amex">amex</option>
                                </select>
                            </div>
                        </div>


                        <div class="form-group">
                            <label class="control-label col-sm-4" for="user_credit_card_number">
                                <abbr title="required">*</abbr> Number</label>
                            <div class="col-sm-8">
                                <input class="form-control" id="user_credit_card_number" name="user[credit_card][number]" size="50" type="text" value="4417119669820331" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-4"  for="user_credit_card_cvv2">Cvv2</label>
                            <div class="col-sm-8">
                                <input class="form-control" id="user_credit_card_cvv2" name="user[credit_card][cvv2]" size="50" type="text" value="012" /></div></div>
                        <div class="form-group">
                            <label class="control-label col-sm-4" class="select required control-label" for="user_credit_card_expire_month"><abbr title="required">*</abbr> Expire month</label>

                            <div class="col-sm-8">
                                <select class="form-control" id="user_credit_card_expire_month" name="user[credit_card][expire_month]">
                                    <option value=""></option>
                                    <option value="1">1</option>
                                    <option value="2">2</option>
                                    <option value="3">3</option>
                                    <option value="4">4</option>
                                    <option value="5">5</option>
                                    <option value="6">6</option>
                                    <option value="7">7</option>
                                    <option value="8">8</option>
                                    <option value="9">9</option>
                                    <option value="10">10</option>
                                    <option selected value="11">11</option>
                                    <option value="12">12</option></select></div></div>
                        <div class="form-group">
                            <label class="control-label col-sm-4" for="user_credit_card_expire_year">
                                <abbr title="required">*</abbr> Expire year</label>

                            <div class="col-sm-8">
                                <select class="form-control"  id="user_credit_card_expire_year" name="user[credit_card][expire_year]"><option value=""></option>
                                    <option value="2013">2013</option>
                                    <option value="2014">2014</option>
                                    <option value="2015">2015</option>
                                    <option value="2016">2016</option>
                                    <option value="2017">2017</option>
                                    <option value="2018">2018</option>
                                    <option selected value="2019">2019</option>
                                    <option value="2020">2020</option>
                                    <option value="2021">2021</option>
                                    <option value="2022">2022</option>
                                    <option value="2023">2023</option></select></div></div>
                        <div class='form-actions'>
                            <input class="btn btn btn-primary" name="commit" type="button" id="add_cc" value="Add CC" />
                            <input class="btn btn btn-primary" name="commit" type="submit" value="Pay" />
                        </div>
                    </form>
                    <script>
                        $( "#add_cc" ).click(function( event ) {

                            $(".err").hide();


                            var $form = $("#new_cc");
                            var url = "<?php 
        echo _SPPATH;
        ?>
PaypalWeb/addCard";

                            $(".err").hide();

                            // Send the data using post
                            var posting = $.post(url, $form.serialize(), function (data) {
                                console.log(data);
                                alert(data);
//                                if (data.bool) {
//                                    //kalau success masuk ke check your email....
//                                    document.location = "<?php 
        //=_SPPATH;
        ?>
//PaypalWeb/confirm?app_id="+data.app_id;
//                                }
//                                else {
//                                    if(data.all!="") {
//                                        $("#resultajax").show();
//                                        $("#resultajax").html(data.all);
//                                    }
//                                    var obj = data.err;
//                                    var tim = data.timeId;
//                                    //console.log( obj );
//                                    for (var property in obj) {
//                                        if (obj.hasOwnProperty(property)) {
//                                            $( "#"+property ).css( "border-color", "red");
//                                            $( "#"+property ).next(".err").css( "color", "red").show().empty().append(obj[property]).fadeIn('slow');
//                                        }
//                                    }
//                                }
                            });




                            event.preventDefault();
                        });

                        $( "#new_cc" ).submit(function( event ) {

                            $(".err").hide();


                            var $form = $(this);
                            var url = "<?php 
        echo _SPPATH;
        ?>
PaypalWeb/placeOrder";

                            $(".err").hide();

                            $(".se-pre-con2").fadeIn("slow");
                            // Send the data using post
                            var posting = $.post(url, $form.serialize(), function (data) {
                                console.log(data);

                                $(".se-pre-con2").fadeOut("slow");

                                if(data.paystate){
                                    document.location = "<?php 
        echo _SPPATH;
        ?>
myOrders";
                                }else{
                                    alert(data.err);
                                }
//                                if (data.bool) {
//                                    //kalau success masuk ke check your email....
//                                    document.location = "<?php 
        //=_SPPATH;
        ?>
//PaypalWeb/confirm?app_id="+data.app_id;
//                                }
//                                else {
//                                    if(data.all!="") {
//                                        $("#resultajax").show();
//                                        $("#resultajax").html(data.all);
//                                    }
//                                    var obj = data.err;
//                                    var tim = data.timeId;
//                                    //console.log( obj );
//                                    for (var property in obj) {
//                                        if (obj.hasOwnProperty(property)) {
//                                            $( "#"+property ).css( "border-color", "red");
//                                            $( "#"+property ).next(".err").css( "color", "red").show().empty().append(obj[property]).fadeIn('slow');
//                                        }
//                                    }
//                                }
                            }, 'json');




                            event.preventDefault();
                        });
                    </script>

                </div>
<!--                <a href="" style="width: 100%; margin: 5px;" class="btn btn-info btn-lg">Paypal</a>-->

                <a href="javascript:$('#banktt').fadeToggle();" style="width: 100%; margin: 5px;" class="btn btn-info btn-lg">Bank Transfer</a>

                <div id="banktt" style="display: none; background-color: #efefef; padding: 30px; text-align: left; ">
                Silahkan melakukan pembayaran melalui
                    <ul>
                        <li>
                            <b>Bank BCA</b>
                            <p>
                                a/n PT Indo Mega Byte<br>
                                no Rek : 82018912812<br>
                                App ID : <?php 
        echo $app->app_id;
        ?>
 <br>
                                keterangan : <i>Payment Stagecom App ID : <?php 
        echo $app->app_id;
        ?>
</i>

                            </p>


                        </li>
                        <li>
                            <b>Bank Permata</b>
                            <p>
                                a/n PT Indo Mega Byte<br>
                                no Rek : 82018912812<br>
                                App ID : <?php 
        echo $app->app_id;
        ?>
 <br>
                                keterangan : <i>Payment Stagecom App ID : <?php 
        echo $app->app_id;
        ?>
</i>

                            </p>


                        </li>
                    </ul>
                    <p>
                        Setelah melakukan pembayaran, jangan lupa untuk melakukan <a href="<?php 
        echo _SPPATH;
        ?>
PaymentWeb/confirmpayment?app_id=<?php 
        echo $app->app_id;
        ?>
" >konfirmasi pembayaran</a>.
                    </p>
                    </div>
                <br><br> Atau jika anda sudah melakukan pembayaran melalui bank transfer
                <a href="<?php 
        echo _SPPATH;
        ?>
PaymentWeb/confirmpayment?app_id=<?php 
        echo $app->app_id;
        ?>
" class="btn btn-success">confirm payment</a>
            </div>
        </div>
<style>
    #banktt ul{
        padding: 0px;
        margin: 0px;
    }
    #banktt ul li{
        padding: 0px;
        margin: 0px;
        margin-top: 20px;
    }
</style>
    <?php 
    }
    function receipt()
    {
        $order_id = addslashes($_GET['order_id']);
        $order = new VpTransaction();
        $order->getByID($order_id);
        //        pr($order);
        //TODO : harus dibikin
        if ($order->order_acc_id != Account::getMyID() && !in_array("master_admin", Account::getMyRoles())) {
            die("hacking attempt");
        }
        $app = new AppAccount();
        $app->getByID($order->order_app_id);
        if ($app->app_active == 0) {
            die("App not active");
        }
        $acc = new Account();
        $acc->getByID($app->app_client_id);
        $paket = new Paket();
        $paket->getByID($order->order_paket_id);
        $vpData = new VpData();
        $arr = $vpData->getWhere("order_id = '{$order_id}' LIMIT 0,1");
        if (count($arr) > 0) {
            $data = $arr[0];
        } else {
            $data = new VpData();
        }
        if ($acc->admin_marketer != "") {
            $arrAg = $acc->getWhere("admin_username = '******' LIMIT 0,1");
            if (count($arrAg) > 0) {
                $agent = $arrAg[0];
            }
        }
        //        pr($arr);
        ?>
        <style>
            h1{
                font-size: 25px;
                padding-top: 30px;
            }
            h3{
                font-size: 20px;
                font-style: italic;
            }
            h4{
                font-size: 17px;
                margin-top: 20px;
                margin-bottom: 30px;
            }
            .billings td{
                padding-right: 20px;
                padding-bottom: 10px;
            }
            @media (max-width: 768px) {

                .monly {
                    display: initial;
                }

                .donly {
                    display: none;
                }

                h1{
                    font-size: 20px;
                }
                h3{
                    font-size: 17px;
                    font-style: italic;
                }
                h4{
                    font-size: 14px;
                    margin-bottom: 30px;
                }
                .billings td{
                    padding-bottom: 10px;
                }
            }

            @media (min-width: 768px) {
                .monly {
                    display: none;
                }

                .donly {
                    display: initial;
                }



            }
            @media print {
                .pure-toggle-label[data-toggle-label='left']{
                    display: none;
                }
                #printme{
                    display: none;
                }
                body{
                    background-color: #ffffff;
                }
            }
        </style>
        <div class="container attop"  >
                <div class="col-md-8 col-md-offset-2">


                    <div style="text-align: center; background-color: #ffffff; padding: 20px; min-height: 800px;  margin-top: 20px; padding-top: 20px; padding-bottom: 20px; ">
                        <img src="<?php 
        echo _SPPATH;
        ?>
images/header_appear.jpg" width="100%">

                        <h1>PAYMENT RECEIPT</h1>
                        <h3>Your payment has been completed successfully</h3>
                        <div class="receipt" style=" margin-top: 30px;">
                        <h4>TRANSACTION DETAILS</h4>
                        <table class="billings" align="center" style="text-align: left;">
                            <tr>
                                <td>ORDER ID</td>
                                <td><?php 
        echo $order_id;
        ?>
</td>
                            </tr>
                            <tr>
                                <td>PAYMENT DATE / TIME</td>
                                <td><?php 
        echo date("F j, Y, g:i a", strtotime($order->order_date));
        ?>
</td>
                            </tr>
                            <tr>
                                <td>PACKAGE NAME</td>
                                <td><?php 
        echo $paket->paket_name;
        ?>
</td>
                            </tr>
                            <tr>
                                <td>APP ID</td>
                                <td><?php 
        echo $app->app_id;
        ?>
</td>
                            </tr>
                            <tr>
                                <td>ACCOUNT ID</td>
                                <td><?php 
        echo $acc->admin_nama_depan;
        ?>
</td>
                            </tr>
                            <tr>
                                <td>AMOUNT</td>
                                <td>IDR <?php 
        echo idr($paket->paket_price);
        ?>
</td>
                            </tr>
                            <tr>
                                <td>STATUS</td>
                                <td><?php 
        echo $data->transaction_status;
        ?>
</td>
                            </tr>
                            <tr>
                                <td>PAYMENT TYPE</td>
                                <td><?php 
        echo $data->payment_type;
        ?>
</td>
                            </tr>
                            <tr>
                                <td>BANK NAME</td>
                                <td><?php 
        echo $data->bank;
        ?>
</td>
                            </tr>
                            <?php 
        if (count($arrAg) > 0) {
            ?>
                            <tr>
                                <td>AGENT ID</td>
                                <td><?php 
            echo $agent->admin_username;
            ?>
</td>
                            </tr>
                            <?php 
        }
        ?>
                        </table>
                        </div>


                    </div>
                    <div id="printme" style="text-align: right; margin-top: 5px; margin-bottom: 100px;" >
                         <a href="#" onclick="window.print();"><i class="glyphicon glyphicon-print"></i> print</a> |
                        <a href="<?php 
        echo _SPPATH;
        ?>
myOrders">back to my transactions</a>
                    </div>
                </div>
            </div>
        <?php 
    }
    function main()
    {
        $mtrans = new MTranDetail();
        //        global $db;
        //        $q = "SELECT SUM(detail_price_total) as total, COUNT(*) AS num FROM {$mtrans->table_name}";
        //        $arr = $db->query($q,1);
        //        pr($arr);
        $arrOrder = $mtrans->getOrderBy(" detail_date DESC LIMIT 0,5");
        //        pr($arrOrder);
        ?>

        <h1 style="margin-top: 0;">Dashboard</h1>
        <div class="penjualan_container">
        <?php 
        BIPenjualan::graph();
        ?>
        </div>

        <div class="row">
            <div class="col-md-6" style="padding-top: 20px;">
                <div class="penjualan_container">

                    <h2 class="penjualan_money_h2">Lifetime Sales</h2>
                    <table class="table no-margin">
                        <thead>
                        <tr>
                            <th>Order ID</th>
                            <th>Item</th>
                            <th>Status</th>
                            <th>Popularity</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td><a href="pages/examples/invoice.html">OR9842</a></td>
                            <td>Call of Duty IV</td>
                            <td><span class="label label-success">Shipped</span></td>
                            <td>
                                <div class="sparkbar" data-color="#00a65a" data-height="20"><canvas width="34" height="20" style="display: inline-block; width: 34px; height: 20px; vertical-align: top;"></canvas></div>
                            </td>
                        </tr>
                        <tr>
                            <td><a href="pages/examples/invoice.html">OR1848</a></td>
                            <td>Samsung Smart TV</td>
                            <td><span class="label label-warning">Pending</span></td>
                            <td>
                                <div class="sparkbar" data-color="#f39c12" data-height="20"><canvas width="34" height="20" style="display: inline-block; width: 34px; height: 20px; vertical-align: top;"></canvas></div>
                            </td>
                        </tr>
                        <tr>
                            <td><a href="pages/examples/invoice.html">OR7429</a></td>
                            <td>iPhone 6 Plus</td>
                            <td><span class="label label-danger">Delivered</span></td>
                            <td>
                                <div class="sparkbar" data-color="#f56954" data-height="20"><canvas width="34" height="20" style="display: inline-block; width: 34px; height: 20px; vertical-align: top;"></canvas></div>
                            </td>
                        </tr>
                        <tr>
                            <td><a href="pages/examples/invoice.html">OR7429</a></td>
                            <td>Samsung Smart TV</td>
                            <td><span class="label label-info">Processing</span></td>
                            <td>
                                <div class="sparkbar" data-color="#00c0ef" data-height="20"><canvas width="34" height="20" style="display: inline-block; width: 34px; height: 20px; vertical-align: top;"></canvas></div>
                            </td>
                        </tr>
                        <tr>
                            <td><a href="pages/examples/invoice.html">OR1848</a></td>
                            <td>Samsung Smart TV</td>
                            <td><span class="label label-warning">Pending</span></td>
                            <td>
                                <div class="sparkbar" data-color="#f39c12" data-height="20"><canvas width="34" height="20" style="display: inline-block; width: 34px; height: 20px; vertical-align: top;"></canvas></div>
                            </td>
                        </tr>
                        <tr>
                            <td><a href="pages/examples/invoice.html">OR7429</a></td>
                            <td>iPhone 6 Plus</td>
                            <td><span class="label label-danger">Delivered</span></td>
                            <td>
                                <div class="sparkbar" data-color="#f56954" data-height="20"><canvas width="34" height="20" style="display: inline-block; width: 34px; height: 20px; vertical-align: top;"></canvas></div>
                            </td>
                        </tr>
                        <tr>
                            <td><a href="pages/examples/invoice.html">OR9842</a></td>
                            <td>Call of Duty IV</td>
                            <td><span class="label label-success">Shipped</span></td>
                            <td>
                                <div class="sparkbar" data-color="#00a65a" data-height="20"><canvas width="34" height="20" style="display: inline-block; width: 34px; height: 20px; vertical-align: top;"></canvas></div>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>

        <div class="row">
        <div class="col-md-3">
            <div class="penjualan_container">
            <div class="penjualan">
                <h2 class="penjualan_money_h2">Lifetime Sales</h2>
                <div class="penjualan_money" style="color: #e2007a;">IDR <?php 
        echo idr($arr->total);
        ?>
</div>
            </div>

            <div class="penjualan">
                <h2 class="penjualan_money_h2">Average Order</h2>
                <div class="penjualan_money">IDR <?php 
        echo idr($arr->total / $arr->num);
        ?>
</div>
            </div>
            <hr>

                <div class="penjualan">
                    <h2 class="penjualan_money_h2" style="margin-bottom: 10px;">Latest Transactions</h2>
                    <table class="table table-striped">
                        <thead>
                        <tr>
                            <th>Customer</th>
<!--                            <th>Qty</th>-->
                            <th>Total</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php 
        foreach ($arrOrder as $order) {
            ?>
                                <tr>
                                    <td><?php 
            if ($order->detail_macc_id > 0) {
                $llac = new LL_Account();
                $llac->getByID($order->detail_macc_id);
                echo $llac->macc_first_name;
            } else {
                echo "unknown";
            }
            ?>
</td>
<!--                                    <td>--><?php 
            //=$order->detail_qty;
            ?>
<!--</td>-->
                                    <td>IDR <?php 
            echo idr($order->detail_price_total);
            ?>
</td>
                                </tr>
                                <?php 
        }
        ?>
                        </tbody>
                    </table>
                </div>
                <hr>
                <div class="penjualan">
                    <h2 class="penjualan_money_h2" style="margin-bottom: 20px;">Last Search Terms</h2>
                    <?php 
        $sL = new MSearchLog();
        $arrSl = $sL->getOrderBy("slog_date DESC LIMIT 0,30");
        if (count($arrSl) > 0) {
            $slsudah = array();
            ?>
                        <table class="table table-striped"><?php 
            foreach ($arrSl as $sll) {
                if (!in_array($sll->slog_keyword, $slsudah)) {
                    $slsudah[] = $sll->slog_keyword;
                    ?>
                                <tr>
                                    <td>
                                        <div class="searchkeyword"><?php 
                    echo $sll->slog_keyword;
                    ?>
</div>
                                    </td>
                                </tr>

                            <?php 
                }
            }
            ?>
</table><?php 
        } else {
            ?>
                        <p>We couldn't find any records.</p>
                        <?php 
        }
        ?>
                </div>
                <hr>
                <div class="penjualan">
                    <h2 class="penjualan_money_h2" style="margin-bottom: 20px;">Top Search Terms</h2>
                    <?php 
        $sL = new MSearchLog();
        global $db;
        $q = "SELECT slog_keyword,COUNT(*) as count FROM {$sL->table_name} GROUP BY slog_keyword ORDER BY count DESC LIMIT 0,10";
        $arrSl = $db->query($q, 2);
        //                    pr($arrSl);
        //                    $arrSl = $sL->getOrderBy("slog_date DESC LIMIT 0,30");
        if (count($arrSl) > 0) {
            $slsudah = array();
            ?>
                        <table class="table table-striped"><?php 
            foreach ($arrSl as $sll) {
                if (!in_array($sll->slog_keyword, $slsudah)) {
                    $slsudah[] = $sll->slog_keyword;
                    ?>
                                <tr>
                                    <td>
                                        <div class="searchkeyword"><?php 
                    echo $sll->slog_keyword;
                    ?>
</div>
                                    </td>
                                    <td>
                                        <div class="searchkeyword"><?php 
                    echo $sll->count;
                    ?>
</div>
                                    </td>
                                </tr>

                            <?php 
                }
            }
            ?>
</table><?php 
        } else {
            ?>
                        <p>We couldn't find any records.</p>
                    <?php 
        }
        ?>
                </div>
            </div>
        </div>
        <style>
            .penjualan_container{
                border: 1px solid #dedede;
                background-color: white;
                padding: 20px;
            }
            .penjualan_money_h2{
                padding: 0;
                margin: 0;
                font-size: 20px;
                margin-bottom: 20px;
                color: #666666;
            }
            .penjualan_money{
                font-size: 25px;
            }
            .penjualan{
                margin-bottom: 20px;
            }
        </style>

            <div class="col-md-9">


                <div class="penjualan_container" style="margin-bottom: 20px;">


                    </div>
                <div class="penjualan_container">
                    <div>

                        <!-- Nav tabs -->
                        <ul class="nav nav-tabs" role="tablist">
                            <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li>
                            <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Profile</a></li>
                            <li role="presentation"><a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">Messages</a></li>
                            <li role="presentation"><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">Settings</a></li>
                        </ul>

                        <!-- Tab panes -->
                        <div class="tab-content">
                            <div role="tabpanel" class="tab-pane active" id="home">ss...</div>
                            <div role="tabpanel" class="tab-pane" id="profile">.bb..</div>
                            <div role="tabpanel" class="tab-pane" id="messages">..cc.</div>
                            <div role="tabpanel" class="tab-pane" id="settings">..dd.</div>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                </div>
            </div>
        <div class="clearfix"></div>
        </div>
        <?php 
    }
    public static function printer($data, $id, $name, $breadcrumbs, $cats, $tipe)
    {
        $pc = new ProductAtCategory();
        $rules = MCPRule::getRules();
        $rule2varians = MCPRule::getRules2Variant();
        //        pr($rules);
        //        pr($rule2varians);
        ?>
<!--        <div class="monly" style="margin-top: 80px;"></div>-->
        <div onclick="$('#kotakfilter').toggle();" class="monly" style="padding:10px;z-index: 1000; border-radius:5px;background-color: #cccccc; color: white; padding-right: 15px; position: absolute; right: -5px; top: 70px;">
            <i class="glyphicon glyphicon-filter"></i>
        </div>
        <div id="kotakfilter" class="col-md-3 wadah_filter donly">
            <div class="filter">
                <h3>Filter By</h3>

                <div class="filter_item" id="filter_subcategory" <?php 
        if ($tipe == 3) {
            ?>
style="display: none;"<?php 
        }
        ?>
 >
                    <h5 onclick="$('#filter_subcategory_isi').toggle();">Sub Category</h5>

                    <div id="filter_subcategory_isi">
                        <?php 
        ProductCategoryService::printCategoryFilter($id, $cats, $tipe);
        ?>
                    </div>
                </div>
                <div class="filter_item" id="filter_price">
                    <h5 onclick="$('#filter_subcategory_price').toggle();">Price</h5>

                    <div id="filter_subcategory_price" style="padding: 10px;">
                        <div id="slider"></div>
                        <div id="price"></div>
                        <input type="hidden" id="val_min">
                        <input type="hidden" id="val_max">
                    </div>
                    <!--                    <button class="btn btn-default" onclick="filterin();">filter</button>-->
                </div>
                <script>
                    $(function () {
                        $("#slider").slider({
                            range: true,
                            values: [0, 3000000],
                            step: 10000,
                            min: 0,
                            max: 1000000,
                            slide: function (event, ui) {
                                $("#price").html("IDR " + toRp(ui.values[0]) + " - IDR " + toRp(ui.values[1]));
//                                $('#val_min').val(ui.values[ 0 ]);
//                                $('#val_max').val(ui.values[ 1 ]);
                            },
                            stop: function (event, ui) {
//                                homes.sort(function (a, b) {
//                                    return parseFloat(a.SellingPrice) - parseFloat(b.SellingPrice);
//                                });
//                                printProduct({
//                                    minprice : ui.values[ 0 ],
//                                    maxprice : ui.values[ 1 ]
//                                });

                                homes.sort(function (a, b) {
                                    return parseFloat(a.SellingPrice) - parseFloat(b.SellingPrice);
                                });
                                arahPrice = "asc";
                                page = 1;
                                printProduct({});
                            }
                        });

                        $("#price").html("IDR " + toRp($("#slider").slider("values", 0)) +
                            " - IDR " + toRp($("#slider").slider("values", 1)));
//                        $('#val_min').val($( "#slider" ).slider( "values", 0 ));
//                        $('#val_max').val($( "#slider" ).slider( "values", 1 ));
                    });

                    function filterin() {
//                        console.log('filterin');
                        homes.sort(function (a, b) {
                            return parseFloat(a.SellingPrice) - parseFloat(b.SellingPrice);
                        });
                        printProduct({});
                    }
                </script>
            </div>
            <style>
                .filter {
                    margin-top: 40px;
                    border: 1px solid #cccccc;
                    color: #666666;
                    padding: 10px;
                }

                .filter h3 {
                    padding: 0;
                    margin: 0;
                }

                .filter h5 {
                    color: #333333;
                    cursor: pointer;
                }

                .filter_item {
                    border-top: 1px dashed #cccccc;
                    margin-top: 10px;
                }

                .key2 {
                    font-size: 14px;
                    margin-top: 7px;
                    margin-bottom: 7px;

                }

                .key2 span {
                    cursor: pointer;
                }

                .key3 {
                    font-size: 13px;
                    margin-top: 3px;
                    margin-bottom: 3px;
                }
            </style>
        </div>
        <div class="col-md-9" style="margin-top: 40px;">

            <div class="breadcrumbs"><?php 
        echo $breadcrumbs;
        ?>
</div>

            <h1 style="color: #333333;"><?php 
        echo urldecode($name);
        ?>
</h1>

            <p style="margin-top: 20px; margin-bottom: 30px; color: #888888;">
                PREP YOUR BODY TO PERFECTION WITH THESE BATHROOM ESSENTIALS. FIND BATH & BODYCARE BRUSHES FOR
                EXFOLIATION AND SUPER-SMOOTH SKIN, FILES FOR HANDS AND FEET, EXFOLIATING MITTS TO LEAVE YOU WITH GLOWING
                SOFT SKIN EVERY DAY. THESE ESSENTIAL BODY ACCESSORIES WILL PAMPER FROM HEAD TO TOE.
            </p>

            <?php 
        if ($data->status_code == "0") {
            ?>
                No products found
                <?php 
        } else {
            $arr = $data->results;
            //durchlaufen the data to get if any diskon, special categorization take effect
            $sudah = array();
            foreach ($arr as $ss) {
                if (!in_array($ss->VariantID, $sudah)) {
                    $sudah[] = $ss->VariantID;
                    //durchlaufen disini ..thd rule
                    if (count($rule2varians[$ss->VariantID]) > 0) {
                        $uu = $rule2varians[$ss->VariantID];
                        //set icon
                        $ss->rule_icon = _SPPATH . _PHOTOURL . $rules[$uu[0]]->rule_icon;
                        //                            pr($uu);
                        //diskon
                        $diskon = 0;
                        foreach ($uu as $ruleygkena) {
                            $r = $rules[$ruleygkena];
                            $diskon = max($r->rule_discount, $diskon);
                        }
                        $ss->rule_discount = $diskon;
                    } else {
                        $ss->rule_icon = "";
                        //default rule icon
                        $ss->rule_discount = 0;
                    }
                    $ss->final_price = (100 - $ss->rule_discount) / 100 * $ss->SellingPrice;
                    //masukan ke sem
                    $sem[$ss->VariantID] = $ss;
                } else {
                    $sem[$ss->VariantID]->TaggingLevel3ID .= " " . $ss->TaggingLevel3ID;
                }
            }
            $arr = $sem;
            $page = 1;
            $limit = 12;
            $total = count($arr);
            $begin = ($page - 1) * $limit + 1;
            $end = $begin + $limit - 1;
            if ($end > $total) {
                $end = $total;
            }
            $jmlhpage = ceil($total / $limit);
            $minpage = max(1, $page - 3);
            $maxpage = min($jmlhpage, $page + 3);
            ?>
                <div class="sort">
                    <span style="margin-right: 20px;">SORT BY</span> <span onclick="sortByName();" class="sort_item">NAME</span>
                    <span onclick="sortByPrice();" class="sort_item">PRICE</span>
                    <hr class="dotted monly">
                    <span class="sort_item" ><input id="searchTextVariant" onkeyup="page=1;printProduct({});" type="text" placeholder="Search"></span>
                </div>
                <style>
                    .showing {
                        float: left;
                        width: 200px;

                    }

                    .pages {
                        text-align: right;
                    }

                    .page_nr {
                        cursor: pointer;
                        padding-left: 5px;
                        padding-right: 5px;
                    }

                    .page_nr:hover {
                        text-decoration: underline;
                    }

                    .page_nr_sel {
                        font-weight: bold;
                        color: #7fb719;
                    }
                </style>
                <div id="product_data">
                    <div class="product_pagination">
                        <div class="showing">SHOWING <b><?php 
            echo $begin;
            ?>
</b>-<b><?php 
            echo $end;
            ?>
</b> OF
                            <b><?php 
            echo $total;
            ?>
</b></div>
                        <div class="clearfix monly"></div>
                        <hr class="dotted monly">
                        <div class="pages">Pages
                            <?php 
            if ($page > 1) {
                ?>
                                <span onclick="moveToPage(<?php 
                echo $page - 1;
                ?>
);" class="page_nr">«</span>
                                <?php 
            }
            ?>
                            <?php 
            for ($x = $minpage; $x <= $maxpage; $x++) {
                ?>
                                <span onclick="moveToPage(<?php 
                echo $x;
                ?>
);"
                                      class="page_nr <?php 
                if ($page == $x) {
                    echo "page_nr_sel";
                }
                ?>
"><?php 
                echo $x;
                ?>
</span>
                                <?php 
            }
            ?>
                            <?php 
            if ($page < $jmlhpage) {
                ?>
                                <span onclick="moveToPage(<?php 
                echo $page + 1;
                ?>
);" class="page_nr">»</span>
                            <?php 
            }
            ?>
                            &nbsp;&nbsp; &nbsp; <b><?php 
            echo $page;
            ?>
</b> of <b><?php 
            echo $jmlhpage;
            ?>
</b> displayed
                        </div>
                    </div>
                    <?php 
            $t = time();
            $num = 0;
            foreach ($arr as $key => $obj) {
                $t = $t . rand(0, 100);
                $imgurl = $pc->imgURL . $obj->BaseArticleImageFile;
                if ($obj->BaseArticleImageFile == "") {
                    $imgurl = $pc->noimage;
                }
                ?>
                        <div class="product_list_item col-md-4 col-sm-6 col-xs-6">
                            <div class="product_list_item_dalaman">
                                <!--                    <div id="imgloader_--><?php 
                //=$obj->VariantID;
                ?>
<!--_--><?php 
                //=$t;
                ?>
<!--" class="img_loader" >-->
                                <!--                        <img src="--><?php 
                //=_SPPATH;
                ?>
<!--images/tbs-hor-ajax-loader.gif">-->
                                <!--                    </div>-->
                                <div id="imgasli_<?php 
                echo $obj->VariantID;
                ?>
_<?php 
                echo $t;
                ?>
" class="product_list_item_img">
                                    <?php 
                if ($obj->rule_icon != "") {
                    ?>
                                        <div class="imgstamp">
                                            <img src="<?php 
                    echo $obj->rule_icon;
                    ?>
">
                                        </div>
                                        <?php 
                }
                ?>
                                    <a title="<?php 
                echo $obj->BaseArticleNameENG;
                ?>
"
                                       href="<?php 
                echo _SPPATH;
                ?>
pr/p/<?php 
                echo $obj->VariantID;
                ?>
/<?php 
                echo self::bersihkanNama($obj->BaseArticleNameENG);
                ?>
">
                                        <img id="imgTarget_<?php 
                echo $obj->VariantID;
                ?>
" src="<?php 
                echo $imgurl;
                ?>
">
                                    </a>
                                </div>

                                <div class="product_list_item_text">
                                    <div class="name">
                                        <a title="<?php 
                echo $obj->BaseArticleNameENG;
                ?>
"
                                           href="<?php 
                echo _SPPATH;
                ?>
pr/p/<?php 
                echo $obj->VariantID;
                ?>
/<?php 
                echo self::bersihkanNama($obj->BaseArticleNameENG);
                ?>
">
                                            <?php 
                echo $obj->BaseArticleNameENG;
                ?>
                                        </a>
                                    </div>
                                    <div class="rating">
                                        <div class="rating">
                                            <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
                                        </div>

                                    </div>
                                    <?php 
                //pr($obj);
                if ($obj->rule_discount > 0) {
                    ?>
                                            <div class="item_price item_price_small" >IDR <?php 
                    echo idr($obj->SellingPrice);
                    ?>
</div>
                                            <div class="item_price">IDR <?php 
                    echo idr($obj->final_price);
                    ?>
</div>
                                            <?php 
                } else {
                    ?>
                                            <div class="item_price item_price_small" ></div>
                                            <div class="item_price">IDR <?php 
                    echo idr($obj->final_price);
                    ?>
</div>
                                            <?php 
                }
                ?>
                                    <div  class="monly" style="background-color: #e2007a; padding: 5px; text-align: center;">
                                        <div class="add" st data-toggle="modal" data-variant="<?php 
                echo $obj->VariantID;
                ?>
"
                                             data-url="<?php 
                echo _SPPATH;
                ?>
pr/p/<?php 
                echo $obj->VariantID;
                ?>
/<?php 
                echo self::bersihkanNama($obj->BaseArticleNameENG);
                ?>
"
                                             data-imgUrl="<?php 
                echo $imgurl;
                ?>
"
                                             data-articlename="<?php 
                echo $obj->BaseArticleNameENG;
                ?>
"
                                             data-target="#myModal" style="color: white; font-weight: bold;">ADD TO BAG</div>
                                    </div>
                                    <div class="buy donly">
                                        <div style="float: right;" class="donly">
                                            <a class="add" data-toggle="modal" data-variant="<?php 
                echo $obj->VariantID;
                ?>
"
                                               data-url="<?php 
                echo _SPPATH;
                ?>
pr/p/<?php 
                echo $obj->VariantID;
                ?>
/<?php 
                echo self::bersihkanNama($obj->BaseArticleNameENG);
                ?>
"
                                               data-imgUrl="<?php 
                echo $imgurl;
                ?>
"
                                               data-articlename="<?php 
                echo $obj->BaseArticleNameENG;
                ?>
"
                                               data-target="#myModal" style="cursor: pointer">ADD TO BAG</a>
                                        </div>



                                        <a class="more donly" title="<?php 
                echo $obj->BaseArticleNameENG;
                ?>
"
                                           href="<?php 
                echo _SPPATH;
                ?>
pr/p/<?php 
                echo $obj->VariantID;
                ?>
/<?php 
                echo self::bersihkanNama($obj->BaseArticleNameENG);
                ?>
">
                                            more details</a>

                                        <div class="clearfix"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <?php 
                if ($num % 3 == 2) {
                    echo "<div class='clearfix donly'></div><hr class='dotted donly'/>";
                }
                if ($num > 10) {
                    break;
                }
                $num++;
            }
            ?>
                    <div class="clearfix"></div>
                    <div class="product_pagination">
                        <div class="showing">SHOWING <b><?php 
            echo $begin;
            ?>
</b>-<b><?php 
            echo $end;
            ?>
</b> OF
                            <b><?php 
            echo count($arr);
            ?>
</b></div>
                        <div class="clearfix monly"></div>
                        <hr class="dotted monly">
                        <div class="pages">Pages
                            <?php 
            if ($page > 1) {
                ?>
                                <span onclick="moveToPage(<?php 
                echo $page - 1;
                ?>
);" class="page_nr">«</span>
                                <?php 
            }
            ?>
                            <?php 
            for ($x = $minpage; $x <= $maxpage; $x++) {
                ?>
                                <span onclick="moveToPage(<?php 
                echo $x;
                ?>
);"
                                      class="page_nr <?php 
                if ($page == $x) {
                    echo "page_nr_sel";
                }
                ?>
"><?php 
                echo $x;
                ?>
</span>
                                <?php 
            }
            ?>
                            <?php 
            if ($page < $jmlhpage) {
                ?>
                                <span onclick="moveToPage(<?php 
                echo $page + 1;
                ?>
);" class="page_nr">»</span>
                            <?php 
            }
            ?>
                            &nbsp;&nbsp; &nbsp; <b><?php 
            echo $page;
            ?>
</b> of <b><?php 
            echo $jmlhpage;
            ?>
</b> displayed
                        </div>
                    </div>
                </div>
                <div class="clearfix"></div>
                <script>

                    var catKey = [];


                    var page = <?php 
            echo $page;
            ?>
;
                    var limit = <?php 
            echo $limit;
            ?>
;
                    var total = <?php 
            echo $total;
            ?>
;
                    var jmlpage = <?php 
            echo $jmlhpage;
            ?>
;

                    function preloadImg(id) {
//                console.log('preload '+id);
                        $('#imgloader_' + id).hide();
                        $('#imgasli_' + id).show();
                    }

                    function removeA(arr) {
                        var what, a = arguments, L = a.length, ax;
                        while (L > 1 && arr.length) {
                            what = a[--L];
                            while ((ax = arr.indexOf(what)) !== -1) {
                                arr.splice(ax, 1);
                            }
                        }
                        return arr;
                    }

                    function moveToPage(x) {
                        page = x;
                        printProduct({});
                    }

                    $(document).ready(function () {
                        $("#product_data img")
                            .error(function () {
                                $(this).attr("src", "<?php 
            echo $pc->noimage;
            ?>
");
                            });
                        homes.reverse();
                    });

                    var homes = [];
                    <?php 
            //create javascript objects
            foreach ($arr as $key => $obj) {
                //                        unset($obj->VariantNameINA);
                //                        unset($obj->VariantNameENG);
                unset($obj->VariantINACode);
                unset($obj->HowToUseINA);
                unset($obj->HowToUseENG);
                unset($obj->ArticleInfoINA);
                unset($obj->ProductTipsINA);
                unset($obj->ProductTipsENG);
                unset($obj->ArticleInfoENG);
                unset($obj->IngredientINA);
                unset($obj->IngredientENG);
                unset($obj->VariantEAN);
                unset($obj->WhatInsideINA);
                unset($obj->WhatInsideENG);
                ?>
                    var el = jQuery.parseJSON('<?php 
                echo addslashes(json_encode($obj));
                ?>
');
                    homes.push(el);
                    <?php 
            }
            ?>
                    var arahPrice = "desc";
                    function sortByPrice() {
                        if (arahPrice == "desc") {
                            homes.sort(function (a, b) {
                                return parseFloat(a.final_price) - parseFloat(b.final_price);
                            });
                            arahPrice = "asc";
                        } else {
                            arahPrice = "desc";
                            homes.sort(function (a, b) {
                                return parseFloat(b.final_price) - parseFloat(a.final_price);
                            });
                        }

                        printProduct({});
                    }
                    var arahName = "desc";

                    function sortByName() {
                        if (arahName == "desc") {
                            homes.sort(sort_by('BaseArticleNameENG', false, function (a) {
                                return a.toUpperCase()
                            }));
                            arahName = "asc";
                        } else {
                            arahName = "desc";
                            homes.sort(sort_by('BaseArticleNameENG', true, function (a) {
                                return a.toUpperCase()
                            }));
                        }
                        printProduct({});
                    }

                    var sort_by = function (field, reverse, primer) {
                        var key = function (x) {
                            return primer ? primer(x[field]) : x[field]
                        };

                        return function (a, b) {
                            var A = key(a), B = key(b);
                            return ( (A < B) ? -1 : ((A > B) ? 1 : 0) ) * [-1, 1][+!!reverse];
                        }
                    }

                    function updateArrSize() {
                        var arrSem = homes.slice();
                        var arrFiltered = [];
                        var range = {
                            minprice: $("#slider").slider("values", 0),
                            maxprice: $("#slider").slider("values", 1)
                        };
                        var yangMasukRange = 0;
                        for (var x = 0; x < arrSem.length; x++) {
                            var attr = arrSem[x];

                            if (range.hasOwnProperty('minprice')) {
                                if (attr['final_price'] < range.minprice)
                                    continue;
                            }
                            if (range.hasOwnProperty('maxprice')) {
                                if (attr['final_price'] > range.maxprice)
                                    continue;
                            }
//                            if (catKey.length > 0) {
//                                if (jQuery.inArray(attr['TaggingLevel3ID'], catKey) == -1) {
//                                    continue;
//                                }
//                            }
                            if(catKey.length>0){
                                var lanjut = 0;
                                var cats = attr['TaggingLevel3ID'].split(' ');
//                    console.log(cats);
                                for(var z=0;z<cats.length;z++) {
                                    if (jQuery.inArray(cats[z], catKey) > -1) {
                                        lanjut = 1;
//                            console.log("lanjut"+cats[z]+attr['VariantID']);
                                    }
                                }
                                if(lanjut === 0)
                                    continue;
                            }

                            //search filter
                            var search = $("#searchTextVariant").val().toLowerCase();
                            if(search != '') {
//                    console.log(search);
//                    console.log(attr['VariantID']+ " "+attr['VariantNameENG']);BaseArticleNameENG
                                if (attr['VariantID'].toLowerCase().indexOf(search) === -1 && attr['VariantNameENG'].toLowerCase().indexOf(search) === -1 && attr['BaseArticleNameENG'].toLowerCase().indexOf(search) === -1) {
                                    continue;
                                }
                            }

                            arrFiltered.push(attr);
                            yangMasukRange++;
                        }
                        total = yangMasukRange;
                        return arrFiltered;
                    }
                    function printProduct(option) {
                        $('#loadingtop').show().fadeOut();
//                console.log(option);

                        var arrSem = updateArrSize();

                        var range = {
                            minprice: $("#slider").slider("values", 0),
                            maxprice: $("#slider").slider("values", 1)
                        };
                        var html = '';
                        var printed = 0;

//                var arrSem = homes.slice();

                        var end = Math.min(limit, arrSem.length);
                        console.log(arrSem);

                        var t = $.now();

                        if (page > 1) {
                            var anzahlremove = 0 - ((page - 1) * limit);
                            arrSem.splice(anzahlremove);
                        }
//                console.log("anzahlremove "+anzahlremove);
//                console.log(arrSem.length);


                        html += createPagination();

                        while (printed < end && arrSem.length > 0) {
//                for(var x=0;x<12;x++){
                            var attr = arrSem.pop();
                            var rand = Math.floor((Math.random() * 100) + 1);
                            t = t + rand;

//                            if (range.hasOwnProperty('minprice')) {
//                                if (attr['SellingPrice'] < range.minprice)
//                                    continue;
//                            }
//                            if (range.hasOwnProperty('maxprice')) {
//                                if (attr['SellingPrice'] > range.maxprice)
//                                    continue;
//                            }
//                            if (catKey.length > 0) {
//                                if (jQuery.inArray(attr['TaggingLevel3ID'], catKey) == -1) {
//                                    continue;
//                                }
//                            }

                            html += '<div class="product_list_item col-md-4 col-sm-6 col-xs-6">';
                            html += '<div class="product_list_item_dalaman">';
                            html += '<div id="imgloader_' + attr['VariantID'] + '_' + t + '" class="img_loader" >';
                            html += '<img onload="" src="<?php 
            echo _SPPATH;
            ?>
images/tbs-hor-ajax-loader.gif">';
                            html += '</div>';

                            var imgurl = '<?php 
            echo $pc->imgURL;
            ?>
' + attr['BaseArticleImageFile'];
                            if (attr['BaseArticleImageFile'] == '') {
                                imgurl = '<?php 
            echo $pc->noimage;
            ?>
';
                            }
                            var linkurl = '<?php 
            echo _SPPATH;
            ?>
pr/p/' + attr['VariantID'] + '/' + urlencode(attr['BaseArticleNameENG'].replace("/"," "));

                            html += '<div  id="imgasli_' + attr['VariantID'] + '_' + t + '" class="product_list_item_img" style="display:none;">';

                            if(attr['rule_icon']!='') {
                                html += '<div class="imgstamp">';
                                html += '<img src="'+attr['rule_icon']+'">';
                                html += '</div>';
                            }

                            html += '<a title="' + attr['BaseArticleNameENG'] + '" href="'+linkurl+'">';
                            html += '<img id="imgTarget_' + attr['VariantID'] + '" onload="preloadImg(\'' + attr['VariantID'] + '_' + t + '\');"  src="' + imgurl + '" >';
                            html += '</a>';
                            html += '</div>';


                            html += '<div class="product_list_item_text">';
                            html += '<div class="name">';
                            html += '<a title="' + attr['BaseArticleNameENG'] + '" href="'+linkurl+'">';
                            html += attr['BaseArticleNameENG'] + '</a>';
                            html += '</div>';
                            html += '<div class="rating">';
                            html += '<div class="rating">';
                            html += '<span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>';
                            html += '</div>';

                            html += '</div>';

                            var hargadiskon = '';
                            var diskonnya = parseInt(attr['rule_discount']);

                            if(diskonnya>0){
                                 hargadiskon = 'IDR '+toRp(attr['SellingPrice']);

                            }

                            html += '<div class="item_price item_price_small" >'+hargadiskon+'</div>';


                            html += '<div class="item_price">IDR ' + toRp(attr['final_price']) + '</div>';

                            html += '<div  class="monly" style="background-color: #e2007a; padding: 5px; text-align: center;">';
                            html += '<div class="add" data-toggle="modal" data-variant="' + attr['VariantID'] + '"';
                            html += 'data-url="'+linkurl+'"';
                            html += 'data-imgUrl="'+imgurl+'"';
                            html += 'data-articlename="' + attr['BaseArticleNameENG'] + '"';
                            html += 'data-target="#myModal" style="cursor: pointer;color:white; font-weight:bold;">ADD TO BAG</div>';
                            html += '</div>';


                            html += '<div class="buy donly">';
                            html += '<div style="float: right;">';

                            html += '<a class="add" data-toggle="modal" data-variant="' + attr['VariantID'] + '"';
                            html += 'data-url="'+linkurl+'"';
                            html += 'data-imgUrl="'+imgurl+'"';
                            html += 'data-articlename="' + attr['BaseArticleNameENG'] + '"';
                            html += 'data-target="#myModal" style="cursor: pointer">ADD TO BAG</a>';


//                            html += '<a class="add" href="buy">ADD TO BAG</a>';
                            html += '</div>';
                            html += '<a  class="more" title="' + attr['BaseArticleNameENG'] + '" href="<?php 
            echo _SPPATH;
            ?>
pr/p/' + attr['VariantID'] + '/' + encodeURIComponent(attr['BaseArticleNameENG']) + '">';
                            html += 'more details</a>';
                            html += '<div class="clearfix"></div>';
                            html += '</div>';
                            html += '</div>';
                            html += '</div>';
                            html += '</div>';


                            if (printed % 3 == 2)html += "<div class='clearfix donly'></div><hr class='dotted donly'/>";

                            printed++;
                        }
                        html += '<div class="clearfix"></div>';
                        html += createPagination();


                        $('#product_data').html(html);
//                $('#loadingtop').hide();
                    }

                    function createPagination() {

                        var html = '';
//                $begin = (($page-1)*$limit)+1;
//                $end = $page+$limit-1;
//
//                $total = count($arr);
//                $jmlhpage = ceil($total/$limit);
//
//                $minpage = max(1,$page-3);
//                $maxpage = min($jmlhpage,$page+3);

                        var begin = ((page - 1) * limit) + 1;
                        var end = Math.min(begin + limit - 1, total);

//                        var jmltotal = Math.min(total,end);
                        var jmltotal = total;

                        var jmlpage = Math.ceil(jmltotal / limit);

                        var minpage = Math.max(1, page - 3);
                        var maxpage = Math.min(jmlpage, page + 3);


                        html += '<div class="product_pagination">';
                        html += '<div class="showing">SHOWING <b>' + begin + '</b>-<b>' + end + '</b> OF <b>' + jmltotal + '</b></div>';
                        html += '<div class="clearfix monly"></div> <hr class="dotted monly">';
                        html += '<div class="pages">Pages';
                        if (page > 1) {
                            var mundur = page - 1;
                            html += '<span onclick="moveToPage(' + mundur + ');" class="page_nr">«</span>';
                        }
                        for (var x = minpage; x <= maxpage; x++) {
                            var sel = '';
                            if (page == x)sel = 'page_nr_sel';
                            html += '<span onclick="moveToPage(' + x + ');" class="page_nr ' + sel + '">' + x + '</span>';
                        }
                        if (page < jmlpage) {
                            var maju = page + 1;
                            html += '<span onclick="moveToPage(' + maju + ');" class="page_nr">»</span>';
                        }

                        html += '&nbsp;&nbsp; &nbsp; <b>' + page + '</b> of <b>' + jmlpage + '</b> displayed </div>';
                        html += '</div>';

                        return html;
                    }

                    function toRp(angka) {
                        var rev = parseInt(angka, 10).toString().split('').reverse().join('');
                        var rev2 = '';
                        for (var i = 0; i < rev.length; i++) {
                            rev2 += rev[i];
                            if ((i + 1) % 3 === 0 && i !== (rev.length - 1)) {
                                rev2 += '.';
                            }
                        }
                        return rev2.split('').reverse().join('');
                    }


                </script><?php 
        }
        ?>
            <style>
                .sort {
                    border: 1px solid #cccccc;
                    padding: 10px;

                    font-size: 12px;
                    font-weight: bold;
                }

                .product_pagination {
                    padding: 10px;
                    margin-bottom: 30px;
                    color: #666666;
                }

                .sort_item {
                    cursor: pointer;
                    padding-left: 20px;
                    padding-right: 20px;
                    border-left: 1px dashed #cccccc;
                    font-weight: normal;
                }

                .product_list_item {
                    /*float: left;*/
                    /*width: 33%;*/
                    /*height: 390px;*/
                    border-right: 1px dashed #cccccc;
                }

                .product_list_item_dalaman {
                    padding: 10px;
                }

                .product_list_item_img, .img_loader {
                    width: 180px;
                    height: 180px;
                    overflow: hidden;
                    margin: auto;
                    text-align: center;
                }

                .product_list_item_img img, .img_loader img {
                    max-width: 100%;
                    max-height: 100%;
                }

                .img_loader {
                    line-height: 180px;
                }

                .product_list_item_text .name {
                    font-weight: bold;
                    color: #777777;
                    height: 40px;
                    text-overflow: ellipsis;
                    margin-top: 20px;
                    overflow: hidden;
                    /*white-space:nowrap;*/
                    display: -webkit-box;
                    -webkit-line-clamp: 2;
                    -webkit-box-orient: vertical;

                }

                .product_list_item_text .name a {
                    color: #666666;
                }

                .product_list_item_text .name a:hover {
                    color: #7fb719;
                }
                .imgstamp{
                    position: absolute;
                    width: 80px;
                    height: 80px;
                    overflow: hidden;
                }
                .imgstamp img{
                    min-width: 100%;
                    min-height: 100%;
                }
                /*
                use text ellipsis always with overflow:hidden; and white-space:nowrap;

                for multiple line ..line clamps use
                display: -webkit-box;
                    -webkit-line-clamp: 2;
                    -webkit-box-orient: vertical;
                    and overflow:hidden;
                */
                .rating {
                    font-size: 20px;
                    margin-top: 10px;
                    color: #999999;
                }

                .rating > span:hover:before {
                    content: "\2605";
                    position: absolute;
                }

                .item_price {
                    color: #e2007a;
                    font-size: 25px;
                }
                .item_price_small{
                    text-decoration: line-through; font-size: 13px;height: 18px;
                }

                .buy {
                    padding: 5px;
                    border: 1px solid #cccccc;
                    margin-top: 10px;
                    /*height: 45px;*/
                }

                a.more {
                    font-size: 11px;
                    text-decoration: underline;
                    color: #444444;
                    height: 30px;
                    line-height: 30px;
                }

                a.add {
                    background-color: #e2007a;
                    color: white;
                    padding: 5px;
                    height: 30px;
                    padding-right: 10px;
                    padding-left: 10px;
                    line-height: 30px;
                    text-underline: none;
                }

                a.add:hover {
                    background-color: #C60063;
                    color: white;
                    padding: 5px;
                    height: 30px;
                    padding-right: 10px;
                    padding-left: 10px;
                    line-height: 30px;
                    text-decoration: none;
                }

                button.add {
                    background-color: #e2007a;
                    color: white;
                    padding: 5px;
                    padding-left: 10px;
                    padding-right: 10px;
                    border-color: #e2007a;
                    border-radius: 0px;
                    font-size: 14px;
                }

                .addcancel {
                    border: none;
                    border-radius: 0px;
                    font-size: 14px;
                    color: #777777;
                }

                .addcancel:hover {
                    border: none;
                    border-radius: 0px;
                    font-size: 14px;
                    background-color: transparent;
                    color: #b4b4b4;
                }

                button.add:hover, button.add:active, button.add:focus, button.add:visited {
                    background-color: #C60063;
                    border-color: #C60063;
                    border-radius: 0px;
                }

                @media (min-width: 550px) {
                    .modal-dialog.adddialog {
                        width: 500px;
                        margin: 30px auto
                    }
                }

                hr.dotted {
                    border-top: 1px dashed #cccccc;
                    margin-top: 10px;
                    margin-bottom: 10px;
                    margin-left: 10px;
                    margin-right: 10px;
                }

                .breadcrumbs span {
                    font-weight: bold;
                }

                .breadcrumbs a {
                    color: #666666;
                    font-style: italic;
                }

            </style>
        </div>
        <div class="clearfix"></div>

        <?php 
        //        pr($data);
    }
    function mycart()
    {
        $cartModel = new CartPortal();
        $arr = CartWeb::myCart();
        //        pr($arr);
        //        $mm = new MTranDetail();
        //        $mm->printColumlistAsAttributes();
        if (count($arr) > 0) {
            $rules = MCPRule::getRules();
            $rule2varians = MCPRule::getRules2Variant();
            $cart_rules = MCPRCartRule::getRules();
            //            $cart_rule2varians = MCPRCartRule::getRules2Variant();
            //            pr($cart_rule2varians);
            //            pr($cart_rules);
            ?>
<!--            <div class="monly" style="margin-top: 80px;"></div>-->
            <h1 class="tbs">YOUR SHOPPING BAG</h1>
            <div class="monly">
                <?php 
            $pc = new ProductAtCategory();
            $total = 0;
            $totaldiskon = 0;
            foreach ($arr as $ss) {
                $obj = new MProdModel();
                $obj->getByID($ss->variant_id);
                $imgurl = $pc->imgURL . $obj->BaseArticleImageFile;
                if ($obj->BaseArticleImageFile == "") {
                    $imgurl = $pc->noimage;
                }
                //durchlaufen disini ..thd rule
                if (count($rule2varians[$obj->VariantID]) > 0) {
                    $uuss = $rule2varians[$obj->VariantID];
                    //set icon
                    $obj->rule_icon = _SPPATH . _PHOTOURL . $rules[$uuss[0]]->rule_icon;
                    //                            pr($uu);
                    //diskon
                    $diskon = 0;
                    foreach ($uuss as $ruleygkena) {
                        $r = $rules[$ruleygkena];
                        $diskon = max($r->rule_discount, $diskon);
                    }
                    $obj->rule_discount = $diskon;
                } else {
                    $obj->rule_icon = "";
                    //default rule icon
                    $obj->rule_discount = 0;
                }
                //                        $totaldiskon += $obj->rule_discount/100*$obj->SellingPrice;
                $obj->final_price = (100 - $obj->rule_discount) / 100 * $obj->SellingPrice;
                $total += $ss->qty * $obj->final_price;
                ?>
                    <div style="background-color: #f6f6f6; padding: 10px; margin: 5px;">
                    <div class="col-sm-6 col-xs-6" style="text-align: center;">
                        <img width="100%" src="<?php 
                echo $imgurl;
                ?>
">
                        <div style="margin-top: 10px; margin-bottom: 10px;">
                            <?php 
                echo $obj->VariantNameENG;
                ?>
                        </div>


                        <a onclick="removeFromCart('<?php 
                echo $obj->VariantID;
                ?>
');" class="remove">remove <i class="glyphicon glyphicon-play"></i></a>

                    </div>
                    <div class="col-sm-6 col-xs-6" style="padding-top: 10px;">
                        <div class="col-sm-6 col-xs-6" style="text-align: right;line-height: 34px;">Qty &nbsp; </div>
                        <div class="col-sm-6 col-xs-6">
                            <select onchange="updateQtyCart('<?php 
                echo $obj->VariantID;
                ?>
',$(this).val());" class="form-control">
                                <?php 
                for ($x = 1; $x < 10; $x++) {
                    ?>
                                    <option <?php 
                    if ($ss->qty == $x) {
                        echo "selected";
                    }
                    ?>
 value="<?php 
                    echo $x;
                    ?>
"><?php 
                    echo $x;
                    ?>
</option>
                                <?php 
                }
                ?>
                            </select>
                        </div>
                        <div class="clearfix"></div>
                        <div style="text-align: right; margin-top: 20px;">
                            <?php 
                if ($obj->final_price != $obj->SellingPrice) {
                    ?>
                                 Price <br><i class="oldprice" style="font-size: 12px; text-decoration: line-through;"><?php 
                    echo idr($obj->SellingPrice);
                    ?>
</i><br>
                                <br>
                            <?php 
                }
                ?>

                             Item Price <br><i class="newprice"><?php 
                echo idr($obj->final_price);
                ?>
</i>
                        </div>

                    </div>
                    <div class="clearfix"></div>
                        <hr class="dotted">
                        <h3 style="text-align: right;">
                            IDR <?php 
                echo idr($ss->qty * $obj->final_price);
                ?>
                        </h3>
                    </div>
                <?php 
            }
            ?>
            </div>
            <div class="table-responsive donly">
                <table class="table tbs table-bordered table-striped">
                    <thead>
                    <tr>
                        <th>
                            PRODUCT
                        </th>
                        <th>QUANTITY</th>
                        <th>UNIT PRICE</th>
                        <th>TOTAL</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php 
            $pc = new ProductAtCategory();
            $total = 0;
            $totaldiskon = 0;
            foreach ($arr as $ss) {
                $obj = new MProdModel();
                $obj->getByID($ss->variant_id);
                $imgurl = $pc->imgURL . $obj->BaseArticleImageFile;
                if ($obj->BaseArticleImageFile == "") {
                    $imgurl = $pc->noimage;
                }
                //durchlaufen disini ..thd rule
                if (count($rule2varians[$obj->VariantID]) > 0) {
                    $uuss = $rule2varians[$obj->VariantID];
                    //set icon
                    $obj->rule_icon = _SPPATH . _PHOTOURL . $rules[$uuss[0]]->rule_icon;
                    //                            pr($uu);
                    //diskon
                    $diskon = 0;
                    foreach ($uuss as $ruleygkena) {
                        $r = $rules[$ruleygkena];
                        $diskon = max($r->rule_discount, $diskon);
                    }
                    $obj->rule_discount = $diskon;
                } else {
                    $obj->rule_icon = "";
                    //default rule icon
                    $obj->rule_discount = 0;
                }
                //                        $totaldiskon += $obj->rule_discount/100*$obj->SellingPrice;
                $obj->final_price = (100 - $obj->rule_discount) / 100 * $obj->SellingPrice;
                $total += $ss->qty * $obj->final_price;
                ?>
                        <tr>
                            <td>
                                <div class="product_list_item_img_cart">
                                    <img src="<?php 
                echo $imgurl;
                ?>
">
                                </div>
                                <div class="product_name">
                                    <?php 
                echo $obj->VariantNameENG;
                ?>
                                </div>
                            </td>
                            <td style="text-align: center;">
                                <select onchange="updateQtyCart('<?php 
                echo $obj->VariantID;
                ?>
',$(this).val());" class="form-control">
                                    <?php 
                for ($x = 1; $x < 10; $x++) {
                    ?>
                                        <option <?php 
                    if ($ss->qty == $x) {
                        echo "selected";
                    }
                    ?>
 value="<?php 
                    echo $x;
                    ?>
"><?php 
                    echo $x;
                    ?>
</option>
                                    <?php 
                }
                ?>
                                </select>
                                <a onclick="removeFromCart('<?php 
                echo $obj->VariantID;
                ?>
');" class="remove">remove <i class="glyphicon glyphicon-play"></i></a>
                            </td>
                            <td class="sprice">
                                <?php 
                if ($obj->final_price != $obj->SellingPrice) {
                    ?>
                                <i class="oldprice" style="font-size: 12px; text-decoration: line-through;"><?php 
                    echo idr($obj->SellingPrice);
                    ?>
</i><br>
                            <?php 
                }
                ?>
                                <i class="newprice"><?php 
                echo idr($obj->final_price);
                ?>
</i>
                            </td>
                            <td class="sprice"><?php 
                echo idr($ss->qty * $obj->final_price);
                ?>
</td>
                        </tr>
                        <?php 
            }
            ?>
                    </tbody>
                </table>
                <script>
                    function updateQtyCart(id,qty){
                        $.post("<?php 
            echo _SPPATH;
            ?>
CartWeb/updateQty",{
                            id:id,qty:qty
                        },function(data){
//                           alert(data);
                            if(data.bool){
                                location.reload();
                            }else{
                                alert("Error");
                            }
                        },'json');
                    }
                    function removeFromCart(id){
                        $.post("<?php 
            echo _SPPATH;
            ?>
CartWeb/removeFrom",{
                            id:id
                        },function(data){
//                           alert(data);
                            if(data.bool){
                                location.reload();
                            }else{
                                alert("Error");
                            }
                        },'json');
                    }
                </script>
            </div>
            <div class="col-md-7" style="padding-right: 0px; padding-left: 0px;">
            <div class="col-md-6  col-sm-6 col-xs-6 donly" style="border: 1px solid #dedede; height: 150px;">

                <h4 style="color: #E2007A;">Is this a Gift?</h4>
                <div class="col-md-4 col-sm-6 col-xs-6" style="padding-left: 0px;">
                    <img width="100%" src="<?php 
            echo _SPPATH;
            ?>
images/bagm_l.jpg">
                </div>
                <div class="col-md-8  col-sm-6 col-xs-6" style="margin-top: 20px;">
                    <button class="btn btn-success" style="background-color: #7fb719;border-color: #7fb719;">ADD GIFT OPTION</button>
                </div>

            </div>
            <div class="col-md-6  col-sm-6 col-xs-6 donly" style="padding: 0px !important;" >
                <div style="1px solid #DDEBA9;background-color: #F3FAD9;
                margin-left: 15px; margin-right: 15px; padding: 10px; height: 150px;">
                    <h4 style="color: #E2007A; padding: 0; margin: 0; margin-bottom: 10px;">Promotion Codes</h4>
                    <p style="font-size: 12px;">If you have a promotion code, please add it here...</p>
                    <input type="text" class="form-control" placeholder="code" style="width: 100px;display: inline;">
                    <button class="btn btn-success" style="background-color: #7fb719;vertical-align: top;border-color: #7fb719;">VERIFY CODE</button>
                </div>

            </div>
                <div class="clearfix"></div>

                <div  class="rule_applied" style="<?php 
            if (count($cart_rules) < 1) {
                echo "display:none;";
            }
            ?>
">
                    <h5 style="margin-top: 0; padding-top: 0;">Applicable Promotions</h5>
                    <?php 
            $numpromo = 0;
            foreach ($cart_rules as $crules) {
                if ($crules->rule_apply_to == "by_percent") {
                    if ($total >= $crules->rule_amount_limit) {
                        $numpromo++;
                        ?>

                                *<?php 
                        echo $crules->rule_name;
                        ?>
<br>
                            <?php 
                    }
                }
                if ($crules->rule_apply_to == "free_shipping") {
                    if ($total >= $crules->rule_amount_limit) {
                        $numpromo++;
                        ?>
                                *<?php 
                        echo $crules->rule_name;
                        ?>
<br>
                                <?php 
                    }
                }
            }
            ?>
                </div>
                <div class="clearfix monly" style="margin-bottom: 10px;"></div>
                <script>
                    <?php 
            if ($numpromo < 1) {
                ?>
                    $(document).ready(function(){
                        $('.rule_applied').hide();
                    });
                <?php 
            }
            ?>
                </script>
                <style>
                    .rule_applied{
                        margin-top: 10px; background-color: #f6f6f6; padding: 10px; margin-right: 15px;
                    }
                </style>

            </div>
            <div class="col-md-5" style="padding-right: 0px; padding-left: 0px;">

                <?php 
            $cartdiskon = 0;
            $isFreeShipping = 0;
            foreach ($cart_rules as $crules) {
                if ($crules->rule_apply_to == "by_percent") {
                    if ($total >= $crules->rule_amount_limit) {
                        $cartdiskon = max($cartdiskon, $crules->rule_discount);
                    }
                }
                if ($crules->rule_apply_to == "free_shipping") {
                    if ($total >= $crules->rule_amount_limit) {
                        $isFreeShipping = 1;
                    }
                }
            }
            $cartdikonharga = $cartdiskon / 100 * $total;
            $totaldiskon = $totaldiskon + $cartdikonharga;
            ?>
                <div class="subtotal">
                    <h4 style="color: #444444;">
                        <div class="col-md-7 col-sm-6 col-xs-6" style="padding: 0px;">
                            Subtotal
                        </div>
                        <div class="col-md-5 col-sm-6 col-xs-6" style="padding: 0px;">
                            IDR <?php 
            echo idr($total);
            ?>
                        </div> <div class="clearfix"></div>
                    </h4>
                    <h4 style="color: #E2007A;">
                        <div class="col-md-7 col-sm-6 col-xs-6" style="padding: 0px;">
                           Extra Discount
                        </div>
                        <div class="col-md-5 col-sm-6 col-xs-6" style="padding: 0px;">
                            IDR <?php 
            echo idr($totaldiskon);
            ?>
                        </div><div class="clearfix"></div>
                    </h4>
<!--                    <h4 style="color: #E2007A;">-->
<!--                        <div class="col-md-7" style="padding: 0px;">-->
<!--                            Loyalty Programme Voucher-->
<!--                        </div>-->
<!--                        <div class="col-md-5" style="padding: 0px;">-->
<!--                            IDR 0-->
<!--                        </div><div class="clearfix"></div>-->
<!--                    </h4>-->
                    <div class="clearfix"></div>
                    <hr>
                    <h4>
                        <div class="col-md-7 col-sm-6 col-xs-6"  style="padding: 0px;">
                            Delivery
                        </div>
                        <div class="col-md-5 col-sm-6 col-xs-6" style="padding: 0px;">
                            <select <?php 
            if ($isFreeShipping) {
                ?>
disabled<?php 
            }
            ?>
>
                                <?php 
            if ($isFreeShipping) {
                ?>
                                    <option>Free Delivery IDR 0</option>
                                <?php 
            }
            ?>
                                <option>delivery1 IDR 30.000</option>
                                <option>cepat IDR 50.000</option>
                            </select>
                        </div><div class="clearfix"></div>
                         </h4>
                    <hr>
                    <h3>Total IDR <?php 
            echo idr($total - $totaldiskon);
            ?>
</h3>
                </div>
                <div style="text-align: right; padding-top: 20px;">
                    <button id="checkoutButton" class="btn btn-success btn-lg" style="background-color: #E2007A;border-color:#E2007A; ">
                        CHECK OUT SECURELY NOW <i class="glyphicon glyphicon-play"></i> </button>
<script>
    $('#checkoutButton').click(function(){
        $.post("<?php 
            echo _SPPATH;
            ?>
CartWeb/isiCart",{
            totalplusdiskon : <?php 
            echo $total - $totaldiskon;
            ?>
,
            total : <?php 
            echo $total;
            ?>
,
            diskon : <?php 
            echo $totaldiskon;
            ?>
        },function(data){
            if(data.bool){
                document.location = "<?php 
            echo _SPPATH;
            ?>
checkout";
            }
            else{
                alert("error");
            }
        },'json');
    });
</script>
                </div>
                  </div>
            <div class="clearfix"></div>
            <div class="monly" style="margin-top: 30px;"></div>
            <div class="lanjut">
                <a href="<?php 
            echo _SPPATH;
            ?>
">continue shopping</a>
            </div>
            <style>
                a.remove{
                  color: #888888;
                    font-size: 12px;
                    cursor: pointer;
                }
                .subtotal{
                    border: 1px solid #BBBBBB;color: #666666; background-color: #EBEBEB; text-align: right;
                    padding-right: 10px;
                    padding-left: 10px;;
                }
                .subtotal hr{

                    border:1px dashed #999999;
                }
                .subtotal h4{
                    font-size: 16px;
                }
                h1.tbs{

                    clear: both;
                    color: #7FB719;
                    margin-top:50px;
                    font: 40px bebasneue,Impact,Charcoal,sans-serif;
                }
                .product_list_item_img_cart {
                    width: 80px;
                    height: 80px;
                    overflow: hidden;
                    margin: 5px;
                    text-align: center;
                    float: left;

                }

                .product_list_item_img_cart img{
                    max-width: 100%;
                    max-height: 100%;
                }
                .product_name{
                    margin-left: 100px;
                    height: 90px;
                    font-weight: bold;
                    color: #777777;
                    line-height: 90px;
                    text-overflow: ellipsis;

                    overflow: hidden;
                    /*white-space:nowrap;*/
                    display: -webkit-box;
                    -webkit-line-clamp: 1;
                    -webkit-box-orient: vertical;
                }
                table.tbs thead{
                    background-color: #dedede;

                }
                table.tbs thead th{
                    text-align: center;
                }
                .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{
                    vertical-align: middle;
                }
                .sprice{

                    text-align: right;
                    font-weight: bold;
                    color :#888888;

                }
            </style>
        <?php 
        } else {
            ?>
            <h1 style="margin-top: 50px; margin-bottom: 50px; text-align: center">Empty BAG</h1>

        <?php 
        }
    }
    public static function my()
    {
        $acc = MemberLogin::getMember();
        ?>
        <div id="mycard" style="position: fixed; height: 100%;  top:0px; left: 0px; width: 100%; z-index: 100; background-color: rgba(0,0,0,0.8);">
            <div class="container">
                <div class="row">
                    <div class="monly" style="height: 60px;"></div>

                        <div class="bgcard" style="margin: auto; margin-top: 40px; color: #FFFFFF;" >
                            <div style="float: right; margin-right: 5px;cursor: pointer; width: 10px; height: 10px;" onclick="$('#mycard').hide();">x</div>
                            <div style="padding-top: 72px; margin-left: 20px;">
                                <div class="lybname" style="font-size: 21px;"><?php 
        echo ucwords($acc->macc_first_name . " " . $acc->macc_last_name);
        ?>
</div>
                                <div class="lybname" style="font-size: 15px;">Card # : <?php 
        echo $acc->macc_card_nr;
        ?>
</div>
                                <div class="lybname" style="font-size: 15px;"><?php 
        echo $acc->macc_lyb_status;
        ?>
</div>
                                <div class="lybname" style="font-size: 15px;">Points : <?php 
        echo $acc->macc_points;
        ?>
</div>

                            </div>
                            <div style="padding-top: 215px; margin-left: 100px;">
                                <div class="lybname" style="font-size: 15px;">Expiry Date : <?php 
        echo date("M j, Y", strtotime($acc->macc_lyb_expiry_date));
        ?>
</div>
                            </div>
                        </div>

                </div>
            </div>

        </div>
        <style>
            .bgcard{
                width: 300px;
                height: 482px;
                background-image: url(<?php 
        echo _SPPATH;
        ?>
images/lybcard.jpg);
                background-size: 300px 482px;
            }
        </style>
<!--        <div class="monly" style="height: 60px;"></div>-->
        <div class="col-md-10 col-md-offset-1" style="margin-top: 40px;">
            <div style="float: right; width: 20px; height: 20px; font-size: 30px;color: #777777;">
                <i style="cursor: pointer;" onclick="$('#mycard').toggle();" class="glyphicon glyphicon-credit-card"></i>
            </div>
        <h3 style="margin-bottom: 20px;">
            <?php 
        if ($acc->macc_lyb_status == "LYB Fan") {
            ?>
                <img height="80px" src="<?php 
            echo _SPPATH;
            ?>
images/fan.jpg" align="absmiddle">
            <?php 
        }
        ?>
            <?php 
        echo ucwords($acc->macc_first_name . " " . $acc->macc_last_name);
        ?>
        </h3>
        </div>
        <div class="clearfix"></div>
        <div class="col-md-5 col-md-offset-1" style="margin-top: 20px;">

            <table class="table" style="color: #777777;">
                <tr>
                    <td>Points</td>
                    <td><b><?php 
        echo $acc->macc_points;
        ?>
</b></td>
                </tr>
                <tr>
                    <td>Expiry Date</td>
                    <td><?php 
        echo date("d/m/Y", strtotime($acc->macc_lyb_expiry_date));
        ?>
</td>
                </tr>
                <tr>
                    <td>Card Number</td>
                    <td><?php 
        echo $acc->macc_card_nr;
        ?>
</td>
                </tr>
                <tr>
                    <td>Membership Status</td>
                    <td><?php 
        echo $acc->macc_lyb_status;
        ?>
</td>
                </tr>
            </table>

        </div>
        <div class="col-md-5" style="margin-top: 20px;">

            <table class="table" style="color: #777777;">
                <tr>
                    <td>Gender</td>
                    <td><?php 
        echo $acc->macc_gender;
        ?>
</td>
                </tr>
                <tr>
                    <td>Date of Birth</td>
                    <td><?php 
        echo $acc->macc_dob;
        ?>
</td>
                </tr>
                <tr>
                    <td>Email</td>
                    <td><?php 
        echo $acc->macc_email;
        ?>
</td>
                </tr>
                <tr>
                    <td>Phone</td>
                    <td><?php 
        echo $acc->macc_phone;
        ?>
</td>
                </tr>



            </table>
        </div>
        <div class="clearfix"></div>

        <div class="col-md-10 col-md-offset-1" style="margin-top: 20px;">
            <hr>
            <h3 style="margin-bottom: 20px;">Statements</h3>

            <?php 
        if (isset($acc->statements->transactions) && is_array($acc->statements->transactions)) {
            $arr = $acc->statements->transactions;
            $rev = array_reverse($arr);
            ?>
                <div class="table-responsive">
                <table class="table table-striped" style="color: #777777;">
                <?php 
            foreach ($rev as $st) {
                ?>
                    <tr>
                        <td style="max-width: 80px;">
                            <?php 
                echo $st->TransactionDateTime;
                ?>
                        </td>
                        <td >
                            <?php 
                echo $st->StoreName;
                ?>
                        </td>
<!--                        <td>-->
<!--                            --><?php 
                //=$st->Description;
                ?>
<!--                        </td>-->
                        <td >
                            <?php 
                echo str_replace(" ", "<br>", $st->Cash_Type);
                ?>
                        </td>
                        <td style="text-align: right;">
                            <?php 
                echo $st->Cash_Currency;
                ?>
 <?php 
                echo idr($st->Cash_Value);
                ?>
                        </td>
                    </tr>

                    <?php 
            }
            ?>
</table></div><?php 
        } else {
            echo "You have no transaction yet";
        }
        ?>
        </div>
        <div class="clearfix"></div>
        <?php 
        //        pr(MemberLogin::getMember());
    }
Пример #11
0
<?php

include 'config/connect.php';
include 'config/function.php';
$q = strtolower($_GET["q"]);
if (!$q) {
    return;
}
$SQLbrg = yposSQL('SHOW', 'ypos_barang', '*', "nama_barang LIKE '%{$q}%'");
$cekBrg = $SQLbrg->num_rows;
if ($cekBrg > 0) {
    while ($brg = $SQLbrg->fetch_array()) {
        $resBrg = $brg['kdbarang'] . ' - ' . $brg['nama_barang'] . ' (Rp : ' . idr($brg['harga_jual']) . ')';
        echo "{$resBrg}\n";
    }
} else {
    echo "\n";
    echo '<b>Data tidak ada ..</b>';
}
Пример #12
0
    echo $r['qty_beli'];
    ?>
</td>
    <td><?php 
    echo idr($r['harga_beli']);
    ?>
</td>
    <td><?php 
    echo idr($r['total']);
    ?>
</td>
  </tr>
  <?php 
    $no++;
}
?>
  <tr align="center" bgcolor="#CCCCCC">
  <th colspan="2">Total</th>
  <th colspan="4">&nbsp;</th>
  <th><?php 
echo idr($tot['total']);
?>
</th>
  </tr>
</table>
</div>
<br/><br/>
<hr size="4" color="#000000" />
(s) : satuan
</body>
</html>
Пример #13
0
    ?>
</td>
    <td><?php 
    echo idr($r['harga_beli']);
    ?>
</td>
    <td><?php 
    echo idr($r['harga_jual']);
    ?>
</td>
  </tr>
  <?php 
    $no++;
}
?>
  <tr align="center" bgcolor="#CCCCCC">
  <th colspan="2">Total</th>
  <th>&nbsp;</th>
  <th><?php 
echo idr($tot['stok']);
?>
</th>
  <th></th>
  <th></th>
  </tr>
</table>
</div>
<br/><br/>
<hr size="4" color="#000000" />
</body>
</html>
Пример #14
0
    public static function myfreebies()
    {
        $mon = isset($_GET['mon']) ? addslashes($_GET['mon']) : date("n");
        $y = isset($_GET['y']) ? addslashes($_GET['y']) : date("Y");
        $monthNum = $mon;
        $dateObj = DateTime::createFromFormat('!m', $monthNum);
        $monthName = $dateObj->format('F');
        // March
        ?>
        <style>
            .heading_earning{
                font-size: 17px;
                font-style: italic;
            }
            .heading_amount{
                font-size: 40px;
            }

            .inside{
                padding: 20px;
            }
            .selectMonth{
                /*padding-left: 10px;*/
            }
            .payout{
                color: #95abc2;
            }
            .money{
                font-size: 22px;
                color: #73879C;
            }
            .big{
                font-size: 30px;
                color: #73879C;
            }
            .rev_item{
                background-color: #ffffff;
                margin-top: 20px;
                margin-bottom: 20px;
            }
            .order_id{
                font-size: 20px;
                color: #73879C;
            }
            .pdate{
                color: #73879C;
                font-style: italic;
            }
            .heading_amount{
                font-size: 30px;
                text-align: right;
                padding-bottom: 100px;
            }
            .heading_amount_Sales{
                font-size: 18px;
                text-align: right;
                /*padding-bottom: 20px;*/
            }

            @media (max-width: 768px) {

                .monly {
                    display: initial;
                }

                .donly {
                    display: none;
                }

                .selectMonth{
                    padding-left: 0px;
                    padding-bottom: 20px;
                    border-bottom: 1px solid #CCCCCC;
                }
                .rightborder{
                    border-bottom: 1px solid #CCCCCC;
                }
                .leftborder{
                    border-top: 1px solid #CCCCCC;
                }
                .inside{
                    padding: 10px;
                }

            }

            @media (min-width: 768px) {
                .monly {
                    display: none;
                }

                .donly {
                    display: initial;
                }

                .leftborder{
                    border-left: 1px solid #CCCCCC;
                }

                .rightborder{
                    border-right: 1px solid #CCCCCC;
                }
            }
        </style>
        <div class="container attop"  >
            <div class="col-md-12">
                <div class="appear_logo_pages">
                    <a href="<?php 
        echo _SPPATH;
        ?>
">
                        <img src="<?php 
        echo _SPPATH;
        ?>
images/appear-agent.png" >
                    </a>
                </div>

                <div id="attratas">

                     <button onclick="document.location='<?php 
        echo _SPPATH;
        ?>
mydashboard';" class="btn btn-success btn-abu" style="margin: 0px;  ">Dashboard</button>

                </div>

                <div class="clearfix"></div>
                <div  class="col-md-12" id="comission" >
                    <div class="selectMonth" id="selectMonth" style=" padding-bottom: 10px;">
                        <div style="float: left;">
                            <div style="float: left; line-height: 34px; padding-right: 10px;">Month</div>
                            <div style="float: left;">
                                <select id="mon" class="form-control">
                                    <?php 
        for ($x = 1; $x < 13; $x++) {
            ?>
                                        <option <?php 
            if ($mon == $x) {
                echo "selected";
            }
            ?>
 value="<?php 
            echo $x;
            ?>
"><?php 
            echo $x;
            ?>
</option>
                                    <?php 
        }
        ?>
                                </select>
                            </div>
                        </div>
                        <div style="float: left;">
                            <div style="float: left; line-height: 34px; padding-right: 10px; padding-left: 10px;">Year</div>
                            <div style="float: left;">
                                <select id="year" class="form-control">
                                    <?php 
        for ($x = 2016; $x < 2030; $x++) {
            ?>
                                        <option <?php 
            if ($y == $x) {
                echo "selected";
            }
            ?>
  value="<?php 
            echo $x;
            ?>
"><?php 
            echo $x;
            ?>
</option>
                                    <?php 
        }
        ?>
                                </select>
                            </div>
                        </div>
                        <div style="float: left; padding-left: 10px;">
                            <button id="change" type="button" class="btn btn-default">Go</button>
                        </div>

                        <div class="clearfix"></div>




                        <script>
                            $('#change').click(function(){
                                document.location = '<?php 
        echo _SPPATH;
        ?>
myfreebies?mon='+$('#mon').val()+'&y='+$('#year').val();
//                openLw("Comissioning",'<?php 
        //=_SPPATH;
        ?>
//FinanceBE/comissioning?mon='+$('#mon').val()+'&y='+$('#year').val(),'fade');
                            });
                        </script>
                    </div>


                    <div id="rev">
                        <h3><?php 
        echo $monthName;
        ?>
 <?php 
        echo $y;
        ?>
 Earnings</h3>
                        <?php 
        $arr = AppearSales::getFreebiesRevenueArray(Account::getMyID(), $mon, $y);
        //                pr($arr);
        $total = 0;
        foreach ($arr as $tt) {
            $app = new AppAccount();
            $app->getByID($tt->komisi_app_id);
            $acc = new Account();
            $acc->getByID($tt->komisi_app_client_id);
            $paket = new Paket();
            $paket->getByID($tt->komisi_paket_id);
            $total += $tt->komisi_value;
            ?>
                            <div class="rev_item col-md-12">
                                <div class="col-md-5 ">
                                    <div class="inside">
                                        <div class="payout col-md-6 col-sm-6 col-xs-6">
                                            <div class="rev_details2">
                                                <small>Order ID</small>
                                                <div class="order_id"><?php 
            echo $tt->komisi_order_id;
            ?>
</div>
                                            </div>
                                        </div>
                                        <div class="payout col-md-6 col-sm-6 col-xs-6">
                                            <div class="rev_details">
                                                Date : <?php 
            echo $tt->komisi_app_date;
            ?>
                                            </div>
                                            <div class="rev_details">
                                                App : <?php 
            echo $app->app_name;
            ?>
                                            </div>
                                            <div class="rev_details">
                                                Client : <?php 
            echo $acc->admin_nama_depan;
            ?>
                                            </div>
                                            <div class="rev_details">
                                                Paket  : <?php 
            echo $paket->paket_name;
            ?>
                                            </div>
                                        </div>
                                        <div class="clearfix"></div>
                                    </div>
                                </div>

                                <div class="col-md-4 leftborder rightborder">
                                    <div class="inside">
                                        <div class="payout col-md-6 col-sm-6 col-xs-6">
                                            First Payout
                                            <div class="money">IDR <?php 
            echo idr($tt->komisi_bagi_pertama_value);
            ?>
</div>
                                            <small>will be processed on</small>
                                            <div class="pdate"><?php 
            echo date("d-m-Y", strtotime($tt->komisi_bagi_pertama_date));
            ?>
</div>
                                            <small>*if agent ready</small>
                                        </div>
                                        <div class="payout col-md-6 col-sm-6 col-xs-6">
                                            Second Payout
                                            <div class="money">IDR <?php 
            echo idr($tt->komisi_bagi_kedua_value);
            ?>
</div>
                                            <small>will be processed on</small>
                                            <div class="pdate"><?php 
            echo date("d-m-Y", strtotime($tt->komisi_bagi_kedua_date));
            ?>
</div>

                                            <small>*if agent ready</small>
                                        </div>
                                        <div class="clearfix"></div>
                                    </div>
                                </div>

                                <div class="col-md-3 payout">
                                    <div class="inside">
                                        <div class="komisi">
                                            Total Commision
                                            <div class="money big">IDR <?php 
            echo idr($tt->komisi_value);
            ?>
</div>
                                        </div>
                                    </div>
                                </div>
                                <div class="clearfix"></div>
                            </div>
                        <?php 
        }
        ?>

                        <div class="heading_amount_Sales">Number of Freebies <?php 
        echo count($arr);
        ?>
</div>

                        <div class="heading_amount">Total Earning IDR <?php 
        echo idr($total);
        ?>
</div>
                    </div>

                </div>
            </div>
        </div>
    <?php 
    }
    public static function printer($id, $name)
    {
        if ($_GET['cardnr'] != '' && $_GET['dob'] != '') {
            //diloginkan langsung
            MemberLogin::loginkanLangsung();
        }
        $prod = new MProdModel();
        $prod->getByID($id);
        if ($prod->VariantID == "") {
            MemberLogin::handleNotFound();
        }
        $pc = new ProductAtCategory();
        $imgurl = $pc->imgURL . $prod->BaseArticleImageFile;
        if ($prod->BaseArticleImageFile == "") {
            $imgurl = $pc->noimage;
        }
        $prod->updateView();
        global $template;
        if ($prod->prod_seo_title != "") {
            $template->title = $prod->prod_seo_title;
        }
        if ($prod->prod_seo_meta_description != "") {
            $template->metades = $prod->prod_seo_meta_description;
        }
        if ($prod->prod_seo_meta_key != "") {
            $template->metakey = $prod->prod_seo_meta_key;
        }
        $addTextToHead = '';
        if ($prod->prod_seo_fbog_title != "") {
            $addTextToHead .= '<meta property="og:title" content=" ' . $prod->prod_seo_fbog_title . ' " />';
        }
        if ($prod->prod_seo_fbog_description != "") {
            $addTextToHead .= '<meta property="og:description" content="' . $prod->prod_seo_fbog_description . '" />';
        }
        if ($prod->prod_seo_fbog_image != "") {
            $addTextToHead .= '<meta property="og:image"  content="' . _BPATH . _PHOTOURL . $prod->prod_seo_fbog_image . '" />';
        }
        if ($addTextToHead != "") {
            $actual_link = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
            $addTextToHead .= '<meta property="og:site_name" content="' . $template->title . '"/>';
            $addTextToHead .= '<meta property="og:url" content="' . $actual_link . '" />';
            $addTextToHead .= '<meta property="fb:app_id" content="510260392457364" />';
            $addTextToHead .= '<meta property="og:type" content="website" />';
        }
        $template->addTextToHead($addTextToHead);
        /*
         * Apply rule to variant
         *
         */
        $rules = MCPRule::getRules();
        $rules2variant = MCPRule::getRules2Variant();
        if (count($rules2variant[$id]) > 0) {
            $uu = $rules2variant[$prod->VariantID];
            //set icon
            $prod->rule_icon = _SPPATH . _PHOTOURL . $rules[$uu[0]]->rule_icon;
            //                            pr($uu);
            //diskon
            $diskon = 0;
            foreach ($uu as $ruleygkena) {
                $r = $rules[$ruleygkena];
                $diskon = max($r->rule_discount, $diskon);
            }
            $prod->rule_discount = $diskon;
        } else {
            $prod->rule_icon = "";
            //default rule icon
            $prod->rule_discount = 0;
        }
        $prod->final_price = (100 - $prod->rule_discount) / 100 * $prod->SellingPrice;
        //    pr($prod);
        ?>
        <div style="margin-top: 40px;" class="donly">&nbsp;</div>
        <div class="col-md-4 col-md-offset-1" >

            <img src="<?php 
        echo $imgurl;
        ?>
" style="width: 100%;">
        </div>
        <div class="col-md-6">
            <h1 style="font-size: 25px;"><?php 
        echo $prod->BaseArticleNameENG;
        ?>
</h1>

        <div style="float: left; line-height: 40px;">
            <img src="http://thebodyshop.ugc.bazaarvoice.com/6097-en_gb/4_7/5/rating.gif" class="BVImgOrSprite" alt="4.7 / 5" title="4.7 / 5">
            </div>
            <?php 
        if ($prod->rule_icon != "") {
            $uu = $rules2variant[$prod->VariantID];
            ?>
                <div style="float: right; opacity: 0.7;">
                    <?php 
            foreach ($uu as $ruleygkena) {
                $r = $rules[$ruleygkena];
                ?>
                        <a style="text-decoration: none;" href="#" data-toggle="tooltip" data-placement="bottom" title="<?php 
                echo $r->rule_description;
                ?>
">
                        <img  style="width: 30px; height: 30px; margin: 5px;" src="<?php 
                echo _SPPATH . _PHOTOURL . $r->rule_icon;
                ?>
">
                        </a>
                    <?php 
            }
            ?>
                </div>
                <script>
                    $(document).ready(function(){
                        $('[data-toggle="tooltip"]').tooltip();
                    });
                </script>
            <?php 
        }
        ?>
            <div class="clearfix"></div>

            <p style="margin-top: 20px; margin-bottom: 10px;"><?php 
        echo $prod->ArticleInfoENG;
        ?>
</p>

            <?php 
        $pricetext = "";
        if ($prod->rule_discount > 0) {
            $pricetext = "IDR " . idr($prod->SellingPrice);
        }
        ?>
            <div class="priceprod priceprod_small"><?php 
        echo $pricetext;
        ?>
</div>
            <div class="priceprod">IDR <?php 
        echo idr($prod->final_price);
        ?>
</div>
            <div class="traditional_add">
                <a class="add" data-toggle="modal" data-variant="<?php 
        echo $prod->VariantID;
        ?>
"
                   data-url="<?php 
        echo _SPPATH;
        ?>
pr/p/<?php 
        echo $prod->VariantID;
        ?>
/<?php 
        echo ProductAtCategory::bersihkanNama($prod->BaseArticleNameENG);
        ?>
"
                   data-imgUrl="<?php 
        echo $imgurl;
        ?>
"
                   data-articlename="<?php 
        echo $prod->BaseArticleNameENG;
        ?>
"
                   data-target="#myModal" style="cursor: pointer; font-size: 20px; padding: 10px;">ADD TO BAG</a>
            </div>
            <div class="pemesanan" style="display: none;">
                <div style="float: left;">
                <table class="qtyvar">
                    <tr>
                        <td>Quantity</td>
<!--                        <td>Varian</td>-->
                    </tr>
                    <tr>
                        <td>
                        <select class="form-control">
                            <?php 
        for ($x = 1; $x < 10; $x++) {
            ?>
                                <option value="<?php 
            echo $x;
            ?>
"><?php 
            echo $x;
            ?>
</option>
                            <?php 
        }
        ?>
                        </select>
                        </td>
                        <td>
<!--                            <select class="form-control">-->
<!--                                <option value="">Varian 1</option>-->
<!--                                <option value="">Varian 2</option>-->
<!--                            </select>-->
                        </td>
                    </tr>
                </table>
                </div>
                <div style="margin-left: 220px;">
                    <div class="addbut">

                    </div>
                </div>
                <div class="clearfix"></div>
            </div>

        </div>

        <div class="clearfix"></div>

        <style>
            table.qtyvar td{
                padding: 5px;
            }
            .pemesanan{
                border: 1px solid #cccccc;
                background-color: #efefef;
                padding: 10px;
            }
            .addbut{
                background-color: #e2007a;
                color: #FFFFFF;
                padding: 10px;
                font-size: 19px;
                font-weight: bold;
                text-align: center;
                margin-top: 15px;
                width: 190px;
            }

            .priceprod{
                color: #e2007a;
                font-size: 37px;
                font-weight: bold;
                /*margin-top: 20px;*/
                margin-bottom: 20px;
            }
            .priceprod_small{
                font-size: 15px;
                margin-top: 20px;
                text-decoration: line-through;
                margin-bottom: 0px;
            }
            .imgstamp{
                position: absolute;
                width: 60px;
                /*height: 50px;*/
                overflow: hidden;
                opacity: 0.6;
            }
            div.imgstamp img{
                /*min-width: 100% !important;*/
                /*min-height: 100% !important;*/
            }
        </style>
        <div class="col-md-10 col-md-offset-1" style="margin-top: 40px;" >
            <ul class="nav nav-tabs nav-justified">
                <li class="active"><a data-toggle="tab" href="#review">REVIEW</a></li>
                <li><a data-toggle="tab" href="#ingredients">INGREDIENTS</a></li>
                <li><a data-toggle="tab" href="#howtouse">HOW TO USE</a></li>
                <li><a data-toggle="tab" href="#whatsinside">WHATS INSIDE</a></li>
            </ul>
            <div class="tab-content isilain">
                <div id="review" class="tab-pane fade in active dalaman">
                    <div class="review_item">
                        <div class="col-md-3">
                        <div class="review_username">Jeanne Schroeder</div>
                        <div class="review_star"><img src="http://thebodyshop.ugc.bazaarvoice.com/6097-en_gb/4_0/5/rating.gif" class="BVImgOrSprite" alt="4 / 5" title="4 / 5"></div>
                        </div>
                        <div class="col-md-9">
                            <div class="review_date">20 January 2016</div>
                        <div class="review_text">
                            <div class="review_title">GOOD BUY</div>
                            I'm a natural sister. Recently did the big chop so my hair is completely natural no relaxed ends and its very coarse and doesn't exactly have a curl pattern. For other natural girls I'd say I'm a 4C (4D really lool) in regards of hair texture. Through my transition i noticed that my scalp is very dry, itchy and flaky even after washing it a day or 2 later it'll flake up. I've tried nizoral shampoo recommended by a friend which is also good for dry & itchy scalp however i felt it left my feeling hard afterwards plus its like £6 for a very small bottle. I'm a lover of all things body shop so when i saw this I'd thought I'd give it a go. It smells great it feels my hair feeling soft and scalp free from flaking. I had a lil flaking a few days after so i applied oil to my scalp as normal to defuse it. i've used this shampoo twice now and the second time round it definietly had a better affect so after 3 months or so i can only imagine my scalp would have improved
                        </div>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <div class="review_item noborder" style="margin-top: 20px;">
                        <div class="col-md-3">
                            <div class="review_username">Michelle Stark</div>
                            <div class="review_star"><img src="http://thebodyshop.ugc.bazaarvoice.com/6097-en_gb/4_0/5/rating.gif" class="BVImgOrSprite" alt="4 / 5" title="4 / 5"></div>
                        </div>
                        <div class="col-md-9">
                            <div class="review_date">7 January 2016</div>
                            <div class="review_text">
                                <div class="review_title">LIFE CHANGER!</div>
                                My son (aged 11 and an early developer, I think this is why he started with his scalp problem) is over the moon as am I. We tried everything from Leading Anti-Dandruff Brands to home remedies. This worked after the first use and his scalp was clear after the second use. This is the only shampoo he can use as it helps to keep his sore flaking scalp under control. He uses it 3 times a week and has no flakes or red sores/itching. Highly recommend.
                                <br><br>Downside: There are chemicals like SLS in it which I know cause flakes/eczema etc, but seeing as it is the only shampoo that keeps his head clear we will continue to use it.

                            </div>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                </div>
                <div id="ingredients" class="tab-pane fade dalaman">
                    <?php 
        echo $prod->IngredientENG;
        ?>
                </div>
                <div id="howtouse" class="tab-pane fade dalaman">
                    <?php 
        echo $prod->HowToUseENG;
        ?>
                </div>
                <div id="whatsinside" class="tab-pane fade dalaman">
                    <?php 
        echo $prod->WhatInsideENG;
        ?>
                </div>
            </div>
        </div>
        <style>
            .review_item{
                border-bottom: 1px dotted #cccccc;
                padding-bottom: 20px;
            }
            .review_username{
                font-weight: bold;
            }
            .review_title{
                font-weight: bold;
                margin-bottom: 20px;
                font-size: 15px;
            }
            .review_date{
                text-align: right;
                font-size: 11px;
                color: #888888;
                float: right;
            }
            .isilain{
                /*background-color: #efefef;*/
                border: 1px solid #dddddd;
                border-top: 0px;
            }
            .isilain h3{
                padding: 0;
                margin: 0;

            }
            .dalaman{
                padding: 20px;
            }
            .nav-tabs li{
                background-color: #efefef;
                border-right: 1px solid #FFFFFF;
            }
            .nav-tabs li a{
                color: #7FB719;
            }
            .nav-tabs li.active a{
                font-weight: bold;
                color: #999999;
            }
        </style>
        <div class="clearfix"></div>
        <?php 
        $at = new LL_ArticleTagging_wbase();
        $ats = $at->getWhereFromMultipleTable("BaseArticleID = '{$prod->BaseArticleID}' AND TaggingLevel3ID = cat_id", array("MProdCat"));
        //        pr($ats);
        if (count($ats) > 0) {
            ?>
            <div class="col-md-10 col-md-offset-1" style="margin-top: 20px;">
                Similar Categories : <?php 
            foreach ($ats as $cat) {
                ?>
                    <span class="category"><a class="discover"
                                              href="<?php 
                echo _SPPATH;
                ?>
pr/w3/<?php 
                echo $cat->cat_id;
                ?>
/<?php 
                echo $cat->cat_name;
                ?>
"><?php 
                echo $cat->cat_name;
                ?>
</a> </span> &nbsp;
                    <?php 
                $impcat[] = "TaggingLevel3ID = '{$cat->cat_id}'";
            }
            $queryImp = implode(" OR ", $impcat);
            $atprod = $at->getWhereFromMultipleTable("(" . $queryImp . ") AND ArticleType = 'Base' AND {$prod->table_name}.VariantID != '{$id}' AND {$at->table_name}.BaseArticleID = {$prod->table_name}.BaseArticleID LIMIT 0,12", array("MProdModel"));
            $atprod = array_reverse($atprod);
            //                            pr($atprod);
            $sudahCarousel = array();
            foreach ($atprod as $atss) {
                if (!in_array($atss->VariantID, $sudahCarousel)) {
                    $sudahCarousel[] = $atss->VariantID;
                    $masukan[] = $atss;
                }
            }
            $atprod = $masukan;
            if (count($atprod) > 0) {
                ?>


                <div class="recommended_items"
                     style="margin-top: 10px; border:1px dashed #cccccc; padding-right: 10px; padding-left: 10px; margin-bottom: 30px;">
                    <!--recommended_items-->

                    <div id="recommended-item-carousel" class="carousel slide" data-ride="carousel">
                        <div class="carousel-inner" style="padding: 20px;">
                            <?php 
                $cnt = count($atprod);
                $page = ceil($cnt / 4);
                for ($x = 1; $x <= $page; $x++) {
                    ?>
                                <div class="item <?php 
                    if ($x == 1) {
                        echo "active";
                    }
                    ?>
">
                                    <?php 
                    for ($y = 0; $y < 4; $y++) {
                        if (count($atprod) > 0) {
                            $atss = array_pop($atprod);
                            //durchlaufen disini ..thd rule
                            if (count($rules2variant[$atss->VariantID]) > 0) {
                                $uu = $rules2variant[$atss->VariantID];
                                //set icon
                                $atss->rule_icon = _SPPATH . _PHOTOURL . $rules[$uu[0]]->rule_icon;
                                //                            pr($uu);
                                //diskon
                                $diskon = 0;
                                foreach ($uu as $ruleygkena) {
                                    $r = $rules[$ruleygkena];
                                    $diskon = max($r->rule_discount, $diskon);
                                }
                                $atss->rule_discount = $diskon;
                            } else {
                                $atss->rule_icon = "";
                                //default rule icon
                                $atss->rule_discount = 0;
                            }
                            $atss->final_price = (100 - $atss->rule_discount) / 100 * $atss->SellingPrice;
                            $pc = new ProductAtCategory();
                            $imgurl = $pc->imgURL . $atss->BaseArticleImageFile;
                            if ($atss->BaseArticleImageFile == "") {
                                $atss = $pc->noimage;
                            }
                            ?>
                                            <div class="prod-item col-md-3 col-sm-6 col-xs-6">

                                                <a href="<?php 
                            echo _SPPATH;
                            ?>
pr/p/<?php 
                            echo $atss->VariantID;
                            ?>
/<?php 
                            echo ProductAtCategory::bersihkanNama($atss->BaseArticleNameINA);
                            ?>
">
                                                    <?php 
                            if ($atss->rule_icon != "") {
                                ?>
                                                        <div class="imgstamp_ole">
                                                            <img src="<?php 
                                echo $atss->rule_icon;
                                ?>
" width="60px">
                                                        </div>
                                                    <?php 
                            }
                            ?>
                                                    <div class="product_list_item_img2">
                                                    <img
                                                        src="<?php 
                            echo $imgurl;
                            ?>
"
                                                        >
                                                    </div>
                                                </a>
                                                <b class="elips"><a
                                                        href="<?php 
                            echo _SPPATH;
                            ?>
pr/p/<?php 
                            echo $atss->VariantID;
                            ?>
/<?php 
                            echo ProductAtCategory::bersihkanNama($atss->BaseArticleNameINA);
                            ?>
">
                                                        <?php 
                            echo $atss->BaseArticleNameINA;
                            ?>
</a></b>

                                                <!--                                <p class="elips">-->
                                                <?php 
                            //=$atss->ArticleInfoENG;
                            ?>
<!--</p>-->

                                                <!--                                <div class="rating">-->
                                                <!--                                    <div class="rating">-->
                                                <!--                                        <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>-->
                                                <!--                                    </div>-->
                                                <!---->
                                                <!--                                </div>-->
                                                <?php 
                            //pr($obj);
                            if ($atss->rule_discount > 0) {
                                ?>
                                                    <div class="item_price item_price_small">
                                                        IDR <?php 
                                echo idr($atss->SellingPrice);
                                ?>
</div>
                                                    <div class="item_price">IDR <?php 
                                echo idr($atss->final_price);
                                ?>
</div>
                                                <?php 
                            } else {
                                ?>
                                                    <div class="item_price item_price_small"></div>
                                                    <div class="item_price">IDR <?php 
                                echo idr($atss->final_price);
                                ?>
</div>
                                                <?php 
                            }
                            ?>

                                                <a class="discover_more"
                                                   href="<?php 
                            echo _SPPATH;
                            ?>
pr/p/<?php 
                            echo $atss->VariantID;
                            ?>
/<?php 
                            echo ProductAtCategory::bersihkanNama($atss->BaseArticleNameINA);
                            ?>
">Discover
                                                    More</a>
                                            </div>
                                        <?php 
                        }
                        ?>
                                    <?php 
                    }
                    ?>

                                </div>
                            <?php 
                }
                ?>


                        </div>
                        <a class="left recommended-item-control" href="#recommended-item-carousel" data-slide="prev">
                            <i class="glyphicon glyphicon-chevron-left"></i>
                        </a>
                        <a class="right recommended-item-control" href="#recommended-item-carousel" data-slide="next">
                            <i class="glyphicon glyphicon-chevron-right"></i>
                        </a>
                    </div>
                </div>
                <?php 
            }
            ?>
                <div class="clearfix"></div>


            </div>
            <style>
                .elips {

                    /*font-weight: bold;*/
                    color: #777777;
                    height: 40px;
                    text-overflow: ellipsis;
                    margin-top: 10px;
                    overflow: hidden;
                    /*white-space:nowrap;*/
                    display: -webkit-box;
                    -webkit-line-clamp: 2;
                    -webkit-box-orient: vertical;
                    text-align: center;
                }
                .product_list_item_img2 {
                    width: 100%;
                    height: 147px;
                    overflow: hidden;
                    margin: auto;
                    text-align: center;
                }

                .product_list_item_img2 img {
                    max-width: 100%;
                    max-height: 100%;
                }
                .elips a {
                    color: #666666;
                }

                .recommended-item-control {
                    position: absolute;
                    top: 41%;
                }

                .left {
                    left: 0;
                }

                .right {
                    right: 0;
                }

                .discover {
                    color: #e2007a;
                }

                .imgstamp_ole {
                    position: absolute;
                    width: 60px;
                    height: 60px;
                    overflow: hidden;
                }

                div.imgstamp_ole img {
                    min-width: 60px;
                    min-height: 60px;
                }

                .item_price {
                    color: #e2007a;
                    font-size: 25px;
                }

                .item_price_small {
                    text-decoration: line-through;
                    font-size: 13px;
                    height: 18px;
                }

                .discover_more {
                    color: #666666;
                    text-decoration: underline;
                    font-size: 12px;
                }
            </style>
        <?php 
        }
        //        pr($prod);
    }
Пример #16
0
    public static function myorderspage()
    {
        $arrPaymentStatus = array("1" => array("settlement", "success"), "2" => array("success", "success"), "3" => array("challenge", "failed"), "4" => array("pending", "pending"), "5" => array("deny", "denied"), "6" => array("cancel", "canceled"));
        ?>
        <style>

            @media (max-width: 768px) {

                .monly {
                    display: initial;
                }

                .donly {
                    display: none;
                }

            }

            @media (min-width: 768px) {
                .monly {
                    display: none;
                }

                .donly {
                    display: initial;
                }



            }

        </style>
        <style>
            .heading_earning{
                font-size: 17px;
                font-style: italic;
            }
            .heading_amount{
                font-size: 40px;
            }

            .inside{
                padding: 20px;
            }
            .selectMonth{
                /*padding-left: 10px;*/
            }
            .payout{
                color: #95abc2;
            }
            .money{
                font-size: 22px;
                color: #73879C;
            }
            .big{
                font-size: 25px;
                color: #73879C;
            }
            .rev_item{
                background-color: #ffffff;
                margin-top: 20px;
                margin-bottom: 20px;
            }
            .order_id{
                font-size: 20px;
                color: #73879C;
            }
            .pdate{
                color: #73879C;
                font-style: italic;
            }
            .heading_amount{
                font-size: 30px;
                text-align: right;
                padding-bottom: 100px;
            }
            .heading_amount_Sales{
                font-size: 18px;
                text-align: right;
                /*padding-bottom: 20px;*/
            }

            @media (max-width: 768px) {

                .monly {
                    display: initial;
                }

                .donly {
                    display: none;
                }

                .selectMonth{
                    padding-left: 0px;
                    padding-bottom: 20px;
                    border-bottom: 1px solid #CCCCCC;
                }
                .rightborder{
                    border-bottom: 1px solid #CCCCCC;
                }
                .leftborder{
                    border-top: 1px solid #CCCCCC;
                }
                .inside{
                    padding: 10px;
                }
                .tarmob{
                    /*text-align: right;*/
                }

            }

            @media (min-width: 768px) {
                .monly {
                    display: none;
                }

                .donly {
                    display: initial;
                }

                .leftborder{
                    border-left: 1px solid #CCCCCC;
                    min-height: 120px;
                }

                .rightborder{
                    border-right: 1px solid #CCCCCC;
                }
            }
        </style>
        <div class="container attop"  >
            <div class="col-md-12">
                <div class="appear_logo_pages">
                    <a href="<?php 
        echo _SPPATH;
        ?>
">
                        <img src="<?php 
        echo _SPPATH;
        ?>
images/appear-order.png" >
                    </a>
                </div>
                <?php 
        $orders = new VpTransaction();
        $arrOrder = $orders->getWhere("order_acc_id = '" . Account::getMyID() . "' ORDER BY order_date DESC");
        if (count($arrOrder) > 0) {
            foreach ($arrOrder as $num => $orders) {
                $app = new AppAccount();
                $app->getByID($orders->order_app_id);
                $paket = new Paket();
                $paket->getByID($orders->order_paket_id);
                ?>
                        <div class="rev_item col-md-12">
                            <div class="col-md-5 ">
                                <div class="inside">
                                    <div class="payout col-md-6 col-sm-6 col-xs-6">
                                        <div class="rev_details2">
                                            <small>Order ID</small>
                                            <div class="order_id"><?php 
                echo $orders->order_id;
                ?>
</div>
                                        </div>
                                    </div>
                                    <div class="payout col-md-6 col-sm-6 col-xs-6">
                                        <div class="rev_details">
                                            Date : <?php 
                echo date("F j, Y, g:i a", strtotime($orders->order_date));
                ?>
                                        </div>
                                        <div class="rev_details">
                                            App : <?php 
                echo $app->app_name;
                ?>
                                        </div>

                                        <div class="rev_details">
                                            Paket  : <?php 
                echo $paket->paket_name;
                ?>
                                        </div>
                                    </div>
                                    <div class="clearfix"></div>
                                </div>
                            </div>



                            <div class="col-md-3 payout leftborder rightborder">
                                <div class="inside">
                                    <div class="komisi tarmob">
                                        Order Value
                                        <div class="order_id"> IDR <?php 
                echo idr($orders->order_value);
                ?>
</div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-4 ">
                                <div class="inside tarmob">
                                    <small>Status</small>
                                    <div class="money big"><?php 
                echo $arrPaymentStatus[$orders->order_status][1];
                ?>
</div>
                                    <?php 
                if ($orders->order_status == "1" || $orders->order_status == "2") {
                    ?>
                                        <a href="<?php 
                    echo _SPPATH;
                    ?>
PaymentWeb/receipt?order_id=<?php 
                    echo $orders->order_id;
                    ?>
">receipt</a>
                                    <?php 
                }
                ?>
                                    <?php 
                if ($orders->order_status != "1" && $orders->order_status != "2" && $orders->order_status != "4") {
                    if ($app->app_active == 0) {
                        ?>
                                            <a href="<?php 
                        echo _SPPATH;
                        ?>
PaymentWeb/pay?app_id=<?php 
                        echo $app->app_id;
                        ?>
">pay again using different method</a>
                                        <?php 
                    }
                }
                ?>
                                </div>
                            </div>
                            <div class="clearfix"></div>
                        </div>
                    <?php 
            }
            ?>
                    <div class="clearfix"></div>


                <?php 
        } else {
            ?>
                    <h1>No orders has been made yet</h1>
                <?php 
        }
        ?>
            </div>
        </div>
    <?php 
    }
    public static function loadPaketForPay($app)
    {
        $paketBerlaku = Efiwebsetting::getData('PaketBerlaku');
        if ($paketBerlaku != "1,2") {
            $paket1 = new Paket();
            $paket1->getByID(3);
            //paket android iOS
        }
        $paket2 = new Paket();
        $paket2->getByID(2);
        // paket android
        ?>
        <style>

            .paketmanagement{
                padding: 20px;
                /*border-top:1px solid #CCCCCC;*/
                background-color: #f6f6f6;
            }
            .paket_inside{
                padding: 10px;
            }
            @media (max-width: 768px) {

                .monly {
                    display: initial;
                }

                .donly {
                    display: none;
                }
                .paketmanagement{
                    padding: 10px;

                }

            }

            @media (min-width: 768px) {
                .monly {
                    display: none;
                }

                .donly {
                    display: initial;
                }


            }
        </style>
        <div class="paketmanagement">
        <div style="padding-bottom: 20px; font-weight: bold;">Select Package</div>
        <div class="clearfix"></div>

            <?php 
        if ($paketBerlaku != "1,2") {
            ?>
        <div class="col-md-6 col-sm-6 col-xs-6">
            <div class="paket_inside">
            <img style="cursor: pointer;" id="paket1" onclick="setPaket(1);" src="<?php 
            echo _SPPATH;
            ?>
images/paket-android-ios.png" width="100%">
            <small>what you get</small>
            </div>
        </div>
            <?php 
        }
        ?>
        <div class="col-md-6 col-sm-6 col-xs-6 <?php 
        if ($paketBerlaku == "1,2") {
            ?>
col-md-offset-3 col-sm-offset-3 col-xs-offset-3<?php 
        }
        ?>
">
            <div class="paket_inside">
            <img style="cursor: pointer;" id="paket2" onclick="setPaket(2);" src="<?php 
        echo _SPPATH;
        ?>
images/paket-android-2.png"  width="100%">
            <small>what you get</small>
            </div>
        </div>
        <div class="clearfix"></div>
        <script>
    <?php 
        if ($paketBerlaku != "1,2") {
            ?>
            var paket_selected = 3;
            $(document).ready(function(){
                setPaket(1);
            });
        <?php 
        } else {
            ?>
            var paket_selected = 2;
            $(document).ready(function(){
                setPaket(2);
            });
        <?php 
        }
        ?>
            function setPaket(x){
                if(x == 1){
                    $('#paket2').attr("src","<?php 
        echo _SPPATH;
        ?>
images/paket-android-2.png");
                    $('#paket1').attr("src","<?php 
        echo _SPPATH;
        ?>
images/paket-android-ios.png");
                    $('#paketprice').html("IDR <?php 
        echo idr($paket1->paket_price);
        ?>
 / year");
                    paket_selected = 3;
                    $('#paybuttonpaket3').show();
                    $('#paybuttonpaket2').hide();
                }else{
                    $('#paket2').attr("src","<?php 
        echo _SPPATH;
        ?>
images/paket-android.png");
                    $('#paket1').attr("src","<?php 
        echo _SPPATH;
        ?>
images/paket-android-ios-2.png");
                    $('#paketprice').html("IDR <?php 
        echo idr($paket2->paket_price);
        ?>
 / year");
                    paket_selected = 2;
                    $('#paybuttonpaket2').show();
                    $('#paybuttonpaket3').hide();
                }
            }
        </script>

        <div class="clearfix"></div>
        </div>

        <div id="paketprice" style="background-color: #f6f6f6; padding: 5px; text-align: center; font-size: 30px;">IDR <?php 
        echo idr($paket1->paket_price);
        ?>
 / year</div>

        <div style="padding: 20px;background-color: #f6f6f6;">
            <a id="paybuttonpaket3" href="<?php 
        echo _SPPATH;
        ?>
Vp/pay?app_id=<?php 
        echo $app->app_id;
        ?>
&paket=3" class="btn btn-danger btn-lg">PAY NOW USING VERITRANS</a>
            <a id="paybuttonpaket2" style="display: none;" href="<?php 
        echo _SPPATH;
        ?>
Vp/pay?app_id=<?php 
        echo $app->app_id;
        ?>
&paket=2" class="btn btn-danger btn-lg">PAY NOW USING VERITRANS</a>

            <!--            <a href="--><?php 
        //=_SPPATH;
        ?>
<!--VeritransPay/pay?app_id=--><?php 
        //=$app->app_id;
        ?>
<!--" class="btn btn-danger btn-lg">PAY NOW USING VERITRANS</a>-->
        </div>


    <?php 
    }
    public static function printer($arr)
    {
        $pc = new \ProductAtCategory();
        //            $arr = $data->results;
        $page = 1;
        $limit = 12;
        $begin = ($page - 1) * $limit + 1;
        $end = $begin + $limit - 1;
        $total = count($arr);
        $jmlhpage = ceil($total / $limit);
        $minpage = max(1, $page - 3);
        $maxpage = min($jmlhpage, $page + 3);
        ?>

        <script>

        //untuk product management
        var catKey = [];
        var page = <?php 
        echo $page;
        ?>
;
        var limit = <?php 
        echo $limit;
        ?>
;
        var total = <?php 
        echo $total;
        ?>
;
        var jmlpage = <?php 
        echo $jmlhpage;
        ?>
;
        var homes = [];

        function preloadImg(id){
//                console.log('preload '+id);
            $('#imgloader_'+id).hide();
            $('#imgasli_'+id).show();
        }

        function removeA(arr) {
            var what, a = arguments, L = a.length, ax;
            while (L > 1 && arr.length) {
                what = a[--L];
                while ((ax= arr.indexOf(what)) !== -1) {
                    arr.splice(ax, 1);
                }
            }
            return arr;
        }

        function moveToPage(x){
            page = x;
            printProduct({});
        }

        var arahPrice = "desc";
        function sortByPrice(){
            if(arahPrice == "desc") {
                homes.sort(function (a, b) {
                    return parseFloat(a.SellingPrice) - parseFloat(b.SellingPrice);
                });
                arahPrice = "asc";
            }else{
                arahPrice = "desc";
                homes.sort(function (a, b) {
                    return parseFloat(b.SellingPrice) - parseFloat(a.SellingPrice);
                });
            }

            printProduct({});
        }
        var arahName = "desc";

        function sortByName(){
            if(arahName == "desc") {
                homes.sort(sort_by('BaseArticleNameENG', false, function(a){return a.toUpperCase()}));
                arahName = "asc";
            }else{
                arahName = "desc";
                homes.sort(sort_by('BaseArticleNameENG', true, function(a){return a.toUpperCase()}));
            }
            printProduct({});
        }

        var sort_by = function(field, reverse, primer){
            var key = function (x) {return primer ? primer(x[field]) : x[field]};

            return function (a,b) {
                var A = key(a), B = key(b);
                return ( (A < B) ? -1 : ((A > B) ? 1 : 0) ) * [-1,1][+!!reverse];
            }
        }

        function updateArrSize(){
            var arrSem = homes.slice();
            var arrFiltered = [];
            var range = {
                minprice : $( "#slider" ).slider( "values", 0 ),
                maxprice : $( "#slider" ).slider( "values", 1 )
            };
            var yangMasukRange = 0;
            for(var x=0;x<arrSem.length;x++) {
                var attr = arrSem[x];

                if (range.hasOwnProperty('minprice')) {
                    if (attr['SellingPrice'] < range.minprice)
                        continue;
                }
                if (range.hasOwnProperty('maxprice')) {
                    if (attr['SellingPrice'] > range.maxprice)
                        continue;
                }
                if(catKey.length>0){
                    var lanjut = 0;
                    var cats = attr['TaggingLevel3ID'].split(' ');
//                    console.log(cats);
                    for(var z=0;z<cats.length;z++) {
                        if (jQuery.inArray(cats[z], catKey) > -1) {
                            lanjut = 1;
//                            console.log("lanjut"+cats[z]+attr['VariantID']);
                        }
                    }
                    if(lanjut === 0)
                        continue;
                }

                //search filter
                var search = $("#searchTextVariant").val().toLowerCase();
                if(search != '') {
//                    console.log(search);
//                    console.log(attr['VariantID']+ " "+attr['VariantNameENG']);BaseArticleNameENG
                    if (attr['VariantID'].toLowerCase().indexOf(search) === -1 && attr['VariantNameENG'].toLowerCase().indexOf(search) === -1 && attr['BaseArticleNameENG'].toLowerCase().indexOf(search) === -1) {
                        continue;
                    }
                }


                arrFiltered.push(attr);
                yangMasukRange++;
            }
            total = yangMasukRange;
//            console.log("yangMasukRange "+yangMasukRange);
//            console.log(arrFiltered);
            return arrFiltered;
        }
        function printProduct(option){
            $('#loadingtop').show().fadeOut();
//                console.log(option);

            var arrSem = updateArrSize();

            var range = {
                minprice : $( "#slider" ).slider( "values", 0 ),
                maxprice : $( "#slider" ).slider( "values", 1 )
            };
            var html = '';
            var printed  = 0;

//                var arrSem = homes.slice();

            var end = Math.min(limit,arrSem.length);
//            console.log(arrSem);

            var t =$.now();

            if(page>1) {
                var anzahlremove = 0 - ((page - 1) * limit);
                arrSem.splice(anzahlremove);
            }
//                console.log("anzahlremove "+anzahlremove);
//                console.log(arrSem.length);


            html += createPagination();

//            console.log(arrSem);

            while(printed < end && arrSem.length > 0){
//                for(var x=0;x<12;x++){
                var attr = arrSem.pop();

//                console.log(attr);

                var rand = Math.floor((Math.random() * 100) + 1);
                t = t+rand;

//                if(range.hasOwnProperty('minprice')){
//                    if(attr['SellingPrice']<range.minprice)
//                        continue;
//                }
//                if(range.hasOwnProperty('maxprice')){
//                    if(attr['SellingPrice']>range.maxprice)
//                        continue;
//                }
//                if(catKey.length>0){
//                    if(jQuery.inArray( attr['TaggingLevel3ID'], catKey ) == -1){
//                        continue;
//                    }
//                }

                html += '<div class="product_list_item">';
                html += '<div class="product_list_item_dalaman">';
                html += '<div id="imgloader_'+attr['VariantID']+'_'+t+'" class="img_loader" >';
                html += '<img onload="" src="<?php 
        echo _SPPATH;
        ?>
images/tbs-hor-ajax-loader.gif">';
                html += '</div>';

                var imgurl = '<?php 
        echo $pc->imgURL;
        ?>
'+attr['BaseArticleImageFile'];
                if(attr['BaseArticleImageFile'] == ''){
                    imgurl = '<?php 
        echo $pc->noimage;
        ?>
';
                }

                html += '<div  id="imgasli_'+attr['VariantID']+'_'+t+'" class="product_list_item_img" style="display:none;">';
//                html += '<a title="'+attr['BaseArticleNameENG']+'" href="<?php 
        //=_SPPATH;
        ?>
//pr/p/'+attr['VariantID']+'/'+encodeURIComponent(attr['BaseArticleNameENG'])+'">';
                html += '<img onload="preloadImg(\''+attr['VariantID']+'_'+t+'\');"  src="'+imgurl+'" >';
//                html += '</a>';
                html += '</div>';



                html += '<div class="product_list_item_text">';

                html += '<div class="name">';

                var key = attr['VariantID'];
                var checked = '';
                if(jQuery.inArray( key, checkedVariant ) > -1) {
                    checked = "checked ='true'";
                }


                html += '<input class="variant_check" type="checkbox" id="check_'+attr['VariantID']+'" '+checked+' onchange="checkMe(this,\''+attr['VariantID']+'\');">';
                html += ' ID .'+attr['VariantID']+' <br>';
                html += attr['BaseArticleNameENG'];
                html += '</div>';
                html += '<div class="item_price">'+attr['TaggingLevel3ID']+'</div>';

                html += '<div class="item_price">IDR '+toRp(attr['SellingPrice'])+'</div>';

                html += '<div class="clearfix"></div>';
                html += '</div>';
                html += '</div>';
                html += '</div>';



                if(printed%3 == 2)html += "<div class='clearfix'></div><hr class='dotted'/>";

                printed++;
            }
            html += '<div class="clearfix"></div>';
            html += createPagination();


            $('#product_data').html(html);
//                $('#loadingtop').hide();
        }

        function createPagination(){

            var html = '';
//                $begin = (($page-1)*$limit)+1;
//                $end = $page+$limit-1;
//
//                $total = count($arr);
//                $jmlhpage = ceil($total/$limit);
//
//                $minpage = max(1,$page-3);
//                $maxpage = min($jmlhpage,$page+3);

            var begin = ((page-1)*limit)+1;
            var end = Math.min(begin+limit-1,total);

            var jmltotal = total;
            var jmlpage = Math.ceil(jmltotal/limit);

            var minpage = Math.max(1,page-3);
            var maxpage = Math.min(jmlpage,page+3);


            html += '<div class="product_pagination">';
            html += '<div class="showing">SHOWING <b>'+begin+'</b>-<b>'+end+'</b> OF <b>'+jmltotal+'</b></div>';
            html += '<div class="pages">Pages';
            if(page>1) {
                var mundur = page-1;
                html += '<span onclick="moveToPage('+mundur+');" class="page_nr">«</span>';
            }
            for(var x=minpage;x<=maxpage;x++){
                var sel = '';
                if(page == x)sel = 'page_nr_sel';
                html += '<span onclick="moveToPage('+x+');" class="page_nr '+sel+'">'+x+'</span>';
            }
            if(page<jmlpage){
                var maju = page+1;
                html += '<span onclick="moveToPage('+maju+');" class="page_nr">»</span>';
            }

            html += '&nbsp;&nbsp; &nbsp; <b>'+page+'</b> of <b>'+jmlpage+'</b> displayed </div>';
            html += '</div>';

            return html;
        }

        function toRp(angka){
            var rev     = parseInt(angka, 10).toString().split('').reverse().join('');
            var rev2    = '';
            for(var i = 0; i < rev.length; i++){
                rev2  += rev[i];
                if((i + 1) % 3 === 0 && i !== (rev.length - 1)){
                    rev2 += '.';
                }
            }
            return rev2.split('').reverse().join('');
        }
        var checkedVariant = [];

        function checkMe(obj,key){
//            console.log('checked');

            var jo = $(obj);


            if(obj.checked) {
                //Do stuff

                checkedVariant.push(key);
            }
            else{
//                console.log('in checkme');
//                console.log(checkedVariant);
                //remove element from array
                removeA(checkedVariant, key);
            }
            showHowManySelected();
//            $('#isi_span3_'+activeLokalID).val(checkedVariant.join());

//            updateHiddenCondition();
        }

        function checkedAll(){
            //pick which item is displayed
            //check_variantID
            var arrSem = updateArrSize();
            for(var x=0;x<arrSem.length;x++){
                var attr = arrSem[x];
                var key = attr['VariantID'];
                $('#check_'+attr['VariantID']).prop("checked",true);

                if(jQuery.inArray( key, checkedVariant ) == -1) {
                    checkedVariant.push(key);
                }
            }
            showHowManySelected();
        }

        function unCheckedAll(){
            $('.variant_check').prop("checked",false);
            checkedVariant = [];
            showHowManySelected();
        }
        function unCheckedFiltered(){
            //pick which item is displayed
            //check_variantID
            var arrSem = updateArrSize();
            for(var x=0;x<arrSem.length;x++){
                var attr = arrSem[x];
                var key = attr['VariantID'];
                $('#check_'+attr['VariantID']).prop("checked",false);

                removeA(checkedVariant, key);
            }
            showHowManySelected();
        }

        function showHowManySelected(){
            var len = checkedVariant.length;
            asuccess(len+' selected');
            $('#anzahlSelected').html(len+' selected');
            $('#theSelection').val(checkedVariant.join());

            if(to_update_id!='') {
                $('#' + to_update_id).val(checkedVariant.join());

                //create visual change
                var html = '';
                var ende = checkedVariant.length;
                for(var x=0;x<ende;x++){
                    var attr = checkedVariant[x];
                    var obj = homesWithKey[attr];
                    var cnt = x+1;
                    html += '<div class="condition_item">';
                    html += cnt+". ["+obj['VariantID']+'] '+obj['BaseArticleNameENG'];
                    html += '</div>';
                }
                $('#show_'+to_update_id).html(html);

                if(ende<1){
                    $('#show_'+to_update_id).hide();
                }else{
                    $('#show_'+to_update_id).show();
                }
            }
        }

        function uncheckCategories(){

            //category_check
            $('.category_check').prop("checked",false);
            catKey = [];
        }

        function unsetSearch(){
            $('#searchTextVariant').val('');
        }

        function resetSliderPos(){
            $("#slider").slider('values',0,0); // sets first handle (index 0) to 50
            $("#slider").slider('values',1,1000000); // sets second handle (index 1) to 80
        }

        var to_update_id = '';
        function isiKanValue(update_id){
            to_update_id = update_id;
            var slc = $('#'+update_id).val();
//            console.log("slc "+slc);
            if(slc!='') {

//                var sem  = slc.split(",");
//                var semarr = [];
//                for(var x=0;x<sem.length;x++){
//                    var isikan = parseInt(sem[x]);
//                    semarr.push(isikan);
//                }
//                checkedVariant = semarr;

                checkedVariant = slc.split(",");
//                console.log(checkedVariant);
                printProduct({});
            }

        }

        </script>
        <input type="hidden" id="theSelection">
        <div id="anzahlSelected" style="position: absolute; font-size: 13px; padding: 20px; z-index: 1000000; left: 0px; top: 0px; width: 200px; height: 20px;"></div>
        <div class="col-md-3 wadah_filter"  >
            <div class="filter">
                <h3>Categories</h3>

                <div class="filter_item" id="filter_subcategory" >

                    <div id="filter_subcategory_isi" >
                        <?php 
        \ProductCategoryService::printCategoryFilterAll();
        ?>
                    </div>
                </div>


            </div>
            <style>
                .filter{
                    margin-top: 40px;
                    border: 1px solid #cccccc;
                    color: #666666;
                    padding: 10px;
                }
                .filter h3{
                    padding: 0;
                    margin: 0;
                }
                .filter h5{
                    color: #333333;
                    cursor: pointer;
                }
                .filter_item{
                    border-top: 1px dashed #cccccc;
                    margin-top: 10px;
                }
                .key2{
                    font-size: 14px;
                    margin-top: 7px;
                    margin-bottom: 7px;


                }
                .key2 span{
                    cursor: pointer;
                }
                .key3{
                    font-size: 13px;
                    margin-top: 3px;
                    margin-bottom: 3px;
                }
            </style>
        </div>

        <div class="col-md-9" style="margin-top: 20px;">

        <div class="sort">

            <span style="margin-right: 10px;">SORT</span>
            <span onclick="sortByName();"  class="sort_item">NAME</span>
            <span onclick="sortByPrice();" class="sort_item">PRICE</span>
            <span class="sort_item" ><input id="searchTextVariant" onkeyup="page=1;printProduct({});" type="text" placeholder="Search"></span>
            <span class="sort_item"><button onclick="checkedAll();" class="btn btn-default">Check Filtered</button>
                <button onclick="unCheckedFiltered();" class="btn btn-default">UnCheck Filtered</button>
                <button onclick="unCheckedAll();" class="btn btn-default">UnCheck All</button> </span>
            <div style="float: right; width: 200px;">
                <div id="filter_subcategory_price">
                    <div id="slider"></div>
                    <div id="price"></div>
                    <input type="hidden" id="val_min">
                    <input type="hidden" id="val_max">
                </div>
                <script>
                    $(function() {
                        $( "#slider" ).slider({
                            range: true,
                            values: [ 0, 3000000 ],
                            step : 10000,
                            min: 0,
                            max: 1000000,
                            slide: function( event, ui ) {
                                $( "#price" ).html( "IDR " + toRp(ui.values[ 0 ]) + " - IDR " + toRp(ui.values[ 1 ]) );
//                                $('#val_min').val(ui.values[ 0 ]);
//                                $('#val_max').val(ui.values[ 1 ]);
                            },
                            stop: function( event, ui ) {
//                                homes.sort(function (a, b) {
//                                    return parseFloat(a.SellingPrice) - parseFloat(b.SellingPrice);
//                                });
//                                printProduct({
//                                    minprice : ui.values[ 0 ],
//                                    maxprice : ui.values[ 1 ]
//                                });

                                homes.sort(function (a, b) {
                                    return parseFloat(a.SellingPrice) - parseFloat(b.SellingPrice);
                                });
                                arahPrice = "asc";
                                page = 1;
                                printProduct({});
                            }
                        });

                        $( "#price" ).html( "IDR " + toRp($( "#slider" ).slider( "values", 0 )) +
                        " - IDR " + toRp($( "#slider" ).slider( "values", 1 )) );
//                        $('#val_min').val($( "#slider" ).slider( "values", 0 ));
//                        $('#val_max').val($( "#slider" ).slider( "values", 1 ));
                    });

                    function filterin(){
//                        console.log('filterin');
                        homes.sort(function (a, b) {
                            return parseFloat(a.SellingPrice) - parseFloat(b.SellingPrice);
                        });
                        printProduct({});
                    }
                </script>
            </div>

        </div>
        <style>
            .showing{
                float: left;
                width: 200px;

            }
            .pages{
                text-align: right;
            }
            .page_nr{
                cursor: pointer;
                padding-left: 5px;
                padding-right: 5px;
            }
            .page_nr:hover{
                text-decoration: underline;
            }
            .page_nr_sel{
                font-weight: bold;
                color: #7fb719;
            }
        </style>
        <div id="product_data">
            <div class="product_pagination">
                <div class="showing">SHOWING <b><?php 
        echo $begin;
        ?>
</b>-<b><?php 
        echo $end;
        ?>
</b> OF <b><?php 
        echo count($arr);
        ?>
</b></div>
                <div class="pages">Pages
                    <?php 
        if ($page > 1) {
            ?>
                        <span onclick="moveToPage(<?php 
            echo $page - 1;
            ?>
);" class="page_nr">«</span>
                    <?php 
        }
        ?>
                    <?php 
        for ($x = $minpage; $x <= $maxpage; $x++) {
            ?>
                        <span onclick="moveToPage(<?php 
            echo $x;
            ?>
);" class="page_nr <?php 
            if ($page == $x) {
                echo "page_nr_sel";
            }
            ?>
"><?php 
            echo $x;
            ?>
</span>
                    <?php 
        }
        ?>
                    <?php 
        if ($page < $jmlhpage) {
            ?>
                        <span onclick="moveToPage(<?php 
            echo $page + 1;
            ?>
);" class="page_nr">»</span>
                    <?php 
        }
        ?>
                    &nbsp;&nbsp; &nbsp; <b><?php 
        echo $page;
        ?>
</b> of <b><?php 
        echo $jmlhpage;
        ?>
</b> displayed </div>
            </div>
            <?php 
        $t = time();
        //            pr($arr);
        $num = 0;
        foreach ($arr as $key => $obj) {
            $t = $t . rand(0, 100);
            $imgurl = $pc->imgURL . $obj->BaseArticleImageFile;
            if ($obj->BaseArticleImageFile == "") {
                $imgurl = $pc->noimage;
            }
            ?>
                <div class="product_list_item">
                    <div class="product_list_item_dalaman">
                        <!--                    <div id="imgloader_--><?php 
            //=$obj->VariantID;
            ?>
<!--_--><?php 
            //=$t;
            ?>
<!--" class="img_loader" >-->
                        <!--                        <img src="--><?php 
            //=_SPPATH;
            ?>
<!--images/tbs-hor-ajax-loader.gif">-->
                        <!--                    </div>-->
                        <div id="imgasli_<?php 
            echo $obj->VariantID;
            ?>
_<?php 
            echo $t;
            ?>
" class="product_list_item_img">
<!--                            <a title="--><?php 
            //=$obj->BaseArticleNameENG;
            ?>
<!--" href="--><?php 
            //=_SPPATH;
            ?>
<!--pr/p/--><?php 
            //=$obj->VariantID;
            ?>
<!--/--><?php 
            //=urlencode($obj->BaseArticleNameENG);
            ?>
<!--">-->
                                <img  src="<?php 
            echo $imgurl;
            ?>
" >
<!--                            </a>-->
                        </div>

                        <div class="product_list_item_text">
                            <div class="name">
                                <input class="variant_check" type="checkbox" id="check_<?php 
            echo $obj->VariantID;
            ?>
" onchange="checkMe(this,'<?php 
            echo $obj->VariantID;
            ?>
');">
                                ID . <?php 
            echo $obj->VariantID;
            ?>
 <br>
                                <?php 
            echo $obj->BaseArticleNameENG;
            ?>

                            </div>
                            <div class="item_price"><?php 
            echo $obj->TaggingLevel3ID;
            ?>
</div>
                            <div class="item_price">IDR <?php 
            echo idr($obj->SellingPrice);
            ?>
</div>

                        </div>
                    </div>
                </div>
                <?php 
            //                echo $key;
            if ($num % 3 == 2) {
                echo "<div class='clearfix'></div><hr class='dotted'/>";
            }
            if ($num > 10) {
                break;
            }
            $num++;
        }
        ?>
            <div class="clearfix"></div>
            <div class="product_pagination">
                <div class="showing">SHOWING <b><?php 
        echo $begin;
        ?>
</b>-<b><?php 
        echo $end;
        ?>
</b> OF <b><?php 
        echo count($arr);
        ?>
</b></div>
                <div class="pages">Pages
                    <?php 
        if ($page > 1) {
            ?>
                        <span onclick="moveToPage(<?php 
            echo $page - 1;
            ?>
);" class="page_nr">«</span>
                    <?php 
        }
        ?>
                    <?php 
        for ($x = $minpage; $x <= $maxpage; $x++) {
            ?>
                        <span onclick="moveToPage(<?php 
            echo $x;
            ?>
);" class="page_nr <?php 
            if ($page == $x) {
                echo "page_nr_sel";
            }
            ?>
"><?php 
            echo $x;
            ?>
</span>
                    <?php 
        }
        ?>
                    <?php 
        if ($page < $jmlhpage) {
            ?>
                        <span onclick="moveToPage(<?php 
            echo $page + 1;
            ?>
);" class="page_nr">»</span>
                    <?php 
        }
        ?>
                    &nbsp;&nbsp; &nbsp; <b><?php 
        echo $page;
        ?>
</b> of <b><?php 
        echo $jmlhpage;
        ?>
</b> displayed </div>
            </div>
        </div>
        <div class="clearfix"></div>


        <script>



            $(document).ready(function(){
                $( "#product_data img" )
                    .error(function() {
                        $( this ).attr( "src", "<?php 
        echo $pc->noimage;
        ?>
" );
                    });
                homes.reverse();

                printProduct({});
            });

            var homesWithKey = {};
            var homes_attr;

            <?php 
        //create javascript objects
        foreach ($arr as $key => $obj) {
            //                unset($obj->VariantNameINA);
            //                unset($obj->VariantNameENG);
            //                unset($obj->VariantINACode);
            unset($obj->HowToUseINA);
            unset($obj->HowToUseENG);
            unset($obj->ArticleInfoINA);
            unset($obj->ProductTipsINA);
            unset($obj->ProductTipsENG);
            unset($obj->ArticleInfoENG);
            unset($obj->IngredientINA);
            unset($obj->IngredientENG);
            //                unset($obj->VariantEAN);
            unset($obj->WhatInsideINA);
            unset($obj->WhatInsideENG);
            ?>
            var el = jQuery.parseJSON('<?php 
            echo addslashes(json_encode($obj));
            ?>
');
            homes.push(el);

            homes_attr = el['VariantID'];
            homesWithKey[homes_attr] = el;
            <?php 
        }
        ?>

        </script><?php 
        ?>
        <style>
            .sort{
                border: 1px solid #cccccc;
                padding: 10px;

                font-size: 12px;
                font-weight: bold;
            }
            .product_pagination{
                padding: 10px;
                margin-bottom: 30px;
                color: #666666;
            }
            .sort_item{
                cursor: pointer;
                padding-left: 10px;
                padding-right: 10px;
                border-left: 1px dashed #cccccc;
                font-weight: normal;
            }
            .product_list_item{
                float: left;
                width: 33%;
                height: 300px;
                border-right: 1px dashed #cccccc;
            }
            .product_list_item_dalaman{
                padding: 10px;
            }
            .product_list_item_img,.img_loader{
                width: 180px;
                height: 180px;
                overflow: hidden;
                margin: auto;
                text-align: center;
            }
            .product_list_item_img img,.img_loader img{
                max-width:100%;
                max-height:100%;
            }
            .img_loader{
                line-height: 180px;
            }

            .product_list_item_text .name{
                font-weight: bold;
                color: #777777;
                height: 40px;
                text-overflow: ellipsis;
                margin-top: 20px;
                overflow:hidden;
                /*white-space:nowrap;*/
                display: -webkit-box;
                -webkit-line-clamp: 2;
                -webkit-box-orient: vertical;

            }
            .product_list_item_text .name a{
                color:#666666;
            }
            .product_list_item_text .name a:hover{
                color: #7fb719;
            }

            /*
            use text ellipsis always with overflow:hidden; and white-space:nowrap;

            for multiple line ..line clamps use
            display: -webkit-box;
                -webkit-line-clamp: 2;
                -webkit-box-orient: vertical;
                and overflow:hidden;
            */
            .rating{
                font-size: 20px;
                margin-top: 10px;
                color: #999999;
            }
            .rating > span:hover:before {
                content: "\2605";
                position: absolute;
            }
            .item_price{
                color: #888888;

            }
            .buy{
                padding: 5px;
                border: 1px solid #cccccc;
                margin-top: 10px;
                height: 40px;

            }
            a.more{
                font-size: 11px;
                text-decoration: underline;
                color: #444444;
                height: 30px;
                line-height: 30px;
            }
            a.add{
                background-color: #e2007a;
                color: white;
                padding: 5px;
                height: 30px;
                line-height: 30px;
            }
            hr.dotted{
                border-top: 1px dashed #cccccc;
                margin-top: 10px;
                margin-bottom: 10px;
                margin-left: 10px;
                margin-right: 10px;
            }

            .breadcrumbs span{
                font-weight: bold;
            }
            .breadcrumbs a{
                color: #666666;
                font-style: italic;
            }

        </style>
        </div>
        <div class="clearfix"></div>
<?php 
        //        pr($data);
    }
Пример #19
0
            $no++;
        }
        $total = yposSQL('SHOW', 'ypos_pembeliandtl', 'DISTINCT SUM(qty_beli) AS t_qty, SUM(harga_beli) AS t_harga', "kdPembelian='{$kode}' && 1=1")->fetch_array();
        ?>
    <tr>
    <td colspan="3" align="center">Grand Total</td>
    <td align="center"><?php 
        echo $total['t_qty'];
        ?>
</td>
    <td align="right"><?php 
        echo idr($total['t_harga']);
        ?>
</td>
    <td align="right"><?php 
        echo idr(@$ed['ttl']);
        ?>
</td>
    <td></td>
  </tr>
  <tr>
    <td colspan="6" align="center"></td>
    <td align="center"><a href="<?php 
        echo $set->folder_modul . '=' . $modul;
        ?>
"><button class="submit">Selesai</button></a></td>
  </tr>
</table>
<?php 
        break;
    case 'delete':
Пример #20
0
    <tr class="persen box">
        <th class="font-proses">Diskon %</th>
        <td>:</td>
        <td><input type="text" size="30" name="diskon" class="input-proses" id="idr1" value="" onkeyup="hitTotaldiscpersen(getElementById('subttl').value,this.value);"> %</td>
    </tr>
    <tr class="rp box">
        <th class="font-proses">Diskon Rp</th>
        <td>:</td>
        <td><input type="text" size="30" name="diskon_rp" class="input-proses" id="idr2" value="" onkeyup="hitTotaldiscrp(getElementById('subttl').value,this.value);"> ,-</td>
    </tr>
    <tr>
        <th class="font-proses">Grand Total</th>
        <td>:</td>
        <td class="font-proses">
            Rp. <span id="grandTotal1" style="color:#00F"><?php 
    echo idr($getData['subtotal']);
    ?>
</span> ,-
            <input type="hidden" name="grandTotal" value="<?php 
    echo $getData['subtotal'];
    ?>
" id="grandTotal"/>
        </td>
    </tr>
    <tr>
        <th class="font-proses">Uang Bayar</th>
        <td>:</td>
        <td><input type="text" size="30" name="bayar" class="input-proses" value="0" id="idrbayar" onkeyup="kembalian(this.value, getElementById('grandTotal').value);" required></td>
    </tr>
    <tr>
        <th class="font-proses">Kembalian</th>
Пример #21
0
<?php

session_start();
include "../php/koneksi.php";
include "../php/fungsi.php";
$jenis_gaji = array();
$sql = "SELECT * FROM ref_jenis_gaji WHERE id_peraturan_gaji = '" . $_POST["id_peraturan_gaji"] . "' AND id_pangkat = '" . $_POST["id_pangkat"] . "' ORDER BY mkg ASC";
$res = mysql_query($sql);
while ($ds = mysql_fetch_array($res)) {
    $row_jenis_gaji["id_jenis_gaji"] = $ds["id_jenis_gaji"];
    $row_jenis_gaji["id_peraturan_gaji"] = $ds["id_peraturan_gaji"];
    $row_jenis_gaji["id_pangkat"] = $ds["id_pangkat"];
    $row_jenis_gaji["mkg"] = $ds["mkg"];
    $row_jenis_gaji["gaji"] = idr($ds["gaji"]);
    array_push($jenis_gaji, $row_jenis_gaji);
}
echo json_encode($jenis_gaji);
    function transaction()
    {
        $bulan = addslashes($_GET['m']);
        if ($bulan == "") {
            $bulan = date("F Y");
            $days_ago = date('Y-m-01');
            // hard-coded '01' for first day
            $days_now = date('Y-m-t');
        } else {
            $bulan = urldecode($bulan);
            $days_ago = date('Y-m-01', strtotime($bulan));
            // hard-coded '01' for first day
            $days_now = date('Y-m-t', strtotime($bulan));
        }
        $numberDays = cal_days_in_month(CAL_GREGORIAN, date('n', strtotime($bulan)), date('Y', strtotime($bulan)));
        $days_ago = date('Y-m-01', strtotime($bulan));
        // hard-coded '01' for first day
        $days_now = date('Y-m-01', strtotime('+1 month', strtotime($bulan)));
        $t = time();
        //get average transaction value
        //latest transaction
        //max transaction
        //min transaction
        //most buyed products
        //most viewed products
        //        $tt = new LL_AccStatement();
        //        $arrTt = $tt->getWhere("Cash_Value > 0 AND (TransactionDateTime BETWEEN '$days_ago' AND '$days_now') ORDER BY TransactionDateTime DESC");
        $ll = new MTranDetail();
        $arrTt = $ll->getWhere("(detail_date BETWEEN '{$days_ago}' AND '{$days_now}')");
        $value = 0;
        foreach ($arrTt as $tts) {
            $value += $tts->detail_price_total;
        }
        $atv = $value / count($arrTt);
        $arrStats['Orders'] = $arrTt;
        //        pr($arrTt);
        //        echo $atv;
        ?>
<div class="row">
        <div class="col-md-12">
            <h1>
                Transaction Dashboard
                <small><?php 
        echo $bulan;
        ?>
</small>
            </h1>
            <ol class="breadcrumb">
                <li>
                    <?php 
        echo Lang::t('Select Timeframe');
        ?>
                </li>
                <li class="active">
                    <?php 
        $start = new DateTime('11 months ago');
        // So you don't skip February if today is day the 29th, 30th, or 31st
        $start->modify('first day of this month');
        $end = new DateTime();
        $interval = new DateInterval('P1M');
        $period = new DatePeriod($start, $interval, $end);
        ?>
                    <select id="apptimeselector_<?php 
        echo $t;
        ?>
">
                        <?php 
        foreach ($period as $dt) {
            ?>
                            <option value="<?php 
            echo urlencode($dt->format('F Y'));
            ?>
" <?php 
            if ($dt->format('F Y') == $bulan) {
                echo "selected";
            }
            ?>
>
                                <?php 
            echo $dt->format('F Y') . "<br>";
            ?>
                            </option>
                        <?php 
        }
        ?>

                    </select>
                    <script>
                        $("#apptimeselector_<?php 
        echo $t;
        ?>
").change(function(){
                            var slc = $("#apptimeselector_<?php 
        echo $t;
        ?>
").val();
                            openLw("Transaction","<?php 
        echo _SPPATH;
        ?>
BIWebTransaction/transaction?m="+slc,"fade");
                        });
                    </script>
                </li>
            </ol>
        </div>
        </div>

        <div class="row">
            <div class="col-md-3">
                <div class="small-box bg-red">
                    <div class="inner">
                        <?php 
        $mtrans = new MTranDetail();
        global $db;
        $q = "SELECT SUM(detail_price_total) as total, COUNT(*) AS num FROM {$mtrans->table_name}";
        $arrTotal = $db->query($q, 1);
        ?>
                        <h3><small style="color: white;font-weight: bold;"><?php 
        echo idr($arrTotal->total);
        ?>
</small></h3>
                        <p>Lifetime Sales</p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-bag"></i>
                    </div>
                    <!--                            <a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>-->
                </div>
            </div>
            <div class="col-md-3">
                <div class="small-box bg-aqua">
                    <div class="inner">
                        <h3><small style="color: white;font-weight: bold;"><?php 
        echo idr($atv);
        ?>
</small></h3>
                        <p>Average Transaction Value</p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-bag"></i>
                    </div>
                    <!--                            <a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>-->
                </div>
            </div>
            <div class="col-md-3">
                <div class="small-box bg-green">
                    <div class="inner">

                        <h3><small style="color: white;font-weight: bold;"><?php 
        echo idr($value);
        ?>
</small></h3>

                        <p>Total Transactions</p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-stats-bars"></i>
                    </div>
                    <!--                            <a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>-->
                </div>
            </div>
            <div class="col-md-3">
                <div class="small-box bg-yellow">
                    <div class="inner">


                        <h3><?php 
        echo count($arrTt);
        ?>
</h3>

                        <p>Number of Transactions</p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-stats-bars"></i>
                    </div>
                    <!--                            <a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>-->
                </div>
            </div>

        </div>

        <div class="row">
            <div class="col-md-12">
                <div class="box box-default">
                    <div class="box-header with-border">
                        <h3 class="box-title">Transaction Stats</h3>

                        <div class="box-tools pull-right">
                            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                            </button>
                            <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                        </div>
                    </div>
                    <div class="box-body chart-responsive">

                        <?php 
        //            $days_ago = date('Y-m-d', strtotime('-30 days', time()));
        //            $days_now =  date("Y-m-d");
        $data = BIPenjualan::getAppStats($arrStats, $days_ago, $days_now);
        //                        $data = self::getAppStats($arrStats,$days_ago,$days_now);
        ?>


                    </div>
                    <!-- /.box-body -->
                </div>
            </div>

        </div>

        <?php 
        //latest transactions
        $tt = new MTranDetail();
        $arrTtNew = $tt->getWhere("(detail_date BETWEEN '{$days_ago}' AND '{$days_now}') ORDER BY detail_date DESC LIMIT 0,10");
        ?>
        <div class="row">
            <div class="col-md-6">
                <div class="box box-info">
                    <div class="box-header with-border">
                        <h3 class="box-title">Latest Transactions</h3>

                        <div class="box-tools pull-right">
                            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                            </button>
                            <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                        </div>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <div class="table-responsive">
                            <table class="table no-margin">
                                <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>Date</th>
                                    <th>Discount</th>
                                    <th>SubTotal</th>
                                    <th>Total</th>

                                </tr>
                                </thead>
                                <tbody>
                                <?php 
        foreach ($arrTtNew as $tt) {
            ?>
                                <tr>
                                    <td><?php 
            echo $tt->detail_id;
            ?>
</td>
                                    <td><?php 
            echo date("d-m-Y", strtotime($tt->detail_date));
            ?>
</td>
                                    <td><?php 
            echo idr($tt->detail_diskon);
            ?>
</td>
                                    <td><?php 
            echo idr($tt->detail_price);
            ?>
</td>
                                    <td><?php 
            echo idr($tt->detail_price_total);
            ?>
</td>

                                </tr>
                                <?php 
        }
        ?>

                                </tbody>
                            </table>
                        </div>
                        <!-- /.table-responsive -->
                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer clearfix">

                        <a href="javascript:openLw('Transaction_Detail', '<?php 
        echo _SPPATH;
        ?>
Msales/MTranDetail', 'fade');
                                activkanMenuKiri('Transaction_Detail');" class="btn btn-sm btn-default btn-flat pull-right">View All Transactions</a>
                    </div>
                    <!-- /.box-footer -->
                </div>
            </div>
            <?php 
        $arrSales = array();
        $prods = array();
        //calculate top products based on sales
        $lltt = new CartPortal();
        global $db;
        $q = "SELECT variant_id,COUNT(*) as count FROM {$lltt->table_name} WHERE (date_updated BETWEEN '{$days_ago}' AND '{$days_now}') GROUP BY variant_id ORDER BY count DESC LIMIT 0,10";
        $arrSales2 = $db->query($q, 2);
        //            pr($arrSales2);
        foreach ($arrSales2 as $pp) {
            $prod = new MProdModel();
            $prod->getByID($pp->variant_id);
            $pp->prod = $prod;
        }
        //            pr($arrSales2);
        //            $arrProd =  $lltt->getWhereFromMultipleTable("(date_updated BETWEEN '$days_ago' AND '$days_now') AND VariantID = detail_varian_id ");
        //
        //            foreach($arrTt as $tt){
        //                $arrProd = $lltt->getWhereFromMultipleTable("detail_trans_id = ".$tt->TransactionID." AND VariantID = detail_varian_id ",array("LL_Article_WImage"));
        //
        ////                pr($arrProd);
        //                foreach($arrProd as $prod){
        //                    $arrSales[$prod->VariantID] += $prod->detail_price_total;
        //                    $prods[$prod->VariantID] = $prod;
        //                }
        //            }
        //
        //            arsort($arrSales);
        //            $arrSales = array_reverse($arrSales);
        //            pr($arrSales);
        ?>
            <div class="col-md-6">
                <div class="box box-success">
                    <div class="box-header with-border">
                        <h3 class="box-title">Top Products</h3>

                        <div class="box-tools pull-right">
                            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                            </button>
                            <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                        </div>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <div class="table-responsive">
                            <table class="table no-margin">
                                <thead>
                                <tr>
                                    <th>ID</th>
<!--                                    <th>Picture</th>-->
                                    <th>Name</th>
                                    <th>Qty</th>
                                    <th>Value</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php 
        foreach ($arrSales2 as $varid => $saledata) {
            //                                    if($varid == '2887')continue;
            ?>
                                <tr>
                                    <td><?php 
            echo $saledata->variant_id;
            ?>
</td>

<!--                                    <td>--><?php 
            //=$prods[$varid]->BaseArticleImageFile;
            ?>
<!--</td>-->
                                    <td><?php 
            echo $saledata->prod->BaseArticleNameENG;
            ?>
</td>
                                    <td><?php 
            echo $saledata->count;
            ?>
</td>
                                    <td>
                                        <?php 
            echo idr($saledata->count * $saledata->prod->SellingPrice);
            ?>
                                    </td>
                                </tr>
                                <?php 
        }
        ?>

                                </tbody>
                            </table>
                        </div>
                        <!-- /.table-responsive -->
                    </div>
<!--                     /.box-body-->
                    <div class="box-footer clearfix">
<!--                        <a href="javascript::;" class="btn btn-sm btn-info btn-flat pull-left">Place New Order</a>-->
                        <a href="javascript:openLw('LL_Article', '<?php 
        echo _SPPATH;
        ?>
LLProdWeb/LL_Article_WImage', 'fade');
                                activkanMenuKiri('LL_Article');" class="btn btn-sm btn-default btn-flat pull-right">View All Articles</a>
                    </div>
                    <!-- /.box-footer -->
                </div>
            </div>
        </div>
        <style>
            ul.legend li{
                list-style: none;
                line-height: 30px;
            }
            ul.legend li div{
                float: left;
                margin-top: 10px;
                margin-right: 15px;
            }
            .legend-item{
                float: left;
                margin: 10px;
                line-height: 30px;
                margin-right: 5px;
            }
            .legend-item div{
                float: left;
                margin-top: 10px;
                margin-right: 5px;
            }
            .breadcrumb {
                padding: 8px 15px;
                margin-bottom: 20px;
                list-style: none;
                background-color: #f5f5f5;
                border-radius: 4px;
            }
            .breadcrumb {
                float: right;
                background: transparent;
                margin-top: 0;
                margin-bottom: 0;
                font-size: 12px;
                padding: 7px 5px;
                position: absolute;
                top: 15px;
                right: 10px;
                border-radius: 2px;
            }
            .users-list-name{
                white-space: nowrap;
            }
        </style>
    <?php 
    }
    function transaction_dineIn()
    {
        $bulan = isset($_GET['m']) ? addslashes($_GET['m']) : $days_now;
        $id_restaurant = isset($_GET['id_restaurant']) ? addslashes($_GET['id_restaurant']) : "1";
        if ($bulan == "") {
            $bulan = date("F Y");
            $days_ago = date('Y-m-01');
            // hard-coded '01' for first day
            $days_now = date('Y-m-t');
        } else {
            $bulan = urldecode($bulan);
            $days_ago = date('Y-m-01', strtotime($bulan));
            // hard-coded '01' for first day
            $days_now = date('Y-m-t', strtotime($bulan));
        }
        $numberDays = cal_days_in_month(CAL_GREGORIAN, date('n', strtotime($bulan)), date('Y', strtotime($bulan)));
        $days_ago = date('Y-m-01', strtotime($bulan));
        // hard-coded '01' for first day
        $days_now = date('Y-m-01', strtotime('+1 month', strtotime($bulan)));
        $t = time();
        $arrStatusPaymentMethod[1] = "Cash";
        $arrStatusPaymentMethod[2] = "Credit Card";
        $arrStatusPaymentMethod[3] = "Others";
        $arrStatusPaymentMethod[0] = "All Payment Method";
        $arrStatusProgress[4] = "Done";
        $arrStatusProgress[9] = "Void";
        $t = time();
        $where = " ";
        if ($id_restaurant == 0) {
            $where = $where;
        } else {
            $allResto = false;
            $where = $where . " o.id_restaurant='{$id_restaurant}' AND ";
        }
        $whereDate = " (o.datetime_order >='{$days_ago}' AND o.datetime_order < '{$days_now}')  ";
        $whereAllDineIn = $where . "  (o.type_order='0' OR  o.type_order='1') AND " . $whereDate;
        $whereAllDineIn_Apps = $where . "  (o.type_order='1' ) AND " . $whereDate;
        $whereAllDineIn_Manu = $where . "  (o.type_order='0' ) AND " . $whereDate;
        $objOrder = new MasterOrderModel();
        $objResto = new MasterRestaurantModel();
        $objOrderDetail = new OrderDetailModel();
        $objDish = new MasterDishModel();
        global $db;
        global $db;
        $qAllSum = "SELECT DATE(o.datetime_order) as date, SUM(o.grand_total) as total_sales FROM {$objOrder->table_name} o ";
        $qAllSum = $qAllSum . " WHERE " . $whereAllDineIn . " GROUP BY  DATE(o.datetime_order) ";
        $arrQueryAllSums = $db->query($qAllSum, 2);
        $qAllSumTotalDineIn = "SELECT * FROM {$objOrder->table_name} o ";
        $qAllSumTotalDineIn = $qAllSumTotalDineIn . " WHERE " . $whereAllDineIn;
        $arrQueryAllSumsTotalDineIn = $db->query($qAllSumTotalDineIn, 2);
        $qAllSumTotalDineInApps = "SELECT * FROM {$objOrder->table_name} o ";
        $qAllSumTotalDineInApps = $qAllSumTotalDineInApps . " WHERE " . $whereAllDineIn_Apps;
        $arrQueryAllSumsTotalDineInApps = $db->query($qAllSumTotalDineInApps, 2);
        //        pr($qAllSumTotalTakeAwayApps);
        $qAllSumTotalDineInManual = "SELECT * FROM {$objOrder->table_name} o ";
        $qAllSumTotalDineInManual = $qAllSumTotalDineInManual . " WHERE " . $whereAllDineIn_Manu;
        $arrQueryAllSumsTotalDineManual = $db->query($qAllSumTotalDineInManual, 2);
        $qAllLastTransaction = "SELECT * FROM {$objOrder->table_name} o ";
        $qAllLastTransaction = $qAllLastTransaction . " WHERE " . $whereAllDineIn . " ORDER   BY o.datetime_order DESC ";
        $arrQueryLastTransaction = $db->query($qAllLastTransaction, 2);
        $qTopDish = "SELECT  Distinct d.name  FROM `menurevo__ms_order` o  Inner Join menurevo__order_detail od ON o.id_order = od.id_order Inner JOIN  menurevo__ms_dish d on d.id_dish = od.id_dish  WHERE ";
        $qTopDish = $qTopDish . " o.id_restaurant = " . $id_restaurant . " AND (o.type_order='0' OR  o.type_order='0') AND " . $whereDate . " Order By od.quantity DESC";
        $arrQueryTopDish = $db->query($qTopDish, 2);
        ?>
<div class="row">
            <div class="col-md-12">
                <h1>
                    Transaction Dashboard
                    <small><?php 
        echo $bulan;
        ?>
</small>
                </h1>
                <ol class="breadcrumb">
                    <li>
                        <?php 
        echo Lang::t('Restaurant');
        ?>
                    </li>

                    <li class="active">
                        <?php 
        $objResto = new MasterRestaurantModel();
        $arrResto = $objResto->getAll();
        foreach ($arrResto as $resto) {
            if ($resto->name != "") {
                $arrRestoIndex[$resto->id_restaurant] = $resto->name;
            }
        }
        ?>
                        <select id = "restoID_<?php 
        echo $t;
        ?>
" >
                            <?php 
        foreach ($arrRestoIndex as $key => $val) {
            if ($key == $id_restaurant) {
                echo "<option selected='selected' value='" . $key . "'>" . $val . "</option>";
            } else {
                echo "<option value='" . $key . "'>" . $val . "</option>";
            }
        }
        ?>
                        </select>
                        <script>
                            $("#restoID_<?php 
        echo $t;
        ?>
").change(function () {
                                var slc = $("#restoID_<?php 
        echo $t;
        ?>
").val();
                                var m = $("#apptimeselector_<?php 
        echo $t;
        ?>
").val();
                                openLw("Transaction", "<?php 
        echo _SPPATH;
        ?>
BIWebTransaction/transaction_dineIn?id_restaurant=" + slc + "&m=" + m, "fade");
                            });
                        </script>
                    </li>

                    <li>
                        <?php 
        echo Lang::t('Select Timeframe');
        ?>
                    </li>

                    <li class="active">
                        <?php 
        $start = new DateTime('11 months ago');
        // So you don't skip February if today is day the 29th, 30th, or 31st
        $start->modify('first day of this month');
        $end = new DateTime();
        $interval = new DateInterval('P1M');
        $period = new DatePeriod($start, $interval, $end);
        ?>
                        <select id="apptimeselector_<?php 
        echo $t;
        ?>
">
                            <?php 
        foreach ($period as $dt) {
            ?>
                                <option value="<?php 
            echo urlencode($dt->format('F Y'));
            ?>
" <?php 
            if ($dt->format('F Y') == $bulan) {
                echo "selected";
            }
            ?>
>
                                    <?php 
            echo $dt->format('F Y') . "<br>";
            ?>
                                </option>
                            <?php 
        }
        ?>

                        </select>
                        <script>
                            $("#apptimeselector_<?php 
        echo $t;
        ?>
").change(function () {
                                var slc = $("#restoID_<?php 
        echo $t;
        ?>
").val();
                                var m = $("#apptimeselector_<?php 
        echo $t;
        ?>
").val();
                                openLw("Transaction", "<?php 
        echo _SPPATH;
        ?>
BIWebTransaction/transaction_dineIn?id_restaurant=" + slc + "&m=" + m, "fade");
                            });
                        </script>
                    </li>
                </ol>
            </div>
        </div>




        <div class="row">
            <div class="col-md-4">
                <div class="small-box bg-aqua">
                    <div class="inner">
                        <h3><small style="color: white;font-weight: bold;"><?php 
        echo count($arrQueryAllSumsTotalDineInApps);
        ?>
</small></h3>
                        <p>Total Dine In Apps</p>
                    </div>

                    <div class="icon">
                        <i class="ion ion-bag"></i>

                    </div>
                    <!--                            <a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>-->
                </div>
            </div>
            <div class="col-md-4">
                <div class="small-box bg-green">
                    <div class="inner">

                        <h3><small style="color: white;font-weight: bold;"><?php 
        echo count($arrQueryAllSumsTotalDineManual);
        ?>
</small></h3>

                        <p>Total Dine In Manual</p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-stats-bars"></i>
                    </div>
                    <!--                            <a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>-->
                </div>
            </div>
            <div class="col-md-4">
                <div class="small-box bg-yellow">
                    <div class="inner">


                        <h3><?php 
        echo count($arrQueryAllSumsTotalDineIn);
        ?>
</h3>

                        <p>Total of Transactions</p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-stats-bars"></i>
                    </div>
                    <!--                            <a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>-->
                </div>
            </div>

        </div>

        <div class="row">
            <div class="col-md-12">
                <div class="box box-default">
                    <div class="box-header with-border">
                        <h3 class="box-title">All Transaction (Apps and Manual)</h3>

                        <div class="box-tools pull-right">
                            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                            </button>
                            <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                        </div>
                    </div>
                    <div class="box-body chart-responsive">

                        <?php 
        $data = self::getAppStats($arrQueryAllSums, $days_ago, $days_now);
        ?>


                    </div>
                    <!-- /.box-body -->
                </div>
            </div>

        </div>


        <div class="row">
            <div class="col-md-7">
                <div class="box box-info">
                    <div class="box-header with-border">
                        <h3 class="box-title">Latest Transactions</h3>

                        <div class="box-tools pull-right">
                            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                            </button>
                            <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                        </div>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <div class="table-responsive">
                            <table class="table no-margin">
                                <thead>
                                    <tr>
                                        <th>ID Order</th>
                                        <th>Table</th>
                                        <th>Type Order</th>
                                        <th>Status</th>
                                        <th>Grand Total</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php 
        foreach ($arrQueryLastTransaction as $id => $tt) {
            if ($id >= '9') {
                exit;
            }
            ?>
                                        <tr>
                                            <td><?php 
            echo $tt->id_order;
            ?>
</td>
                                            <td><?php 
            echo $tt->id_table;
            ?>
</td>
                                            <td><?php 
            if ($tt->type_order == '0') {
                echo "Dine In - Manual";
            } elseif ($tt->type_order == '1') {
                echo "Dine In - Apps";
            } elseif ($tt->type_order == '2') {
                echo "Take Away - Manual";
            } elseif ($tt->type_order == '3') {
                echo "Take Away - Apps";
            }
            ?>
</td>
                                            <td><?php 
            if ($tt->status == '0') {
                echo "Wait";
            } else {
                if ($tt->status == '1') {
                    echo "Cook";
                } else {
                    if ($tt->status == '2') {
                        echo "Done";
                    } else {
                        if ($tt->status == '3') {
                            echo "Kitchen Done";
                        } else {
                            if ($tt->status == '4') {
                                echo "Paid";
                            } else {
                                if ($tt->status == '9') {
                                    echo "Void";
                                }
                            }
                        }
                    }
                }
            }
            $tt->status;
            ?>
</td>
                                            <td><?php 
            echo idr($tt->grand_total);
            ?>
</td>
                                        </tr>
                                    <?php 
        }
        ?>

                                </tbody>
                            </table>
                        </div>
                        <!-- /.table-responsive -->
                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer clearfix">

                                <!--                        <a href="javascript:openLw('Transaction_Detail', '<?php 
        echo _SPPATH;
        ?>
LLAccWeb/LL_TransactionDetail', 'fade');
                                                           activkanMenuKiri('Transaction_Detail');" class="btn btn-sm btn-default btn-flat pull-right">View All Transactions</a>-->
                    </div>
                    <!-- /.box-footer -->
                </div>
            </div>

            <div class="col-md-5">
                <div class="box box-success">
                    <div class="box-header with-border">
                        <h3 class="box-title">Top Dishes</h3>


                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <div class="table-responsive">
                            <table class="table no-margin">
                                <thead>
                                    <tr>
                                        <th>ID</th>
        <!--                                    <th>Picture</th>-->
                                        <th>Name</th>

                                    </tr>
                                </thead>
                                <tbody>
                                    <?php 
        foreach ($arrQueryTopDish as $varid => $saledata) {
            if ($varid >= '9') {
                exit;
            }
            ?>
                                        <tr>
                                            <td><?php 
            echo $varid + 1;
            ?>
</td>
                                            <td><?php 
            echo $saledata->name;
            ?>
</td>
                                        </tr>
                                    <?php 
        }
        ?>

                                </tbody>
                            </table>
                        </div>
                        <!-- /.table-responsive -->
                    </div>
                    <!--                     /.box-body-->
                    <div class="box-footer clearfix">
                        <!--                        <a href="javascript::;" class="btn btn-sm btn-info btn-flat pull-left">Place New Order</a>-->
        <!--                        <a href="javascript:openLw('LL_Article', '<?php 
        echo _SPPATH;
        ?>
LLProdWeb/LL_Article_WImage', 'fade');
                           activkanMenuKiri('LL_Article');" class="btn btn-sm btn-default btn-flat pull-right">View All Articles</a>-->
                    </div>
                    <!-- /.box-footer -->
                </div>
            </div>
        </div>
        <style>
            ul.legend li{
                list-style: none;
                line-height: 30px;
            }
            ul.legend li div{
                float: left;
                margin-top: 10px;
                margin-right: 15px;
            }
            .legend-item{
                float: left;
                margin: 10px;
                line-height: 30px;
                margin-right: 5px;
            }
            .legend-item div{
                float: left;
                margin-top: 10px;
                margin-right: 5px;
            }
            .breadcrumb {
                padding: 8px 15px;
                margin-bottom: 20px;
                list-style: none;
                background-color: #f5f5f5;
                border-radius: 4px;
            }
            .breadcrumb {
                float: right;
                background: transparent;
                margin-top: 0;
                margin-bottom: 0;
                font-size: 12px;
                padding: 7px 5px;
                position: absolute;
                top: 15px;
                right: 10px;
                border-radius: 2px;
            }
            .users-list-name{
                white-space: nowrap;
            }
        </style>
        <?php 
    }