function get_form_html($form_id, $id) { ob_start(); ?> <div id="head_div" style="padding: 5px 0; background-color: #ECECEC; color: #21ACD7; border-radius: 5px;margin-left: auto; text-align: center; "> <?php $user = new user(); $user->id = $_SESSION['user_id']; $user->getUser(); $company = new company(); $company->id = $user->company_id; $company->getCompany(); echo "STOCK REPORT OF {$company->company_name} - {$company->company_code}"; ?> </div> <div style="margin-top: 10px; background-color:transparent;padding-bottom: 30px;"> <style> div#purchace_items td,div#purchace_items th{ 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> <input type="text" id="search" placeholder="Enter Search Key here..." style="width: 100%; margin-left: 0px;" onkeyup="search()" /> <style> img#search{ position: relative; height: 20px; width: 20px; float: right; top: -29px; right: 10px; } </style> <img id="search" src="../ui/images/search.png" onclick="search()" /> <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"> <th> # </th> <th> ITEM </th> <th> STOCK COUNT </th> <th style=""> SELLING PRIZE </th> <th style=""> TAX </th> </tr> </thead> <tbody style="padding-left: 3px; text-align: center; "> <?php $inventry = new inventry(); $inventries = $inventry->getInventryForSpecificCompany($user->company_id); $i = 0; if ($inventries == NULL || sizeof($inventries) == 0) { echo '<tr><td colspan="8"> No Stock Found </td></tr>'; } else { foreach ($inventries as $inventry) { ?> <tr id="<?php echo $inventry->id; ?> " onclick="select_row(this)" status="not_selected"> <td style="text-align: center;"> <?php echo ++$i; ?> </td> <td id="item_name"><?php $item = new item(); $item->id = $inventry->item_id; $item->getItem(); echo $item->item_name . ' (' . $item->item_code . ')'; ?> </td> <td id="in_stock_count"><?php echo number_format($inventry->in_stock_count, 3, '.', ''); ?> </td> <td id="mrp"><?php echo number_format($inventry->selling_prize, 2, '.', ''); ?> </td> <td id="tax_category" tax_category_id="<?php echo $inventry->tax_category_id; ?> "><?php $tax = new tax_category(); $tax->id = $inventry->tax_category_id; $tax->getTaxCategory(); echo $tax->tax_category_name; ?> </td> </tr> <?php } } ?> </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 item_name = selected_row.find('td#item_name').html(); var id = selected_row.attr('id'); var instock_count = selected_row.find('td#in_stock_count').html(); var mrp = selected_row.find('td#mrp').html(); var tax_category_id = selected_row.find('td#tax_category').attr('tax_category_id'); get_form(25, ///inventry edit 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('inventry_id', id); form.find('input#item_name').val(item_name); form.find('input#in_stock_count').val(instock_count); form.find('input#in_stock_count').prop('disabled', null); form.find('input#mrp').val(mrp); form.find('input#mrp').prop('disabled', null); form.find('select#tax_category').find('option#'+tax_category_id).prop('selected', true); form.find('select#tax_category').prop('disabled', null); form.find('input[type=submit]').val('UPDATE'); form.find('input[type=submit]').prop('disabled', null); form.find('input[type=reset]').prop('disabled', null); $('div#head_div').html('ID : INVENTRY-'+id); $('div#head_div').css('display', 'block'); }, 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 INVENTRY-'+id+' ?' )){ var data = { form_id : 20, inventry_id : id } delete_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(); $('div#form-body').empty(); alert(message); }); alert(message); }, function(message) { alert(message); }); } } function on_print_clicked() { //var date = $('input#date_field').val(); var d = new Date(); var date = d.getDate()+"/"+(parseInt(d.getMonth())+parseInt(1))+"/"+d.getFullYear(); $('div#print_container_header') .html('<font style="color:#21ACD7; font-size:20px; ">STOCK REPORT OF '+date+'</font>'); var html = $('div#purchace_items').html(); $('div#print_container_body').html(html); print(); $('div#print_container_header').empty(); $('div#print_container_body').empty(); $('div#print_container_footer').empty(); } function search(){ var search_key = $('input#search').val(); if(search_key !== ''){ console.log("search key "+ search_key); searchTable(search_key); }else{ $('#items_table tr').show(); } } function searchTable(inputVal) { var table = $('#items_table'); table.find('tr').each(function(index, row) { var allCells = $(row).find('td'); if(allCells.length > 0) { var found = false; allCells.each(function(index, td) { var regExp = new RegExp(inputVal, 'i'); if(regExp.test($(td).text())) { found = true; return false; } }); if(found == true)$(row).show();else $(row).hide(); } }); } </script> <?php $form = ob_get_clean(); return $form; }
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(); ?> <div id="head_div" style="padding: 5px 0; background-color: #ECECEC; color: #21ACD7; border-radius: 5px;margin-left: auto; text-align: center; "> <?php $user = new user(); $user->id = $_SESSION['user_id']; $user->getUser(); $company = new company(); $company->id = $user->company_id; $company->getCompany(); echo "STOCK REPORT OF {$company->company_name} - {$company->company_code}"; ?> </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 th{ border: 1px solid #21ACD7; } div#purchace_items tbody th{ 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> <input type="text" id="search" placeholder="Enter Search Key here..." style="width: 100%; margin-left: 0px;" onkeyup="search()" /> <style> img#search{ position: relative; height: 20px; width: 20px; float: right; top: -29px; right: 10px; } </style> <img id="search" src="../ui/images/search.png" onclick="search()" /> <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> <th> # </th> <th> ITEM </th> <th> STOCK COUNT </th> <th style=""> SELLING PRIZE </th> <th style=""> TAX </th> </tr> </thead> <tbody style="padding-left: 3px; text-align: center; "> <?php $inventry = new inventry(); $inventries = $inventry->getInventryForSpecificCompany($user->company_id); $i = 0; if ($inventries == NULL || sizeof($inventries) == 0) { echo '<tr><td colspan="8"> No Stock Found </td></tr>'; } else { foreach ($inventries as $inventry) { ?> <tr id="<?php echo $inventry->id; ?> " > <td style="text-align: center;"> <?php echo ++$i; ?> </td> <td> <?php $item = new item(); $item->id = $inventry->item_id; $item->getItem(); echo $item->item_name . ' - ' . $item->item_code; ?> </td> <td> <?php echo number_format($inventry->in_stock_count, 3, '.', ''); ?> </td> <td> <?php echo number_format($inventry->selling_prize, 2, '.', ''); ?> </td> <td> <?php $tax = new tax_category(); $tax->id = $inventry->tax_category_id; $tax->getTaxCategory(); echo $tax->tax_category_name; ?> </td> </tr> <?php } } ?> </tbody> </table> </div> </div> <script type="text/javascript"> function search(){ var search_key = $('input#search').val(); if(search_key !== ''){ console.log("search key "+ search_key); searchTable(search_key); }else{ $('#items_table tr').show(); } } function searchTable(inputVal) { var table = $('#items_table'); table.find('tr').each(function(index, row) { var allCells = $(row).find('td'); if(allCells.length > 0) { var found = false; allCells.each(function(index, td) { var regExp = new RegExp(inputVal, 'i'); if(regExp.test($(td).text())) { found = true; return false; } }); if(found == true)$(row).show();else $(row).hide(); } }); } </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> NAME </td> <td style=""> USER NAME </td> <td style=""> SHOP </td> <td style=""> TYPE </td> </tr> </thead> <tbody style="padding-left: 3px; text-align: center; "> <?php $user = new user(); $users = $user->getUsers(); $i = 0; if (is_array($users) and count($users) != 0) { $first_admin = true; $first_owner = true; foreach ($users as $user) { ?> <tr id="<?php echo $user->id; ?> " <?php if ($user->user_type_id == 4 and $first_admin) { $first_admin = false; } else { if ($user->user_type_id == 5 and $first_owner) { $first_owner = false; } else { echo ' onclick="select_row(this)"'; } } ?> > <td style="text-align: center;"><?php echo ++$i; ?> </td> <td id="user_id"><?php echo 'USER-' . $user->id; ?> </td> <td id="name"><?php echo $user->name; ?> </td> <td id="user_name"><?php echo $user->user_name; ?> </td> <?php if ($user->user_type_id == 4) { echo '<td>NA</td>'; } else { if ($user->user_type_id == 5) { echo '<td>NA</td>'; } else { ?> <td id="company_id" value="<?php echo $user->company_id; ?> "><?php $company = new company(); $company->id = $user->company_id; $company->getCompany(); echo $company->company_name . ' - ' . $company->company_code; ?> </td> <?php } } ?> <td id="user_type_id" value="<?php echo $user->user_type_id; ?> "><?php $user_type = new user_type(); $user_type->id = $user->user_type_id; $user_type->getUserType(); echo $user_type->user_type_name; ?> </td> </tr> <?php } } else { echo '<tr><td colspan="8"> No User 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(29, ///user 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('user_id', id); form.find('input[type=submit]').val('UPDATE'); $('div#head_div').html('ID : SHOP - '+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(29, ///user 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 USER-'+id+' ?' )){ var data = { form_id : 28, user_id : id } delete_form_data(data, function(message) { get_form(28, 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; }
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> <?php $companny = new company(); if ($id != 0) { $companny->id = $id; $companny->getCompany(); } ?> <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>SHOP NAME</font> </td> <td class="field"> <div class="parent"> <input value="<?php echo $companny->company_name; ?> " type="text" id="shop_name" required /> </div> </td> </tr> <tr> <td class="field_name"> <font>SHOP CODE </font> </td> <td class="field"> <div class="parent"> <input value="<?php echo $companny->company_code; ?> " type="text" id="shop_code" required /> </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 = 27; var operation = $(this).attr('operation'); if (operation == 'add') { var data = { form_id: id, shop_name: $('form input#shop_name').val(), shop_code: $('form input#shop_code').val() } add_form_data(data, function(message) { load_shops_list(); alert(message); }, function(message) { alert(message); }); } else if (operation == 'update') { var company_id = $('form.action_form').attr('company_id'); var data = { form_id: id, company_id: company_id, shop_name: $('form input#shop_name').val(), shop_code: $('form input#shop_code').val() } update_form_data(data, function(message) { load_shops_list(); alert(message); }, function(message) { alert(message); }); } else { alert("Invalid Operation " + id + ' - ' + operation); } }); }; setFormActionListener(); </script> <?php $form = ob_get_clean(); return $form; }