Subversion Repositories SmartDukaan

Rev

Rev 22551 | Rev 22592 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 22551 Rev 22581
Line 743... Line 743...
743
			error=true;
743
			error=true;
744
			$(this).addClass("border-highlight");
744
			$(this).addClass("border-highlight");
745
		}
745
		}
746
	});
746
	});
747
	
747
	
-
 
748
	// checking input discountAmount is not greater than maxDiscountAmount
-
 
749
	$("form#cd input.discountAmount").each(function(){
-
 
750
		var input = $(this).val().trim();
-
 
751
		var mop = $(this).attr("mop");
-
 
752
		var maxDiscountPrice = parseFloat($(this).attr("placeholder").substring(5));
-
 
753
		if(mop){
-
 
754
			$(this).removeClass("border-highlight");
-
 
755
			if (!input || parseFloat(input)<0 || isNaN(input)){
-
 
756
				alert("DiscountAmount value can not be lesser than 0 or invalid value");
-
 
757
				error=true;
-
 
758
				$(this).addClass("border-highlight");
-
 
759
			}
-
 
760
			if(parseFloat(input) > maxDiscountPrice){
-
 
761
				alert("DiscountAmount value can not be greater than the suggested maxDiscountPrice");
-
 
762
				error=true;
-
 
763
				$(this).addClass("border-highlight");
-
 
764
			}
-
 
765
		}
-
 
766
	});
-
 
767
	
748
	var amount = 0;
768
	var amount = 0;
749
	var netPayableAmount = parseFloat($("form#cd input.netPayableAmount").val());
769
	var netPayableAmount = parseFloat($("form#cd input.netPayableAmount").val());
750
	
770
	
751
	
771
	
752
	$("form#cd input.amount").each(function(){
772
	$("form#cd input.amount").each(function(){
Line 805... Line 825...
805
				tmp[itemId]  = serialNumbers;
825
				tmp[itemId]  = serialNumbers;
806
				orderObj['fofoLineItems'] = tmp;
826
				orderObj['fofoLineItems'] = tmp;
807
			}
827
			}
808
		});
828
		});
809
		console.log( JSON.stringify(orderObj));
829
		console.log( JSON.stringify(orderObj));
810
		$("form#cd input.unitPrice").each(function(){
830
		/*$("form#cd input.unitPrice").each(function(){
811
			var itemId = parseInt($(this).attr("itemId"));
831
			var itemId = parseInt($(this).attr("itemId"));
812
			var unitPrice = parseFloat($(this).val());
832
			var unitPrice = parseFloat($(this).val());
813
			var qty = parseInt($(this).attr("quantity"));
833
			var qty = parseInt($(this).attr("quantity"));
-
 
834
			var discountAmount = parseFloat($(this).val());
814
			var tmpObj = {'itemId':itemId,'sellingPrice':unitPrice,'quantity':qty};
835
			var tmpObj = {'itemId':itemId,'sellingPrice':unitPrice,'quantity':qty};
815
			if (orderObj['fofoLineItems'][itemId] === undefined){
836
			if (orderObj['fofoLineItems'][itemId] === undefined){
816
				tmpObj['serialNumberDetails'] =[];
837
				tmpObj['serialNumberDetails'] =[];
817
			}
838
			}
818
			else{
839
			else{
Line 827... Line 848...
827
				}
848
				}
828
			}
849
			}
829
			if(!found){
850
			if(!found){
830
				priceQtyArray.push(tmpObj);
851
				priceQtyArray.push(tmpObj);
831
			}
852
			}
832
		});
853
		});*/
833
		
854
		
-
 
855
		$("#order-details").find("tr:not(:first-child)").each(function(index, el){
-
 
856
			//console.log(el);
-
 
857
			//console.log(index);
-
 
858
			var $unitPriceElement = $(el).find('.unitPrice');
-
 
859
			var $discountAmountElement = $(el).find('.discountAmount');
-
 
860
			
-
 
861
			var itemId = parseInt($unitPriceElement.attr("itemId"));
-
 
862
			var unitPrice = parseFloat($unitPriceElement.val());
-
 
863
			var qty = parseInt($unitPriceElement.attr("quantity"));
-
 
864
			var discountAmount = parseFloat($discountAmountElement.val());
-
 
865
			var mop = $discountAmountElement.attr("mop");
-
 
866
			var tmpObj = {'itemId':itemId,'sellingPrice':unitPrice,'quantity':qty};
-
 
867
			tmpObj.discountAmount = discountAmount;
-
 
868
			
-
 
869
			if (orderObj['fofoLineItems'][itemId] === undefined){
-
 
870
				tmpObj['serialNumberDetails'] =[];
-
 
871
			}
-
 
872
			else{
-
 
873
				//tmpObj['serialNumbers'] = orderObj['fofoLineItems'][itemId];
-
 
874
				tmpObj['serialNumberDetails'] = [];
-
 
875
			}
-
 
876
			var found = false;
-
 
877
			for(var i = 0; i < priceQtyArray.length; i++){			
-
 
878
				if (priceQtyArray[i]["itemId"] == itemId){
-
 
879
					found = true;
-
 
880
					break;
-
 
881
				}
-
 
882
			}
-
 
883
			if(!found){
-
 
884
				priceQtyArray.push(tmpObj);
-
 
885
			}
-
 
886
		});
834
		
887
		
835
		var insurance = false;
-
 
836
		
888
		
837
		$("#order-details").find("tr:not(:first-child)").each(function(index,el){
889
		$("#order-details").find("tr:not(:first-child)").each(function(index,el){
838
			//console.log(el);
890
			//console.log(el);
839
			//console.log(index);
891
			//console.log(index);
840
			var $serialNumberElement = $(el).find('.serialNumber');
892
			var $serialNumberElement = $(el).find('.serialNumber');