function get_form_html($form_id, $date) { ob_start(); ?> <div id="head_div" style="padding: 5px 0; background-color: #ECECEC; color: #21ACD7; border-radius: 5px;margin-left: auto; text-align: center; "> DAY END REPORT OF <input id="date_field" value="<?php if ($date == 0) { $date = date('d/m/Y', time()); } echo $date; ?> " /> </div> <div id="sales_items_table" style="margin-top: 10px; background-color:transparent;padding-bottom: 30px;"> <style> div#purchace_items td{ border: 1px solid #21ACD7; } div#purchace_items tbody td{ padding: 5px 0 5px 5px; } div#purchace_items tbody td input,div#purchace_items tbody td select{ padding: 0; border: 0; margin: 0; height: 100%; width: 100%; background-color: transparent; } </style> <div id="purchace_items" style="width: 100%; padding: 10px 0; color: #21ACD7;"> <font>SALES ITEMS</font> <table id="sales_items_table" style="border-collapse: collapse; width: 100%; background-color: #fff; border-radius: 10px; color: #21ACD7; margin-top: 5px; margin-bottom: 20px;"> <thead style="text-align: center;"> <tr> <td style="width: 5%;"> # </td> <td> ITEM </td> <td style="width: 15%;"> COUNT </td> <td style="width: 15%;"> TOTAL </td> </tr> </thead> <tbody style="padding-left: 3px; text-align: center; "> <?php $grand_total = 0; $total_count = 0; $user = new user(); $user->id = $_SESSION['user_id']; $user->getUser(); $shop = new company(); $shop->id = $user->company_id; $shop->getCompany(); $sale_item = new sales_items(); $date = str_replace('/', '-', $date); $date = date('Y-m-d', strtotime($date)); $sales_items = $sale_item->getOneDaysSaleItems($user->company_id, $date); $i = 0; if ($sales_items == NULL || sizeof($sales_items) == 0) { echo '<tr><td colspan="8"> No Sales Items Found </td></tr>'; } else { foreach ($sales_items as $sales_item) { $grand_total = $grand_total + $sales_item->total; $total_count = $total_count + $sales_item->quantity; ?> <tr> <td style="text-align: center;"> <?php echo ++$i; ?> </td> <?php $item = new item(); $item->id = $sales_item->item_id; $item->getItem(); ?> <td style="text-align: left;"> <?php echo $item->item_name . ' ( ' . $item->item_code . ' )'; ?> </td> <td> <?php echo number_format($sales_item->quantity, 3, '.', ''); ?> </td> <td id="tax"> <?php echo number_format($sales_item->total, 2, '.', ''); ?> </td> </tr> <?php } } ?> <tr> <td></td> <td style="text-align: right;"> TOTAL </td> <td><?php echo number_format($total_count, 3, '.', ''); ?> </td> <td><?php echo number_format($grand_total, 2, '.', ''); ?> </td> </tr> </tbody> </table> <font>STATISTICS</font> <table id="sales_statistics_table" style="border-collapse: collapse; width: 100%; background-color: #fff; border-radius: 10px; color: #21ACD7; margin-top: 5px; margin-bottom: 20px;"> <thead style="text-align: center;"> <tr> <td style="width: 5%;"> # </td> <td> STATISTICS </td> <td style="width: 15%;"> COUNT </td> <td style="width: 15%;"> TOTAL TAX </td> <td style="width: 15%;"> TOTAL NET. AMOUNT </td> <td style="width: 15%;"> TOTAL DISCOUNT </td> <td style="width: 15%;"> TOTAL AMOUNT </td> </tr> </thead> <tbody style="text-align: center;"> <tr style="margin-top: 20px;"> <?php $sale = new sales(); $vals = $sale->getOneDaysSaleStatistics($user->company_id, $date); ?> <td>1</td> <td style="text-align: left;">SALES</td> <td><?php echo $vals['count']; ?> </td> <td><?php echo number_format($vals['tax_amount'], 2, '.', ''); ?> </td> <td><?php echo number_format($vals['net_amount'], 2, '.', ''); ?> </td> <td><?php echo number_format($vals['discount'], 2, '.', ''); ?> </td> <td><?php echo number_format($vals['amount'], 2, '.', ''); ?> </td> </tr> </tbody> </table> <font>TAX</font> <table id="sales_statistics_table" style="border-collapse: collapse; width: 100%; background-color: #fff; border-radius: 10px; color: #21ACD7; margin-top: 5px;"> <thead style="text-align: center;"> <tr> <td style="width: 5%;"> # </td> <td> TAX(%) </td> <td style="width: 20%;"> COUNT </td> <td style="width: 20%;"> TOTAL TAX </td> </tr> </thead> <tbody style="text-align: center;"> <?php $total_tax = 0; $total_count = 0; $tax_category = new tax_category(); $tax_categories = $tax_category->getTaxCategories(); if (is_array($tax_categories) and count($tax_categories)) { $i = 0; foreach ($tax_categories as $tax_category) { ?> <tr style="margin-top: 20px;"> <?php $tax_vals = $sale->getOneDayTaxDetails($user->company_id, $date, $tax_category->id); ?> <td><?php echo ++$i; ?> </td> <td style="text-align: left; padding-left: 10px;"><?php echo $tax_category->tax_category_name; ?> </td> <td><?php echo number_format($tax_vals['count'], 0, '.', ''); ?> </td> <td><?php echo number_format($tax_vals['tax'], 2, '.', ''); ?> </td> </tr> <?php $total_tax += $tax_vals['tax']; $total_count += $tax_vals['count']; } } ?> <tr style="margin-top: 20px;"> <td></td> <td style="text-align: right; padding-right: 10px;">TOTAL</td> <td><?php echo number_format($total_count, 0, '.', ''); ?> </td> <td><?php echo number_format($total_tax, 2, '.', ''); ?> </td> </tr> </tbody> </table> </div> </div> <script type="text/javascript"> function load_day_end_report(){ var date = $('input#date_field').val(); get_form(24, function(html, tools) { $('div#form-body').html(html); $('div#content-body-action-tools').html(tools); }, function(message) { $('font#section_heading').empty(); $('div#form-body').empty(); alert(message); }, date); } function on_print_clicked() { var date = $('input#date_field').val(); var header = '<font style="color:#21ACD7; font-size:24px; "><?php echo $shop->company_name . " " . $shop->company_code; ?> </font>' +'<br/><font style="color:#21ACD7; font-size:20px; ">DAY END REPORT OF '+date+'</font>'; $('div#print_container_header') .html(header); var html = $('div#sales_items_table').html(); $('div#print_container_body').html(html); print(); $('div#print_container_header').empty(); $('div#print_container_body').empty(); $('div#print_container_footer').empty(); } function setup_datepicker(){ $('input#date_field').datepick({ minDate:'26/04/2015', dateFormat:'dd/mm/yyyy', maxDate:'0', onSelect:function(){ load_day_end_report(); } }); } setup_datepicker(); </script> <?php $form = ob_get_clean(); return $form; }
function get_form_html($form_id, $id) { ob_start(); ?> <style> .field_name{ width: 20%; } .field input{ width: 100%; margin-left: 0px; } .field .parent{ padding: 0px 0px; } .field select{ width: 100%; } </style> <div id="head_div" style="padding: 5px 0; background-color: #ECECEC; color: #21ACD7; border-radius: 5px;margin-left: auto;display: none; text-align: center; "> </div> <div style="margin-top: 10px; background-color:transparent;padding-bottom: 30px;"> <form action="#" method="post" class="action_form" operation="add" style="width:100%;" > <table style="width:100%;"> <tr> <td class="field_name"> <font>ITEM NAME</font> </td> <td class="field"> <div class="parent"> <input type="text" id="item_name" required /> </div> </td> </tr> <tr> <td class="field_name"> <font>ITEM CODE </font> </td> <?php $item = new item(); $item_code = $item->getMaxItemCode() + 1; $item_code = sprintf('%04d', $item_code); ?> <td class="field"> <div class="parent"> <input type="text" id="item_code" required value="<?php echo $item_code; ?> "/> </div> </td> </tr> <tr> <td class="field_name"> <font>ITEM MRP </font> </td> <td class="field"> <div style="padding: 0px 0px;"> <input type="number" id="mrp" required step="0.01" /> </div> </td> </tr> <tr> <td class="field_name"> <font>PURCHACE RATE</font> </td> <td class="field"> <div class="parent"> <input type="number" id="purchace_rate" required step="0.01"/> </div> </td> </tr> <tr> <td class="field_name"> <font>TAX CATEGORY</font> </td> <td class="field"> <div class="parent"> <select id="tax_category" required > <option value=""></option> <?php $tax_category = new tax_category(); $tax_categories = $tax_category->getTaxCategories(); foreach ($tax_categories as $tax_category) { echo '<option id="' . $tax_category->id . '" value="' . $tax_category->tax_percentage . '">' . $tax_category->tax_category_name . '</option>'; } ?> </select> </div> </td> </tr> <tr> <td class="field_name"> <font>UNIT</font> </td> <td class="field"> <div class="parent"> <select id="unit" required > <option value=""></option> <option id="1" value="1">KGM</option> <option id="2" value="2">PCS</option> </select> </div> </td> </tr> <tr> <td class="field_name"> <font>DISCOUNT PERCENT</font> </td> <td class="field"> <div class="parent"> <input type="number" id="discount_percent" min="0" max="100" required step="0.01"/> </div> </td> </tr> <tr></tr> <tr> <td></td> <td> <div style="padding: 0px 12px;"> <div style="width: 100%; margin-left: -12px; padding: 12px; background-color: #0d92bb; border-radius: 5px; float: left;"> <div style="width: 50%; float: right; "> <input style="width: 100%;" type="submit" value="ADD" /> </div> <div style="width: 50%;"> <input style="width: 100%;" type="reset" value="CANCEL" /> </div> </div> </div> </td> </tr> </table> </form> </div> <script type="text/javascript"> function setFormActionListener(){ $('form.action_form').on('submit', function(e) { e.preventDefault(); var id = 11; var operation = $(this).attr('operation'); if (operation == 'add') { var data = { form_id: id, item_name: $('form input#item_name').val(), item_code: $('form input#item_code').val(), mrp: $('form input#mrp').val(), purchace_rate: $('form input#purchace_rate').val(), discount_percent: $('form input#discount_percent').val(), tax_category_id: $('form select#tax_category').find('option:selected').attr('id'), unit: $('form select#unit').val() } add_form_data(data, function(message) { get_form(11, function(html, tools) { $('div#form-body').html(html); $('div#content-body-action-tools').html(tools); }, function(message) { $('font#section_heading').empty(); $('div#form-body').empty(); alert(message); }); alert(message); }, function(message) { alert(message); }); } else if (operation == 'update') { var item_id = $('form.action_form').attr('item_id'); var data = { form_id: id, item_id: item_id, item_name: $('form input#item_name').val(), item_code: $('form input#item_code').val(), mrp: $('form input#mrp').val(), purchace_rate: $('form input#purchace_rate').val(), discount_percent: $('form input#discount_percent').val(), tax_category_id: $('form select#tax_category').find('option:selected').attr('id'), unit: $('form select#unit').val() } update_form_data(data, function(message) { load_items_list(); alert(message); }, function(message) { alert(message); }); } else { alert("Invalid Operation " + id + ' - ' + operation); } }); }; setFormActionListener(); </script> <?php $form = ob_get_clean(); return $form; }
function get_form_html($form_id, $id) { ob_start(); ?> <style> .field_name{ width: 20%; } .field input{ width: 100%; margin-left: 0px; } .field .parent{ padding: 0px 0px; } .field select{ width: 100%; } </style> <div id="head_div" style="padding: 5px 0; background-color: #ECECEC; color: #21ACD7; border-radius: 5px;margin-left: auto;display: none; text-align: center; "> </div> <div style="margin-top: 10px; background-color:transparent;padding-bottom: 30px;"> <form action="#" method="post" class="action_form" operation="update" style="width:100%;" > <table style="width:100%;"> <tr> <td class="field_name"> <font>ITEM NAME</font> </td> <td class="field"> <div class="parent"> <input type="text" id="item_name" required disabled="disabled" /> </div> </td> </tr> <tr> <td class="field_name"> <font>IN STOCK COUNT</font> </td> <td class="field"> <div class="parent"> <input type="number" step="0.001" id="in_stock_count" required disabled="disabled" /> </div> </td> </tr> <tr> <td class="field_name"> <font>MRP</font> </td> <td class="field"> <div style="padding: 0px 0px;"> <input type="number" step="0.01" id="mrp" required disabled="disabled" /> </div> </td> </tr> <tr> <td class="field_name"> <font>TAX CATEGORY</font> </td> <td class="field"> <div class="parent"> <select id="tax_category" required disabled="disabled" > <option value=""></option> <?php $tax_category = new tax_category(); $tax_categories = $tax_category->getTaxCategories(); foreach ($tax_categories as $tax_category) { echo '<option id="' . $tax_category->id . '" value="' . $tax_category->tax_percentage . '">' . $tax_category->tax_category_name . '</option>'; } ?> </select> </div> </td> </tr> <tr></tr> <tr> <td></td> <td> <div style="padding: 0px 12px;"> <div style="width: 100%; margin-left: -12px; padding: 12px; background-color: #0d92bb; border-radius: 5px; float: left;"> <div style="width: 50%; float: right; "> <input style="width: 100%;" disabled="disabled" type="submit" value="UPDATE" /> </div> <div style="width: 50%;"> <input style="width: 100%;" disabled="disabled" type="reset" value="CANCEL" /> </div> </div> </div> </td> </tr> </table> </form> </div> <script type="text/javascript"> function setFormActionListener(){ $('form.action_form').on('submit', function(e) { e.preventDefault(); var id = 25; var operation = $(this).attr('operation'); if (operation == 'update') { var inventry_id = $('form.action_form').attr('inventry_id'); var data = { form_id: id, inventry_id: inventry_id, in_stock_count: $('form input#in_stock_count').val(), mrp: $('form input#mrp').val(), tax_category_id: $('form select#tax_category').find('option:selected').attr('id') } update_form_data(data, function(message) { get_form(20, function(html, tools) { $('div#form-body').html(html); $('div#content-body-action-tools').html(tools); }, function(message) { $('font#section_heading').empty(); alert(message); }); alert(message); }, function(message) { alert(message); }); } else { alert("Invalid Operation " + id + ' - ' + operation); } }); }; setFormActionListener(); </script> <?php $form = ob_get_clean(); return $form; }
function get_form_html($form_id, $id) { ob_start(); ?> <div id="head_div" style="height: 150px; width: 320px; background-color: #ECECEC; border-radius: 5px;margin-left: auto;display: none; "> </div> <div style="margin-top: 10px; background-color:transparent;padding-bottom: 30px;"> <style> div#purchace_items td{ border: 1px solid #21ACD7; } div#purchace_items tbody td{ padding: 5px 0 5px 5px; } div#purchace_items tbody td input,div#purchace_items tbody td select{ padding: 0; border: 0; margin: 0; height: 100%; width: 100%; background-color: transparent; } </style> <div id="purchace_items" style="width: 100%; padding: 10px 0; color: #21ACD7;"> <table id="items_table" style="border-collapse: collapse; width: 100%; background-color: #fff; border-radius: 10px; color: #21ACD7;"> <thead style="text-align: center;"> <tr status="not_selected"> <td> # </td> <td> ID </td> <td> TAX CATEGORY NAME </td> <td style=""> TAX(%) </td> </tr> </thead> <tbody style="padding-left: 3px; text-align: center; "> <?php $tax_category = new tax_category(); $tax_categories = $tax_category->getTaxCategories(); $i = 0; if (is_array($tax_categories) and count($tax_categories)) { foreach ($tax_categories as $tax_category) { ?> <tr id="<?php echo $tax_category->id; ?> " onclick="select_row(this)"> <td style="text-align: center;"><?php echo ++$i; ?> </td> <td id="tax_category_id"><?php echo 'TAX-' . $tax_category->id; ?> </td> <td id="tax_category_name"><?php echo $tax_category->tax_category_name; ?> </td> <td id="tax_category_value"><?php echo $tax_category->tax_percentage; ?> </td> </tr> <?php } } else { echo '<tr><td colspan="8"> No Tax Category Found </td></tr>'; } ?> </tbody> </table> </div> </div> <script type="text/javascript"> function select_row(row) { var j_row = $(row); if(j_row.attr('status') == 'selected'){ $('table#items_table tr').attr('status', 'not_selected'); $('table#items_table tr').css('background-color', '#FFF'); $('img#edit').css('display', 'none'); $('img#edit_fade').css('display', 'block'); $('img#delete').css('display', 'none'); $('img#delete_fade').css('display', 'block'); }else{ $('table#items_table tr').attr('status', 'not_selected'); $('table#items_table tr').css('background-color', '#FFF'); j_row.attr('status', 'selected'); j_row.css('background-color', '#C0EFFD'); $('img#edit').css('display', 'block'); $('img#edit_fade').css('display', 'none'); $('img#delete').css('display', 'block'); $('img#delete_fade').css('display', 'none'); } } function on_edit_clicked(){ var selected_row = $('tr[status="selected"]'); var id = selected_row.attr('id'); get_form(42, ///tax category create form function (html, tools){ $('div#form-body').html(html); $('div#content-body-action-tools').html(tools); var form = $('div#form-body').find('form.action_form'); form.attr('operation', 'update'); form.attr('tax_category_id', id); form.find('input[type=submit]').val('UPDATE'); $('div#head_div').html('ID : TAX CATEGORY - '+id); $('div#head_div').css('display', 'block'); }, function (message){ $('font#section_heading').empty(); $('div#form-body').empty(); alert(message); }, id ); } function on_add_clicked(){ get_form(42, ///tax category create form function (html, tools){ $('div#form-body').html(html); $('div#content-body-action-tools').html(tools); }, function (message){ $('font#section_heading').empty(); $('div#form-body').empty(); alert(message); } ); } function on_delete_clicked(){ var selected_row = $('tr[status="selected"]'); var id = selected_row.attr('id'); if(confirm('Are you sure you want to delete TAX-'+id+' ?' )){ var data = { form_id : 41, tax_category_id : id } delete_form_data(data, function(message) { get_form(41, function(html, tools) { $('div#form-body').html(html); $('div#content-body-action-tools').html(tools); }, function(message) { $('font#section_heading').empty(); $('div#form-body').empty(); alert(message); }); alert(message); }, function(message) { alert(message); }); } } </script> <?php $form = ob_get_clean(); return $form; }