Subversion Repositories SmartDukaan

Rev

Rev 14780 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<style>
* { font-family: Verdana; font-size: 96%; }
                label {
    float: left;
}

#upload > table {
    color: #747474;
    width: 100%;
}


#upload tbody {
    background: url("/Support/images/center-bcg.png") repeat-y scroll right top #F6F6F6;
    font-weight: bold;
}

.detail {
    background: url("/Support/images/center-blue.png") repeat-y scroll left top #E4EBF8;
    border-bottom: 1px solid #B3C1DB;
    border-right: 1px solid #CED9EC;
    color: #1F3D71;
    height: 25px;
    padding: 10px 0 0 24px;
}

.value {
    border-bottom: 1px solid #B3C1DB;
    border-right: 1px solid #CED9EC;
    height: 24px;
    text-align: center;
    color: #747474;
}

select {
    padding-top: 2px;
    vertical-align: middle;
        direction: ltr;
    font-weight: bold;
    width: 50%;
        height: 22px;
}

input {
    font-size: 12px;
    text-align: center;
    width: 50%;
    font-weight: bold;
}
.top-header {
    background-color: #2789C1;
    display: block;
    height: 20px;
    width: 100%;
}

input[type="text"][readonly] {
   background-color: #D1D1D1;
}

input[type="text"][disabled] {
   background-color: #D1D1D1;
}
.border-highlight{
        border : 3px solid #00BFFF;
}

.border-highlight-green{
        border : 3px solid green;
}

.border-highlight-red{
        border : 3px solid red;
}
</style>
<link href="/Support/css/jquery.alerts.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="/Support/js/jquery-1.4.2.js"></script>
<script type="text/javascript" src="/Support/js/jquery.alerts.js"></script>
<script type="text/javascript">
$(document).ready(function() {
  $('#cancelbutton').click(function(e) {
    window.location.href = '/Support/flipkart-list';
});
});
</script>
<script type="text/javascript">
$('select').change(function(){
        var optionValue = $(this).val();
        var selectType = parseInt($(this).attr('selectType'));
        switch(selectType)
        {
        case 1:
                if (optionValue=='True'){
                        $(this).removeClass().addClass('border-highlight-red');
                }
                else{
                        $(this).removeClass();
                }
                break;
        case 2:
                if (optionValue=='False'){
                        $(this).removeClass().addClass('border-highlight-red');
                }
                else{
                        $(this).removeClass();
                }
                break;
        case 3:
                if (optionValue=='True'){
                        $(this).removeClass().addClass('border-highlight-green');
                }
                else{
                        $(this).removeClass();
                }
                break;
        }
});
</script>
<script type="text/javascript">
function calculateStuff()
{
$('input#minPosTp').removeClass("border-highlight");
$('input#minPosSp').removeClass("border-highlight");
$('input#transferPrice').removeClass("border-highlight");
$('input#serviceTax').removeClass("border-highlight");
$('input#commission').removeClass("border-highlight");
$('input#margin').removeClass();
$('input#marginPer').removeClass();
var itemWeight=$('#itemWeight').val();
itemWeight = +itemWeight+.05;
console.log(itemWeight);
if (itemWeight==0){
        var courierCost =64;
}
else{
var slabs = parseInt((parseFloat(itemWeight)-.001)/.5)
var courierCost = 64;
for (var i=0;i<slabs;i++)
{
        courierCost = courierCost + 34;
}
}
console.log(courierCost);
//courierCost = ((courierCost+0)*1.1236).toFixed(2);
var sellingPrice=$('#sellingPrice').val();
var nlc=$('#maxNlc').val();
var otherCost=$('#otherCost').val();
var othCost=parseFloat(otherCost);
if ( sellingPrice==null || sellingPrice=="" || isNaN(sellingPrice) || nlc==null || nlc=="" || isNaN(nlc)){
        $('input#courierCost').val('0.00');
        $('input#commission').val('0.00');
        $('input#serviceTax').val('0.00');
        $('input#').val('0.00');
}
else{
var com=$('#commissionRate').val();
var comRate=com/100;
var serviceTaxRate=$('#serviceTaxRate').val();
console.log(serviceTaxRate)
var stRate = serviceTaxRate/100;
var emiFeeRate=$('#emiFee').val();
console.log(emiFeeRate);
var emiFee=emiFeeRate/100;
var closingFee=parseFloat($('#closingFee').val());
var returnProvision=parseFloat($('#returnProvision').val());
console.log(returnProvision);
console.log(closingFee);
var margin=$('#margin').val();
var vatRate=$('#vat').val();
if ( vatRate==null || vatRate=="" || isNaN(vatRate)){
        jAlert('Please enter VAT Rate for item','ERROR');
        $('input#sellingPrice').val('0.00');
        return false;
}
var vat=vatRate/100;
var commisionPrice=((comRate)*sellingPrice).toFixed(2);
var ourTp=(parseFloat(sellingPrice)-parseFloat(sellingPrice)*(1+stRate)*((comRate)+emiFee)-((courierCost+closingFee)*(1+stRate)));
var vatValue=(((sellingPrice/(1+vat))-(nlc/(1+vat)))*vat).toFixed(2);
var inHouseCost=(+vatValue+15+((returnProvision/100)*sellingPrice)+othCost);
var lowestTp=(+nlc+inHouseCost).toFixed(2);
var lowestSp=(+nlc+(courierCost+closingFee)*(1+stRate)*(1+vat)+(15+othCost)*(1+vat))/(1-(comRate+emiFee)*(1+stRate)*(1+vat)-(returnProvision/100)*(1+vat));
ourTp = (parseFloat(ourTp)).toFixed(2);
$('input#minPosTp').val(lowestTp);
$('input#minPosSp').val(parseFloat(lowestSp).toFixed(2));
$('input#transferPrice').val(ourTp);
var serviceTax=(stRate*(+commisionPrice+courierCost)).toFixed(2);
lowest_possible_tp=parseFloat(lowestTp);
newMargin=(ourTp-lowest_possible_tp).toFixed(2);
marginPercentage=(((ourTp-lowest_possible_tp)/sellingPrice)*100).toFixed(2);
$('input#marginPer').val(marginPercentage);
$('input#margin').val(newMargin);
$('input#sellingPrice').val(sellingPrice);
$('input#courierCost').val(courierCost);
$('input#commission').val(commisionPrice);
$('input#serviceTax').val(serviceTax);
$('input#minPosTp').addClass("border-highlight");
$('input#minPosSp').addClass("border-highlight");
$('input#transferPrice').addClass("border-highlight");
$('input#serviceTax').addClass("border-highlight");
$('input#commission').addClass("border-highlight");
$('input#margin').addClass("border-highlight");
$('input#marginPer').addClass("border-highlight");
if (ourTp-lowest_possible_tp < 0){
        $('input#margin').removeClass().addClass("border-highlight-red");
        $('input#marginPer').addClass("border-highlight-red");
}
}
}
</script>
<script type="text/javascript">
$('#populateStuff').live('click', function(){
        var itemId=$('#itemId').val();
        var whId=$('#warehouseId').val();
        var sellingPrice=$('#sellingPrice').val();
        if ( whId==null || whId=="" || isNaN(whId)){
                jAlert('Please enter valid warehouse id', 'ERROR');
                return false;
        }
        if (sellingPrice==0 || sellingPrice=="" || isNaN(sellingPrice)){
                jAlert('Illegal Entry In Selling Price', 'ERROR');
                return false;
        }
        jQuery.ajax({
        type : "GET",
        url : "/Support/flipkart-list!getItemDetailsInJson?itemId="+itemId+"&warehouseId="+whId+"&sellingPrice="+sellingPrice,
                beforeSend: function(){
        $('#ajax-spinner').show();
                $('#add-new-item')[0].reset();
        },
        complete: function(){
        $('#ajax-spinner').hide();
        },
        success : function(json){
                var parsedData = JSON.parse(json);
                $('input#itemId').val(parsedData.ItemId);
                $('input#brand').val(parsedData.Brand);
                $('input#modelNumber').val(parsedData.ModelNumber);
                $('input#modelName').val(parsedData.ModelName);
                $('input#color').val(parsedData.Color);
                $('input#itemWeight').val(parsedData.Weight);
                $('input#risky').val(parsedData.Risky);
                $('input#status').val(parsedData.Status);
                $('input#webisteMrp').val(parsedData.MRP);
                $('input#webisteSellingPrice').val(parsedData.SellingPrice);
                $('input#maxSp').val(0);
                $('input#commissionRate').val(parsedData.CommissionRate);
                $('input#returnProvision').val(parsedData.ReturnProvision);
                $('input#emiFee').val(parsedData.EmiFee);
                $('input#closingFee').val(parsedData.ClosingFee);
                $('input#serviceTaxRate').val(parsedData.ServiceTaxRate);
                $('input#sellingPrice').val(sellingPrice);
                $('input#transferPrice').val('0.0');
                $('input#exceptionPrice').val('0.0');
                $('input#commission').val('0.0');
                $('input#serviceTax').val('0.0');
                $('input#courierCost').val('0.0');
                $('input#maxNlc').val(parsedData.MaxNlc);
                $('input#warehouseId').val(whId);
                $('input#vat').val(parsedData.VatRate);
                calculateStuff();
        },
                error : function() {
                        alert("Either item id is already present in flipkart item or  not a valid item Id");
                 },
    });
        return false;
});
</script>
<div class="top-header">
<span style="float: left; padding-left: 10px; padding-top: 2px; font-size: 14px; font-weight: bolder; color: white;">
ADD NEW PRODUCT
</span>
</div>
<form id="add-new-item" action="/Support/flipkart-list!addNewItem" enctype="multipart/form-data" method="post">
<div class="left" style="float: left; width: 48%;">
<table id="upload" style="text-align: center;width: 100%;height:200px;">
<thead>
</thead>
<tbody>
<tr>
<td class="detail">Item Id</td>
<td class="value">
<input id="itemId" name="itemId" value=''type="text" style="width:25%;">
<input type="button" id="populateStuff" value="Populate" style="width:25%;">
</td>
</tr>
<tr>
<td class="detail">Brand</td>
<td class="value"><input id="brand" name="brand" value='' type="text" readonly/></td>
</tr>
<tr>
<td class="detail">Model Number</td>
<td class="value"><input id="modelNumber" name="modelNumber" value='' type="text" disabled/></td>
</tr>
<tr>
<td class="detail">Model Name</td>
<td class="value"><input id="modelName" name="modelName" value='' type="text" disabled/></td>
</tr>
<tr>
<td class="detail">Color</td>
<td class="value"><input id="color" name="color" value='' type="text" disabled/></td>
</tr>
<tr class="detail"></td>
        <td class="detail">Weight</td>
        <td class="value"><input id="itemWeight" name="itemWeight" value='0' type="text" disabled/></td>
</tr>
<tr>
<td class="detail">Risky</td>
<td class="value">
         <input id="risky" name="risky" value='' type="text" disabled style="text-transform: uppercase;"/></td>
</td>
</tr>
<tr>
<td class="detail">Status</td>
<td class="value"><input id="status" name="status" value='' type="text" disabled/></td>
</tr>
<tr>
<td class="detail">Warehouse Id</td>
<td class="value">
        <input id="warehouseId" name="warehouseId" value='' type="text"/></td>
</tr>
<tr>
<td class="detail">Max NLC</td>
<td class="value"><input id="maxNlc" name="maxNlc" value=''type="text" readonly/></td>
</tr>
<tr>
<td class="detail">Flipkart Selling Price</td>
<td class="value">
        <input id="sellingPrice" name="sellingPrice" value='' type="text" onkeyup="calculateStuff()"></td>
</tr>
<tr>
<td class="detail">Transfer Price</td>
<td class="value"><input id="transferPrice" name="transferPrice" value='' type="text" readonly/></td>
</tr>
<tr>
<td class="detail">Other Cost</td>
<td class="value"><input id="otherCost" name="otherCost" value='0.0' type="text" onkeyup="calculateStuff()"</td>
</tr>
<tr>
<td class="detail">Minimum Possible SP (Calculated)</td>
<td class="value"><input id="minPosSp" name="minPosSp" value='' type="text" readonly/></td><!--Inventory details end-->
</tr>
<tr>
<td class="detail">Minimum Possible TP (Calculated)</td>
<td class="value">
        <input id="minPosTp" name="minPosTp" value='' type="text" readonly/>
</td>
</tr>
<tr>
<td class="detail">Website MRP</td>
<td class="value"><input id="webisteMrp" name="webisteMrp" value='' type="text" disabled/></td>
</tr>
<tr>
<td class="detail">Website Selling Price</td>
<td class="value"><input id="webisteSellingPrice" name="webisteSellingPrice" value='' type="text" disabled/></td>
</tr>
</tbody>
</table>
</div>
<div class="left" style="float: right; width: 48%;">
<table id="upload" style="text-align: center;width: 100%;height:200px;">
<thead>
</thead>
<tbody>
<tr>
<td class="detail">Margin</td>
<td class="value"><input id="margin" name="margin" value=''type="text" style="width:20%;" disabled/>
<span style="font-weight:bold;color:black;">Margin&nbsp;&#37;</span><input id="marginPer" name="marginPer" value='' type="text" style="width:20%;" disabled/></td>
</td>
</tr>
<tr>
<td class="detail">Maximum Selling Price</td>
<td class="value"><input id="maxSp" name="maxSp" value='' type="text"></td>
</tr>
<tr>
<td class="detail">Suppress Inventory Feed</td>
<td class="value">
      <select name="isSuppressInventoryFeed" selectType="1"><option value="True">Active</option><option selected="selected" value="False">InActive</option></select>
</td>
</tr>
<tr>
<td class="detail">Suppress Price Feed</td>
<td class="value">
      <select name="isSuppressPriceFeed" selectType="1"><option selected="selected" value="True">Active</option><option selected="selected" value="False">InActive</option></select>
</td>
</tr>
<tr>
<td class="detail">Flipkart Listed</td>
<td class="value">
      <select name="isListedOnFlipkart" selectType="2"><option selected="selected" value="True">Active</option><option value="False">InActive</option></select>
</td>
</tr>
<tr>
<td class="detail">Flipkart FA Listed</td>
<td class="value">
      <select name="isFaListedOnFlipkart" selectType="2"><option selected="selected" value="True">Active</option><option value="False">InActive</option></select>
</td>
</tr>
<tr>
<td class="detail">Manual Favourite</td>
<td class="value">
      <select name="isManualFavourite" selectType="3"><option value="True">Active</option><option selected="selected" value="False">InActive</option></select>
</td>
</tr>
<tr>
<td class="detail">Auto Increment</td>
<td class="value">
      <select name="isAutoIncrement" selectType="3"><option value="True">Active</option><option selected="selected" value="False">InActive</option></select>
</td>
</tr>
<tr>
<td class="detail">Auto Decrement</td>
<td class="value">
      <select name="isAutoDecrement" selectType="3"><option value="True">Active</option><option selected="selected" value="False">InActive</option></select>
</td>
</tr>
<tr>
<td class="detail">Exception Price</td>
<td class="value"><input id="exceptionPrice" name="exceptionPrice" value='' type="text"/></td>
</tr>
<tr>
<td class="detail">Commission&nbsp;&#37;</td>
<td class="value"><input id="commissionRate" name="commissionRate" value=''type="text" disabled/></td>
</tr>
<tr>
<td class="detail">Commission</td>
<td class="value"><input id="commission" name="commission" value='' type="text" readonly/></td>
</tr>
<tr>
<td class="detail">VAT&nbsp;&#37;</td>
<td class="value"><input id="vat" name="vat" value='' type="text" onkeyup="calculateStuff()"></td>
</tr>
<tr>
<td class="detail">Service Tax</td>
<td class="value"><input id="serviceTax" name="serviceTax" value='' type="text" readonly/></td>
</tr>
<tr>
<td class="detail">Courier Cost</td>
<td class="value"><input id="courierCost" name="courierCost" value='' type="text" readonly/></td>
</tr>
<tr>
<td class="detail">Item Id &#64; Flipkart</td>
<td class="value"><input id="fkItemCode" name="fkItemCode" value='' type="text"></td>
</tr>
<tr>
<td class="detail">Flipkart Serial Number</td>
<td class="value"><input id="fkSerialNumber" name="fkSerialNumber" value='' type="text"></td>
</tr>
<tr>
<td class="detail">Action</td>
<td class="value"><input type="submit" value="Update" name="upload" style="width: 25%;">
<input type="button" style="padding-left: 5px; margin-left: 10px;width: 25%;" id="cancelbutton" name="cancel" value="Cancel">
</td>
</tr>
<tr class="detail" style="display:none;"></td>
<td>
        <input id="returnProvision" name="returnProvision" value='' type="text" disabled/>
</td>
</tr>
<tr class="detail" style="display:none;"></td>
<td>
        <input id="emiFee" name="emiFee" value='' type="text" disabled/>
</td>
</tr>
<tr class="detail" style="display:none;"></td>
<td>
        <input id="closingFee" name="closingFee" value='' type="text" disabled/>
</td>
</tr>
<tr class="detail" style="display:none;"></td>
<td>
        <input id="serviceTaxRate" name="serviceTaxRate" value='' type="text" disabled/>
</td>
</tr>
</tbody>
</table>
</div>
</form>