<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
<?php
$v = "";



if ($this->input->post('start_date')) {
    $v .= "&start=" . $this->input->post('start_date1');
}
if ($this->input->post('end_date')) {
    $v .= "&end=" . $this->input->post('end_date1');
}
?>

<script type="text/javascript">
    $(document).ready(function () {
        $('#form').hide();
        $('.toggle_down').click(function () {
            $("#form").slideDown();
            return false;
        });
        $('.toggle_up').click(function () {
            $("#form").slideUp();
            return false;
        });

    });
</script>

<div class="box">
    <div class="box-header">
        <h2 class="blue">
            <i class="fa-fw fa fa-cubes"></i><?= lang('Operation_Summary_Report'); ?> <?php
            if ($this->input->post('start_date')) {
                echo "From " . $this->input->post('start_date') . " to " . $this->input->post('end_date');
            }
            ?>
        </h2>

        <div class="box-icon">
            <ul class="btn-tasks">
                <li class="dropdown">
                    <a href="#" class="toggle_up tip" title="<?= lang('hide_form') ?>">
                        <i class="icon fa fa-toggle-up"></i>
                    </a>
                </li>
                <li class="dropdown">
                    <a href="#" class="toggle_down tip" title="<?= lang('show_form') ?>">
                        <i class="icon fa fa-toggle-down"></i>
                    </a>
                </li>
            </ul>
        </div>
        <div class="box-icon">
            <ul class="btn-tasks">
                <li class="dropdown">
                    <a href="#" id="xls" class="tip" title="<?= lang('download_xls') ?>">
                        <i class="icon fa fa-file-excel-o"></i>
                    </a>
                </li>
                <li class="dropdown">
                    <a href="#" id="image" class="tip" title="<?= lang('save_image') ?>">
                        <i class="icon fa fa-file-picture-o"></i>
                    </a>
                </li>
            </ul>
        </div>
    </div>
    <div class="box-content">
        <div class="row">
            <div class="col-lg-12">

                <p class="introtext"><?= lang('customize_report'); ?></p>

                <div id="form">

                    <?php echo admin_form_open("reports/Summary_datewise_report"); ?>
                    <div class="row">

                        

                        <!--<div class="col-sm-4">-->
                        <!--    <div class="form-group">-->
                        <!--         <?= lang("start_date", "start_date"); ?>-->
                        <!--       <input type="date" name="start_date" id="" class="form-control datetime">-->
                               
                        <!--    </div>-->
                        <!--</div>-->
                        <div class="col-md-4">
                                <div class="form-group">
                                   <label>Start Date</label>
                                    <?php echo form_input('start_date', (isset($_POST['start_date']) ? $_POST['start_date'] : ""), 'class="form-control input-tip datetime" id="sldate" required="required"'); ?>
                                </div>
                        </div>
                        
                        <div class="col-md-4">
                                <div class="form-group">
                                    <label>End Date</label>
                                    <?php echo form_input('end_date', (isset($_POST['end_date']) ? $_POST['end_date'] : ""), 'class="form-control input-tip datetime" id="sldate" required="required"'); ?>
                                </div>
                        </div>
                        <!--<div class="col-sm-4">-->
                        <!--    <div class="form-group">-->
                        <!--         <?= lang("end_date", "end_date"); ?>-->
                        <!--       <input type="date" name="end_date"  id="" class="form-control datetime">-->
                        <!--    </div>-->
                        <!--</div>-->
                    </div>
                    <div class="form-group">
                        <div
                            class="controls"> <?php echo form_submit('submit_report', $this->lang->line("submit"), 'class="btn btn-primary"'); ?> </div>
                    </div>
                    <?php echo form_close(); ?>

                </div>
                
              
                <div class="clearfix"></div>
                
                <div class="box-content">
        <div class="row">
            <div class="col-lg-12">
                <!--<p class="introtext"><?= lang('view_pl_report'); ?></p>-->

                <div class="row">
                    <div class="col-sm-12">
             
                         <div class="col-sm-4">
                            <div class="small-box padding1010 bdarkGreen">
                              
                                <h4 class="bold"><?= lang('Sale_Summary') ?></h4>
                               
                                <i class="icon fa fa-heart"></i>

                                <h3 class="bold"><?= $this->sma->formatMoney($total_sales->total_amount) ?></h3>
                                

                                <!--<p class="bold"><?= $total_sales->total . ' ' . lang('Sale_Summary') ?> </p>-->

                                <p><?= lang('Total_Sales : ').' '. $this->sma->formatMoney($total_sales->total)  ?><br>
                                  <?= lang('Receive_Amount :').''.$this->sma->formatMoney($total_sales->paid) ?>,<br>
                                <?= lang('Vat_Amount :'). ' '. $this->sma->formatMoney($total_sales->tax) ?> <br>
                                 <?= lang('Due_Amount : ') .''.$this->sma->formatMoney($total_sales->due_amnt)  ?></p>
                                     
                            </div>
                        </div>
                     
                   
                        
                         <div class="col-sm-4">
                            <div class="small-box padding1010 bpurple">
                                <h4 class="bold"><?= lang('Expense_Summary') ?></h4>
                                <i class="icon fa fa-usd"></i>

                                <h3 class="bold"><?= $this->sma->formatMoney($total_expenses->total_amount) ?></h3>

                                <p class="bold"><?= lang('Total_Expense : ').''.$total_expenses->total ?></p>

                                <p>&nbsp;</p>
                            </div>
                        </div>
                       
                         
                        <div class="col-sm-4">
                            <div class="small-box padding1010 borange">
                                <h4 class="bold"><?= lang('Purchase_Summary') ?></h4>
                                <i class="icon fa fa-star"></i>

                                <h3 class="bold"><?= $this->sma->formatMoney($total_purchases->total_amount) ?></h3>
                                  
                                <!--<p class="bold"><?= $total_purchases->total . ' ' . lang('Purchase_Summary') ?> </p>-->

                                <p><?= lang('Total_Purchase : ').''.$this->sma->formatMoney($total_purchases->total)  ?><br>
                                     <?= lang('Receive_Amount : ').''.$this->sma->formatMoney($total_purchases->paid)  ?><br>
                                     <?= lang('Vat_Amount : ') .''.$this->sma->formatMoney($total_purchases->tax)  ?><br>
                                      <?= lang('Due_Amount : ') .''.$this->sma->formatMoney($total_purchases->due_amnt)  ?></p>
                                     
                            </div>
                        </div>
                        
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="col-sm-4">
                            <div class="small-box padding1010 bdarkGreen">
                                <h4 class="bold"><?= lang('payments_received') ?></h4>
                                <i class="icon fa fa-usd"></i>

                                 <h3 class="bold"><?= $this->sma->formatMoney($total_received->total_amount) ?></h3>

                                <p class="bold"><?= $total_received->total . ' ' . lang('received') ?> </p>

                                <p><?= $this->sma->formatMoney($total_received_cash->total_amount) . ' ' . lang('cash') ?><br>
                                     <?= $this->sma->formatMoney($total_received_cc->total_amount) . ' ' . lang('CC') ?><br>
                                     <?= $this->sma->formatMoney($total_received_cheque->total_amount) . ' ' . lang('cheque') ?>
                                   
                            </div>
                        </div>
                        <div class="col-sm-4">
                            <div class="small-box padding1010 borange">
                                <h4 class="bold"><?= lang('payments_sent') ?></h4>
                                <i class="icon fa fa-usd"></i>

                                <h3 class="bold"><?= $this->sma->formatMoney($total_paid->total_amount) ?></h3>

                                <p><?= $total_paid->total . ' ' . lang('sent') ?></p>

                                <p>&nbsp;</p>
                            </div>
                        </div>
                        
                    </div>
                </div>
               
                <div class="row">
                    <div class="col-sm-12">
                        <div class="col-sm-12">
                            <div class="small-box padding1010 bmGreen">
                                <h4 class="bold"><?= lang('Operation_Summary') ?></h4>
                                <i class="icon fa fa-pie-chart"></i>
                                 
                                
                                 <p class="bold"><?= $this->sma->formatMoney($total_sales->total_amount  - $total_expenses->total_amount - $total_purchases->total_amount) . ' ' . lang('Operation_Summary') ?> </p>
                            </div>
                        </div>
                    </div>
                </div>
                
            </div>
        </div>
    </div>
               

            </div>
        </div>
    </div>
</div>
   
<script type="text/javascript" src="<?= $assets ?>js/html2canvas.min.js"></script>
<script type="text/javascript">
    
</script>