Jump to content

budimir

Members
  • Content Count

    522
  • Joined

  • Last visited

Everything posted by budimir

  1. Hey Barand! Thank you very much! That's it, exactly what I wanted!
  2. I'm trying to build a tree to display product groups, but I can't achieve what I want. There is a hierarchy for the tree which I need to follow: 1H 1HS 1HSMP I want to list all the categories (1H) with its subcategories(1HS), and it's subcategories (1HSMP). This is the code I'm currently using: <ul> <?php //Here we fetch category $categories_list = array(); if($stmt = $conn -> prepare("SELECT a.category, a.subcategory, a.subcategory1, a.category_description, a.subcategory_description, a.subcategory_description1, SUM(nsq.sales_amount) AS sales, SUM(nsq.sales_amount+nsq.cost_amount) AS RUC FROM dpb.articles a LEFT JOIN dpb.nav_sales_qty nsq ON nsq.article_no = a.article_no WHERE nsq.entry_type_desc = 'Prodaja' GROUP BY a.subcategory1")) { $stmt -> execute(); $stmt -> store_result(); $stmt -> bind_result($category, $subcategory, $subcategory1, $category_description, $subcategory_description, $subcategory_description1, $total_sales, $total_profit); while($stmt -> fetch()) { $categories_list[] = array('category' => $category, 'subcategory' => $subcategory, 'subcategory1' => $subcategory1, 'category_description' => $category_description, 'subcategory_description' => $subcategory_description, 'subcategory_description1' => $subcategory_description1, 'total_profit' => $total_profit, 'total_sales' => $total_sales); } $stmt -> close(); } foreach($categories_list as $key => $value) { ?> <li><?php echo $value['category'].' - '.$value['category_description']; ?> <ul> <?php //Here we filter subcategory if(strpos($value['subcategory'], $value['category']) === 0) { //Iterate over subcategory foreach ($value as $key2 => $value2) { debugVar($value2); ?> <li data-jstree='{"opened":true}'><?php echo $value2['subcategory'] . ' - ' . $value2['subcategory_description']; ?> <ul> <?php //Here we filter subcategory2 if (strpos($value['subcategory1'], $value['subcategory']) !== false) { ?> <li data-jstree='{"type":"file"}'> <?php echo $value['subcategory1']; ?> </li> <?php //Here we close subcategory1 if statement } ?> </ul> </li> <?php //Here we close subcategory if statement } } ?> </ul> </li> <?php //Close foreach loop } ?> </ul> The result I'm getting is attached in the photo, and it's not what I want! The result I need is the following: I find a category (1H), and then I find all of its subcategories which are 1H% (all that start with 1H) and display them bellow 1H. Then I iterate over all of these subcategories (example 1HS%, 1HP%, 1HRD%) and I find all of their subcategories which are starting with (1HS, 1HP, 1HRD) and display them. Example: 1H 1HS 1HSMP 1HSTR 1HSKT 1HP 1HPSD 1HPDD 1HPSA 1HRD 1HRDA 1HRDBV 1HRDTE 1HRDEF Can you please help me how to achieve that? I spent a lot of time, and I can't get the proper result.
  3. Thanks everyone for the help! @cloetensbrecht, Your answer pushed me to right direction. I had to change the conditions a bit, but it was your answer that gave me the idea. Thank you so much! I spent four days trying to figure it out! This is code that gives proper result: foreach ($cost_array as $key1 => $value1) { // group 1, group 2 and group 3 are empty and should stay => continue the foreach loop if (empty($value1['group1']) && empty($value1['group2']) && empty($value1['group3'])) continue; //When all three exist and are same it should continue if (!empty($form_group3) && $value1['group3'] == $form_group3 && !empty($form_group2) && $value1['group2'] == $form_group2 && !empty($form_group1) && $value1['group1'] == $form_group1) continue; if ($value1['group3'] != $form_group3 && !empty($form_group2) && $value1['group2'] == $form_group2 && !empty($form_group1) && $value1['group1'] == $form_group1) continue; if (!empty($form_group2) && $value1['group2'] == $form_group2 && !empty($form_group1) && $value1['group1'] == $form_group1) continue; if (!empty($form_group3) && !empty($form_group2) && !empty($form_group1) && $value1['group1'] == $form_group1) continue; //This covers situation where we have category and subcategory that match if (!empty($form_group2) && $value1['group2'] == $form_group2 && !empty($form_group1) && $value1['group1'] == $form_group1) continue; //This covers all situations where we have success only on category but nothing else if (!empty($form_group1) && $value1['group1'] == $form_group1 && empty($value1['group2']) && empty($value1['group3'])) continue; // otherwise unset the value unset($cost_array[$key1]); } I still need to catch one of the conditions, but that's what does the job. I'm sure it can be written in more elegant way. If there is any suggestions how to do it more elegant I would appreciate it.
  4. I'm trying to unset one record from array but I can't manage it, so I'm asking for someone to help me. Logic I'm trying to achieve is: User has an item with possible three categories, he posts a form and than I iterate over array and try to see if category3 matches, if not I go to category2, if not I go to category1. If I find one of the categories that matches array and category asked in form I proceed , but If I don't find any of the categories I unset that record in array.Below you will see an example what I've done now. I can't get the proper result. Either I unset all the records or unset the record that should stay. I'm trying different conditions for last three days without success. Record I'm talking about is with a key 5. This is my array: array (size=5) 0 => array (size=9) 'cost_no' => string 'D01' (length=3) 'cost_name' => string 'Carina' (length=6) 'cost_type' => string 'Customs' (length=7) 'cost_measure' => string 'Percent' (length=7) 'cost_amount' => string '5.00' (length=4) 'cost_id' => int 7 'group1' => string '' (length=3) 'group2' => string '' (length=3) 'group3' => string '' (length=3) 1 => array (size=9) 'cost_no' => string 'D02' (length=3) 'cost_name' => string 'Banka' (length=5) 'cost_type' => string 'Bank' (length=4) 'cost_measure' => string 'Percent' (length=7) 'cost_amount' => string '0.15' (length=4) 'cost_id' => int 8 'group1' => string '' (length=3) 'group2' => string '' (length=3) 'group3' => string '' (length=3) 2 => array (size=9) 'cost_no' => string 'D03' (length=3) 'cost_name' => string 'Špediter' (length=9) 'cost_type' => string 'Transport' (length=9) 'cost_measure' => string 'Percent' (length=7) 'cost_amount' => string '0.50' (length=4) 'cost_id' => int 9 'group1' => string '' (length=3) 'group2' => string '' (length=3) 'group3' => string '' (length=3) 3 => array (size=9) 'cost_no' => string 'D04' (length=3) 'cost_name' => string 'Troškovi firme' (length=15) 'cost_type' => string 'Tax' (length=3) 'cost_measure' => string 'Percent' (length=7) 'cost_amount' => string '21.00' (length=5) 'cost_id' => int 10 'group1' => string '' (length=3) 'group2' => string '' (length=3) 'group3' => string '' (length=3) 5 => array (size=9) 'cost_no' => string 'C1' (length=2) 'cost_name' => string 'Cost only for this group' (length=24) 'cost_type' => string 'Warehouse' (length=9) 'cost_measure' => string 'Percent' (length=7) 'cost_amount' => string '12.00' (length=5) 'cost_id' => int 12 'group1' => string 'ACC_P' (length=5) 'group2' => string '1401' (length=4) 'group3' => string '' (length=3) This is foreach and condition I tried to use to unset if non of the categories match ( it has to check from category3 to category 1). foreach ($cost_array as $key1 => $value1) { if (isset($form_group3) AND isset($value1['group3']) AND $value1['group3'] != $form_group3) { if (isset($form_group2) AND isset($value1['group2']) AND $value1['group2'] != $form_group2) { if (isset($form_group1) AND isset($value1['group1']) AND $value1['group1'] != $form_group1) { } else { unset($cost_array[$key1]); } } else { unset($cost_array[$key1]); } } else { unset($cost_array[$key1]); } } Groups user posts from form: $form_group1 = mysqli_real_escape_string($conn_mysqli, $_POST['group1']); $form_group2 = mysqli_real_escape_string($conn_mysqli, $_POST['group2']); $form_group3 = mysqli_real_escape_string($conn_mysqli, $_POST['group3']); The result I need to achieve is that all records where empty group3,group2,group1 have to stay and the one which has records in group3, group2 or group1 has to stay only if they match what user asks. So if form_group3 is same is array_group3, form_group2 is same as array_group2, form_group1 is same as array_group1 that record stays otherwise only that one is unset.
  5. Thank you for the help. I found a problem. Thank you very much.
  6. Hey Guru, Thanks for you're suggestion. This is error I get: Fatal error: Uncaught exception 'mysqli_sql_exception' with message 'Commands out of sync; you can't run this command now' in C:\wamp\www\pma\calculation\custom_based_method.php on line 159 What does that mean and how to trace it?
  7. Can someone explain why prepared statement in example below is failing while mysqli_query is working without any problem with exactly same set of data? I tried everything I could figure out and can't see the reason why it is happening. //Now we get costs in% and absolute $number = 0; $numberText = ""; $numberName = ""; $total_costs = 0; $total_costs_abs = 0; foreach($cost_array as $key => $value){ //Here we select only costs with % so we could calculate percentage if(strcmp($value["cost_measure"],"Percent") === 0){ //$number .= getPercentOfNumber($local,$value["cost_amount"])."<br>"; $number = getPercentOfNumber($local,$value["cost_amount"]); //$numberText.= $value["cost_amount"]." %<br>"; $numberText = $value["cost_amount"]; //$numberName .= "cost_name ".$value["cost_name"]."<br>"; $numberName = $value["cost_name"]; //Total value of all percentage costs $total_costs += $number; //Insert calculated costs in DB //Not working if ($stmt = $conn_mysqli -> prepare("INSERT INTO calculations_cost (calculation_id, costs_id, user_id, cost_time, original_number, cost_amount, cost_measure, calculated_cost, cost_name) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)")) { $stmt -> bind_param("iiissssss", $calculation_id, $costs_id, $user_id, $create_time, $local, $numberText, $measure, $number, $numberName); $stmt -> execute(); $stmt -> close(); } //Working $sql = "INSERT INTO calculations_cost (calculation_id, costs_id, user_id, cost_time, original_number, cost_amount, cost_measure, calculated_cost, cost_name) VALUES ('$calculation_id', '$costs_id', '$user_id', '$create_time', '$local', '$numberText', '".$value['cost_measure']."', '$number', '$numberName')"; mysqli_query($mysqli,$sql) or die (mysqli_error($mysqli)); echo $sql."<br>"; //echo "Total costs: $total_costs<br>"; } }
  8. Thank you Psycho! You're code helped me to find my problem and get the value.
  9. I have tried that, but I can't get the value of select box.
  10. Hi, I have a radio button which, when clicked, is opening select. I would like to store the value of a radio and select into two separate cookies. This is my code I'm using, but I can't get second on change event to fire and get the value of select. I do get value of radio and store in cookie, but when trying to get value from select I get null. Can you, please help me and tell me what I'm doing wrong? Html code: <div class="row"> <div class="col-md-6"> <div class="radio clip-radio radio-primary"> <input type="radio" id="radio3" name="vertical" value="Pricelist" /> <label for="radio3"> Pricelist </label> </div> <div id="Pricelist" class="desc"> <div class="form-group"> <select class="cs-select cs-skin-elastic" name="pricelist" id="pricelist_select"> <option value="" disabled selected>Select pricelist</option> <option value="1">1</option> <option value="2">2</option> </select> </div> </div> jQuery //Displaying select box when type radio button is clicked $(document).ready(function() { $("input[name=vertical]").on( "change", function() { var test = $(this).val(); $(".desc").hide(); $("#"+test).show(); $("#pricelist_select").val(); $('#pricelist_select').trigger("change"); alert($("#pricelist_select").find(":selected").val()); $.cookie('pricelist_select', $("#pricelist_select").val()); } ); }); CSS .desc { display: none; }
  11. For some reason I can't get it to work. Could you give me an example how to get cookie value and display it to see the value?
  12. I'm using PHP to view cookie value, but obivously it's not working properly. <?php echo "$COOKIE['calc']"; ?> What javascript code would be to see cookie value in real time (without refreshing page)?
  13. Oh, OK. Now I can see that cookie immediatly gets new value, but the page is not displaying it when I go to second step. What do I need to do to get the value at the same moment when I get to second step?
  14. Yes, I can see it. It is created. It doesn't say any time when is created, but I can see it is created when radio is selected.
  15. Yes, I can see value which is displaying. For example I select Cost and click to go to second step and there I can see it's displaying Cost, but when I go back to first step and select Customer and again go to second step the value didn't change from Cost. Strange thing is that I need to hit F5 and refresh browser exactly two times for new selection to work. I mean I hit F5 twice then make a new selection go to step two and I can see my new selection. Same thing is hapening all the time? Do you have any idea why I need to refresh two times so I could get my new value?
  16. Hi everyone, I'm strugling with javascript and updating cookie value, so I would like to ask for some help. I'm using bootstrap wizard and offer user some options to select. I would like to store that choice into cookie, but the problem I'm runing into is when user clicks on Cost and clicks Next on second step and then he decides to go back and make antoher choice and he chooses Custom, cookie is not updated with new value. I have to refresh page for couple of times before cookie changes it's value. Below is my code I'm using to update and remove cookie so please help me and clarify me why cookie is not updated without refreshing screen for couple of times??? <script type='text/javascript'> $('input:radio').on('change', function() { if ($(this).val() === "Cost") { $.cookie('calc', 'Cost') } else { $.removeCookie('calc', { path: '/' }); } if ($(this).val() === "Competition") { $.cookie('calc', 'Competition') } else { $.removeCookie('calc', { path: '/' }); } if ($(this).val() === "Customer") { $.cookie('calc', 'Customer') } else { $.removeCookie('calc', { path: '/' }); } if ($(this).val() === "Custom") { $.cookie('calc', 'Custom') } else { $.removeCookie('calc', { path: '/' }); } }); </script>
  17. Ok, I managed to figure out that this part of code is blocking it: CKEDITOR.instances."editor2".on('blur', function(){CKEDITOR.instances."editor2".updateElement();}); It is used for updating textarea on input and before submiting form. Why is it blocking validation?
  18. I need you're help with jquery form validation. I have been using jguery form validation but when I have included ckeditor on the page validation stopped working. I can't figure out why. I'm not very good with javascript so it's hard for me to figure out what is blocking it. Html form I'm using is: <form action="save_costs.php" method="POST" role="form" id="form2"> <div class="row"> <div class="col-md-12"> <div class="errorHandler alert alert-danger no-display"> <i class="fa fa-times-sign"></i> You have some form errors. Please check below. </div> <div class="successHandler alert alert-success no-display"> <i class="fa fa-ok"></i> Your form validation is successful! </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="control-label"> <?php if ($_SESSION['language'] == "English") { echo "Name"; } else if ($_SESSION['language'] == "Croatian") { echo "Naziv"; } ?> <span class="symbol required"></span> </label> <input type="text" placeholder="Insert name" class="form-control" id="name" name="name" /> </div> <div class="form-group"> <label class="control-label"> <?php if ($_SESSION['language'] == "English") { echo "Description"; } else if ($_SESSION['language'] == "Croatian") { echo "Opis"; } ?> <span class="symbol required"></span> </label> <input type="text" placeholder="Insert description" class="form-control" id="description" name="description" /> </div> </div> <div class="col-md-6"> <div class="row"> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="form-group"> <label class="control-label"> <?php if ($_SESSION['language'] == "English") { echo "Comments"; } else if ($_SESSION['language'] == "Croatian") { echo "Komentari"; } ?> </label> <textarea class="ckeditor form-control" id="editor2" name="comment" cols="10" rows="10"></textarea> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div> <span class="symbol required"></span><?php if ($_SESSION['language'] == "English") { echo "Required Fields"; } else if ($_SESSION['language'] == "Croatian") { echo "Obavezna polja"; } ?> <hr /> </div> </div> </div> <div class="row"> <div class="col-md-8"> </div> <div class="col-md-4"> <button class="btn btn-primary btn-wide pull-right" type="submit"> <?php if ($_SESSION['language'] == "English") { echo "Submit"; } else if ($_SESSION['language'] == "Croatian") { echo "Spremi"; } ?> <i class="fa fa-arrow-circle-right"></i> </button> </div> </div> </form> Javascript file is attached. This is how I initalise form validation and CKeditor. <script src="../vendor/jquery/jquery.min.js"></script> <script src="../vendor/jquery-validation/jquery.validate.min.js"></script> <script src="../vendor/ckeditor/ckeditor.js"></script> <script src="../vendor/ckeditor/adapters/jquery.js"></script> <script src="../items/js/article_validation.js"></script> <script> <script> jQuery(document).ready(function() { Main.init(); FormValidator.init(); CKEDITOR.instances."editor2".on('blur', function(){CKEDITOR.instances."editor2".updateElement();}); }); </script> Can you, please, help me? I tried everything I thought it could block it. I don't know what to do anymore.
  19. Hey people I need some help with form validation. I have done validation, but for some reason it takes a long time to process a form and then run script to store data in DB. I have check and traced problem to javascript that I'm using (it's not PHP that is causing the problem). I can't understand what is taking it to load so long. At one point my browser goes to Not responding and then after a minute it process a form. This is how I validate user input: <form action="save_article.php" method="POST" role="form" id="form2"> <div class="row"> <div class="col-md-12"> <div class="errorHandler alert alert-danger no-display"> <i class="fa fa-times-sign"></i> You have some form errors. Please check below. </div> <div class="successHandler alert alert-success no-display"> <i class="fa fa-ok"></i> Your form validation is successful! </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="control-label"> SKU <span class="symbol required"></span> </label> <input type="text" placeholder="Insert SKU" class="form-control" id="sku" name="sku" /> </div> <div class="form-group"> <label class="control-label"> Last Name <span class="symbol required"></span> </label> <input type="text" placeholder="Insert your Last Name" class="form-control" id="lastname2" name="lastname2"> </div> And javascript validation is: var FormValidator = function () { "use strict"; var validateCheckRadio = function (val) { $("input[type='radio'], input[type='checkbox']").on('ifChecked', function(event) { $(this).parent().closest(".has-error").removeClass("has-error").addClass("has-success").find(".help-block").hide().end().find('.symbol').addClass('ok'); }); }; // function to initiate Validation Sample 1 var runValidator1 = function () { var form1 = $('#form'); var errorHandler1 = $('.errorHandler', form1); var successHandler1 = $('.successHandler', form1); $.validator.addMethod("FullDate", function () { //if all values are selected if ($("#dd").val() != "" && $("#mm").val() != "" && $("#yyyy").val() != "") { return true; } else { return false; } }, 'Please select a day, month, and year'); $('#form').validate({ errorElement: "span", // contain the error msg in a span tag errorClass: 'help-block', errorPlacement: function (error, element) { // render error placement for each input type if (element.attr("type") == "radio" || element.attr("type") == "checkbox") { // for chosen elements, need to insert the error after the chosen container error.insertAfter($(element).closest('.form-group').children('div').children().last()); } else if (element.attr("name") == "dd" || element.attr("name") == "mm" || element.attr("name") == "yyyy") { error.insertAfter($(element).closest('.form-group').children('div')); } else { error.insertAfter(element); // for other inputs, just perform default behavior } }, ignore: "", rules: { firstname: { minlength: 2, required: true }, lastname: { minlength: 2, required: true }, email: { required: true, email: true }, password: { minlength: 6, required: true }, password_again: { required: true, minlength: 5, equalTo: "#password" }, yyyy: "FullDate", gender: { required: true }, zipcode: { required: true, number: true, minlength: 5 }, city: { required: true }, newsletter: { required: true } }, messages: { firstname: "Please specify your first name", lastname: "Please specify your last name", email: { required: "We need your email address to contact you", email: "Your email address must be in the format of name@domain.com" }, gender: "Please check a gender!" }, groups: { DateofBirth: "dd mm yyyy", }, invalidHandler: function (event, validator) { //display error alert on form submit successHandler1.hide(); errorHandler1.show(); }, highlight: function (element) { $(element).closest('.help-block').removeClass('valid'); // display OK icon $(element).closest('.form-group').removeClass('has-success').addClass('has-error').find('.symbol').removeClass('ok').addClass('required'); // add the Bootstrap error class to the control group }, unhighlight: function (element) { // revert the change done by hightlight $(element).closest('.form-group').removeClass('has-error'); // set error class to the control group }, success: function (label, element) { label.addClass('help-block valid'); // mark the current input as valid and display OK icon $(element).closest('.form-group').removeClass('has-error').addClass('has-success').find('.symbol').removeClass('required').addClass('ok'); }, submitHandler: function (form) { successHandler1.show(); errorHandler1.hide(); // submit form //$('#form').submit(); } }); }; // function to initiate Validation Sample 2 var runValidator2 = function () { var form2 = $('#form2'); var errorHandler2 = $('.errorHandler', form2); var successHandler2 = $('.successHandler', form2); $.validator.addMethod("getEditorValue", function () { $("#editor1").val($('#form2 .summernote').code()); if ($("#editor1").val() != "" && $("#editor1").val().replace(/(<([^>]+)>)/ig, "") != "") { $('#editor1').val(''); return true; } else { return false; } }, 'This field is required.'); form2.validate({ errorElement: "span", // contain the error msg in a small tag errorClass: 'help-block', errorPlacement: function (error, element) { // render error placement for each input type if (element.attr("type") == "radio" || element.attr("type") == "checkbox") { // for chosen elements, need to insert the error after the chosen container error.insertAfter($(element).closest('.form-group').children('div').children().last()); } else if (element.hasClass("ckeditor")) { error.appendTo($(element).closest('.form-group')); } else { error.insertAfter(element); // for other inputs, just perform default behavior } }, ignore: "", rules: { sku: { minlength: 2, required: true }, lastname2: { minlength: 2, required: true }, email2: { required: true, email: true }, occupation: { required: true }, dropdown: { required: true }, services: { required: true, minlength: 2 }, creditcard: { required: true, creditcard: true }, url: { required: true, url: true }, zipcode2: { required: true, number: true, minlength: 5 }, city2: { required: true }, editor1: "getEditorValue", editor2: { required: true } }, messages: { firstname: "Please specify your first name", lastname: "Please specify your last name", email: { required: "We need your email address to contact you", email: "Your email address must be in the format of name@domain.com" }, services: { minlength: jQuery.validator.format("Please select at least {0} types of Service") } }, invalidHandler: function (event, validator) { //display error alert on form submit successHandler2.hide(); errorHandler2.show(); }, highlight: function (element) { $(element).closest('.help-block').removeClass('valid'); // display OK icon $(element).closest('.form-group').removeClass('has-success').addClass('has-error').find('.symbol').removeClass('ok').addClass('required'); // add the Bootstrap error class to the control group }, unhighlight: function (element) { // revert the change done by hightlight $(element).closest('.form-group').removeClass('has-error'); // set error class to the control group }, success: function (label, element) { label.addClass('help-block valid'); // mark the current input as valid and display OK icon $(element).closest('.form-group').removeClass('has-error').addClass('has-success').find('.symbol').removeClass('required').addClass('ok'); }, submitHandler: function (form) { successHandler2.show(); errorHandler2.hide(); // submit form $('#form2').submit(); } }); CKEDITOR.disableAutoInline = true; $('textarea.ckeditor').ckeditor(); }; return { //main function to initiate template pages init: function () { validateCheckRadio(); runValidator1(); runValidator2(); } }; }();
  20. Found a problem. It was nulls allowed and it should be 0 in all records.
  21. iznos_fakture (DECIMAL (10,2)) is amount of invoice to be payed iznos_placanja (DECIMAL (10,2)) is amount payed for that invoice MONTH(datum_placanja) is month when that invoice is due I would like to find all invoices in december that are not yet payed. I see in table that there are two invoices not payed. For some reason I can't display them. No errors. I'm getting empty result.
  22. Guys how can I make this query work SELECT SUM(iznos_fakture) as ukupno FROM fakture_placanja WHERE iznos_placanja != iznos_fakture AND MONTH(datum_dospijeca) = '12' I need to find where iznos_placanja is different from iznos_fakture. They are two columns in same DB? Any ideas?
  23. Barand, As always first on my posts and most willing to help. Thanks for you're reply Barand! I have managed to figure out my problem while I was waiting for help. You are right, my rows are getting duplicate because of joins, so I have reworked the query and now it's working and it looks like this. SELECT ABS(SUM(quantity)) as zbroj, a.kataloski_broj, a.id, a.entry_type_desc, a.posting_date, a.item_category, a.product_group FROM prodaja_zaliha a LEFT JOIN (SELECT kataloski_broj, nabavna_cijena, neto_VPC, preporucena_VPC FROM kalkulacija_stavke GROUP BY kataloski_broj) AS b ON a.kataloski_broj = b.kataloski_broj LEFT JOIN (SELECT kataloski_broj, nabavna_cijena, VPC FROM kalkulacija_stavke_rabat GROUP BY kataloski_broj) AS c ON a.kataloski_broj = c.kataloski_broj LEFT JOIN(SELECT kataloski_broj_NAV, VPC, PVPC FROM katalog_pribora_item GROUP BY kataloski_broj_NAV) AS d ON a.kataloski_broj = d.kataloski_broj_NAV WHERE a.kataloski_broj = 'M1200' AND a.entry_type_desc = 'Prodaja' AND YEAR(a.posting_date) = '2015' I need to style it a bit, but it's finally giving correct result. Barand, thank you for reply!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.