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 
    }
示例#2
0
    function free()
    {
        $app = new AppAccount();
        $arrApp = $app->getWhere("app_active = 1 AND app_type = 1 ORDER BY app_contract_start ASC");
        //        pr($arrApp);
        ?>
        <h1>Free Approval Queue</h1>
        <div class="table-responsive">
            <table class="table table-striped">
                <thead>
                <tr>
                    <th>
                        App Details
                    </th>
                    <th>
                        Organization Details
                    </th>
                    <th>
                        User & Agent
                    </th>
                    <th>
                        Contract
                    </th>
                    <th>
                        Paket
                    </th>
                    <th>
                        Status
                    </th>

                </tr>
                </thead>
                <tbody>
                <?php 
        foreach ($arrApp as $app) {
            $paket = new Paket();
            $paket->getByID($app->app_paket_id);
            $acc = new Account();
            $acc->getByID($app->app_client_id);
            $agent = new Account();
            if ($acc->admin_marketer != "") {
                $agent->getByUsername($acc->admin_marketer);
            }
            $vp = new VpTransaction();
            $arrT = $vp->getWhere("order_app_id = '{$app->app_id}'");
            $free = new AppFree();
            $free->getByID($app->app_id);
            ?>
                    <tr>
                        <td>
                            ID :<?php 
            echo $app->app_id;
            ?>
<br>
                            <?php 
            echo $app->app_name;
            ?>
                        </td>
                        <td>
                            Apply Date : <?php 
            echo $free->free_date;
            ?>
<br>
                            Org Name : <?php 
            echo $free->free_org_name;
            ?>
<br>
                            Org Type : <?php 
            echo $free->free_org_type;
            ?>
<br>
                            Address : <?php 
            echo $free->free_address;
            ?>
<br>
                            Contact Name : <?php 
            echo $free->free_org_name;
            ?>
<br>
                            Phone : <?php 
            echo $free->free_org_name;
            ?>
<br>
                            Email : <?php 
            echo $free->free_org_name;
            ?>
<br>
                            Docs : <br><?php 
            $exp = explode(",", $free->free_org_docs);
            foreach ($exp as $x) {
                ?>
                                <a href="<?php 
                echo _SPPATH . _PHOTOURL . "inputfiles/" . $x;
                ?>
" target="_blank">
                                    <img src="<?php 
                echo _SPPATH . _PHOTOURL . "inputfiles/" . $x;
                ?>
" width="100px">
                                </a>
                                <?php 
            }
            ?>


                        </td>
                        <td>
                            <?php 
            echo $acc->admin_username;
            ?>
                            <?php 
            echo $acc->admin_nama_depan;
            ?>
                            <br>
                            <?php 
            echo $acc->admin_email;
            ?>
<br>
                            <?php 
            echo $acc->admin_phone;
            ?>
                            <hr>
                            Agent <br>
                            <?php 
            echo $agent->admin_username;
            ?>
                            <?php 
            echo $agent->admin_nama_depan;
            ?>
                            <br>
                            <?php 
            echo $agent->admin_email;
            ?>
<br>
                            <?php 
            echo $agent->admin_phone;
            ?>
                        </td>
                        <td>Start :
                            <?php 
            echo $app->app_contract_start;
            ?>
                            <br> End :
                            <?php 
            echo $app->app_contract_end;
            ?>

                        </td>
                        <td><?php 
            echo $paket->paket_name;
            ?>
</td>
                        <td>
                            <?php 
            echo $app->app_active;
            ?>
<br>
                            <button onclick="accept_free('<?php 
            echo $app->app_id;
            ?>
');"  class="btn btn-default">Accept App</button><br>
                            <button onclick="reject_free('<?php 
            echo $app->app_id;
            ?>
');" class="btn btn-default">Reject App</button><br>
                            <button onclick="view_free('<?php 
            echo $app->app_id;
            ?>
');" class="btn btn-default">View App</button>
                        </td>
                    </tr>
                <?php 
        }
        ?>
                </tbody>
            </table>
        </div>
        <script>

            function accept_free(id){

                if(confirm("this will accept the app"))
                $.post("<?php 
        echo _SPPATH;
        ?>
JobBE/actionfree",{app_id:id,action : "accept"},function(data){

                    console.log(data);
                    if(data.bool){
                        alert("Sukses");
                        lwrefresh('Accept_Free_Apps');
                    }else{
                        alert("Gagal");
                    }
                },'json');

            }
            function reject_free(id){
                if(confirm("this will reject the app"))
                $.post("<?php 
        echo _SPPATH;
        ?>
JobBE/actionfree",{app_id:id,action : "reject"},function(data){

                    console.log(data);
                    if(data.bool){
                        alert("Sukses");
                        lwrefresh('Accept_Free_Apps');
                    }else{
                        alert("Gagal");
                    }
                },'json');
            }
            function view_free(id){

            }
        </script>
    <?php 
    }
    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 
    }
示例#4
0
 function testDate()
 {
     $date = new DateTime();
     $date->setDate(2016, 31, 1);
     $ymd = $date->format('Y-m-d');
     $ymd = "2016-01-31";
     $prev_mon = date('Y-m-d', strtotime($ymd . " +1 month"));
     $prev_year = date('Y-m-d', strtotime($ymd . " +4 months"));
     echo "     &nbsp; &nbsp; &nbsp; " . $prev_mon . " " . $prev_year;
     $curMonth = 7;
     $curYear = 2016;
     if ($curMonth == 12) {
         $firstDayNextMonth = mktime(0, 0, 0, 0, 0, $curYear + 1);
     } else {
         $firstDayNextMonth = mktime(0, 0, 0, $curMonth + 1, 1);
     }
     pr(date("Y-m-d", $firstDayNextMonth));
     pr(getFirstDayOfNextMonth($curMonth, $curYear));
     pr(getFirstDayOfNext4Month($curMonth, $curYear));
     $app = new AppAccount();
     $app->getByID(19);
     $vpt = new VpTransaction();
     $vpt->getByID("14720056041915");
     $vpt->order_id = 1122;
     //        KomisiModel::log($app,$vpt);
     $nn = new AppFree();
     $nn->printColumlistAsAttributes();
 }
    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 
    }
示例#6
0
    function error()
    {
        $order_id = addslashes($_GET['order_id']);
        $status_code = addslashes($_GET['status_code']);
        $transaction_status = addslashes($_GET['transaction_status']);
        $vpt = new VpTransaction();
        $vpt->getByID($order_id);
        $app = new AppAccount();
        $app->getByID($vpt->order_app_id);
        AppAccount::checkOwnership($app);
        $vpt->order_status_from = $status_code;
        $vpt->save();
        ?>
        <div class="container attop"  >
            <div class="col-md-8 col-md-offset-2">

                <div style="text-align: center; padding: 20px;">
                    <a href="<?php 
        echo _SPPATH;
        ?>
">
                        <img src="<?php 
        echo _SPPATH;
        ?>
images/appear-icontext.png" style="max-width: 300px;">
                    </a>
                </div>
                <?php 
        ?>

                <h1>Error</h1>
                <p>Your Payment Error</p>

                <p>
                    Please <a href="<?php 
        echo _SPPATH;
        ?>
contact">contact us</a> for more details.
                </p>

                <a class="btn btn-default" href="<?php 
        echo _SPPATH;
        ?>
myApps">back to my Apps</a>
                <?php 
        ?>
            </div>
        </div>
        <?php 
        /*
        * Array
        (
            [url] => vp/error
            [order_id] => 70872981
            [status_code] => 202
            [transaction_status] => deny
        )
        */
    }