Subversion Repositories SmartDukaan

Rev

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

Rev 10839 Rev 10958
Line 688... Line 688...
688
    sheet.write(0, 23, "Our NLC", heading_xf)
688
    sheet.write(0, 23, "Our NLC", heading_xf)
689
    sheet.write(0, 24, "Subsidy Difference", heading_xf)
689
    sheet.write(0, 24, "Subsidy Difference", heading_xf)
690
    sheet.write(0, 25, "Target TP", heading_xf)
690
    sheet.write(0, 25, "Target TP", heading_xf)
691
    sheet.write(0, 26, "Target SP", heading_xf)
691
    sheet.write(0, 26, "Target SP", heading_xf)
692
    sheet.write(0, 27, "MARGIN INCREASED POTENTIAL", heading_xf)
692
    sheet.write(0, 27, "MARGIN INCREASED POTENTIAL", heading_xf)
-
 
693
    sheet.write(0, 28, "Auto Pricing Decision", heading_xf)
-
 
694
    sheet.write(0, 29, "Reason", heading_xf)
-
 
695
    sheet.write(0, 30, "Updated Price", heading_xf)
693
    
696
    
694
    sheet_iterator = 1
697
    sheet_iterator = 1
695
    for item in buyBoxItems:
698
    for item in buyBoxItems:
696
        snapdealDetails = item[0]
699
        snapdealDetails = item[0]
697
        snapdealItemInfo = item[1]
700
        snapdealItemInfo = item[1]
Line 736... Line 739...
736
            proposed_tp = getTargetTp(proposed_sp,mpItem)
739
            proposed_tp = getTargetTp(proposed_sp,mpItem)
737
            #target_nlc = proposed_tp - snapdealPricing.lowestPossibleTp + snapdealItemInfo.nlc
740
            #target_nlc = proposed_tp - snapdealPricing.lowestPossibleTp + snapdealItemInfo.nlc
738
        sheet.write(sheet_iterator, 25, round(proposed_tp,2))
741
        sheet.write(sheet_iterator, 25, round(proposed_tp,2))
739
        sheet.write(sheet_iterator, 26, round(proposed_sp,2))
742
        sheet.write(sheet_iterator, 26, round(proposed_sp,2))
740
        sheet.write(sheet_iterator, 27, round((proposed_tp - snapdealPricing.ourTp),2))
743
        sheet.write(sheet_iterator, 27, round((proposed_tp - snapdealPricing.ourTp),2))
-
 
744
        mp_history_item = session.query(MarketPlaceHistory).filter(MarketPlaceHistory.timestamp==timestamp).filter(MarketPlaceHistory.item_id==snapdealItemInfo.item_id).filter(MarketPlaceHistory.source==OrderSource.SNAPDEAL).one()
-
 
745
        sheet.write(sheet_iterator, 28, Decision._VALUES_TO_NAMES.get(mp_history_item.decision))
-
 
746
        sheet.write(sheet_iterator, 29, mp_history_item.reason)
-
 
747
        if Decision._VALUES_TO_NAMES.get(mp_history_item.decision) == "AUTO_DECREMENT_SUCCESS":
-
 
748
            sheet.write(sheet_iterator, 30, math.ceil(mp_history_item.proposedSellingPrice))
-
 
749
        if Decision._VALUES_TO_NAMES.get(mp_history_item.decision) == "AUTO_INCREMENT_SUCCESS":
-
 
750
            sheet.write(sheet_iterator, 30, math.ceil(mp_history_item.ourSellingPrice+max(10,.01*mp_history_item.ourSellingPrice)))
741
        sheet_iterator+=1
751
        sheet_iterator+=1
742
    
752
    
743
    sheet = wbk.add_sheet('Can Compete-With Inventory')
753
    sheet = wbk.add_sheet('Can Compete-With Inventory')
744
 
754
 
745
    heading_xf = xlwt.easyxf('font: bold on; align: wrap off, vert centre, horiz center')
755
    heading_xf = xlwt.easyxf('font: bold on; align: wrap off, vert centre, horiz center')
Line 776... Line 786...
776
    sheet.write(0, 24, "Lowest Possible SP", heading_xf)
786
    sheet.write(0, 24, "Lowest Possible SP", heading_xf)
777
    sheet.write(0, 25, "Subsidy Difference", heading_xf)
787
    sheet.write(0, 25, "Subsidy Difference", heading_xf)
778
    sheet.write(0, 26, "Target TP", heading_xf)
788
    sheet.write(0, 26, "Target TP", heading_xf)
779
    sheet.write(0, 27, "Target SP", heading_xf)  
789
    sheet.write(0, 27, "Target SP", heading_xf)  
780
    sheet.write(0, 28, "Sales Potential", heading_xf)
790
    sheet.write(0, 28, "Sales Potential", heading_xf)
-
 
791
    sheet.write(0, 29, "Auto Pricing Decision", heading_xf)
-
 
792
    sheet.write(0, 30, "Reason", heading_xf)
-
 
793
    sheet.write(0, 31, "Updated Price", heading_xf)
781
    
794
    
782
    sheet_iterator = 1
795
    sheet_iterator = 1
783
    for item in competitive:
796
    for item in competitive:
784
        snapdealDetails = item[0]
797
        snapdealDetails = item[0]
785
        snapdealItemInfo = item[1]
798
        snapdealItemInfo = item[1]
Line 823... Line 836...
823
            proposed_sp = max(snapdealDetails.lowestSp - max((10, snapdealDetails.lowestSp*0.001)) -getSubsidyDiff(snapdealDetails), snapdealPricing.lowestPossibleSp)
836
            proposed_sp = max(snapdealDetails.lowestSp - max((10, snapdealDetails.lowestSp*0.001)) -getSubsidyDiff(snapdealDetails), snapdealPricing.lowestPossibleSp)
824
            proposed_tp = getTargetTp(proposed_sp,mpItem)
837
            proposed_tp = getTargetTp(proposed_sp,mpItem)
825
        sheet.write(sheet_iterator, 26, round(proposed_tp,2))
838
        sheet.write(sheet_iterator, 26, round(proposed_tp,2))
826
        sheet.write(sheet_iterator, 27, round(proposed_sp,2))
839
        sheet.write(sheet_iterator, 27, round(proposed_sp,2))
827
        sheet.write(sheet_iterator, 28, getSalesPotential(snapdealDetails.lowestOfferPrice,snapdealItemInfo.nlc))
840
        sheet.write(sheet_iterator, 28, getSalesPotential(snapdealDetails.lowestOfferPrice,snapdealItemInfo.nlc))
-
 
841
        mp_history_item = session.query(MarketPlaceHistory).filter(MarketPlaceHistory.timestamp==timestamp).filter(MarketPlaceHistory.item_id==snapdealItemInfo.item_id).filter(MarketPlaceHistory.source==OrderSource.SNAPDEAL).one()
-
 
842
        sheet.write(sheet_iterator, 29, Decision._VALUES_TO_NAMES.get(mp_history_item.decision))
-
 
843
        sheet.write(sheet_iterator, 30, mp_history_item.reason)
-
 
844
        if Decision._VALUES_TO_NAMES.get(mp_history_item.decision) == "AUTO_DECREMENT_SUCCESS":
-
 
845
            sheet.write(sheet_iterator, 31, math.ceil(mp_history_item.proposedSellingPrice))
-
 
846
        if Decision._VALUES_TO_NAMES.get(mp_history_item.decision) == "AUTO_INCREMENT_SUCCESS":
-
 
847
            sheet.write(sheet_iterator, 31, math.ceil(mp_history_item.ourSellingPrice+max(10,.01*mp_history_item.ourSellingPrice)))
828
        sheet_iterator+=1
848
        sheet_iterator+=1
829
    
849
    
830
    sheet = wbk.add_sheet('Negative Margin')
850
    sheet = wbk.add_sheet('Negative Margin')
831
 
851
 
832
    heading_xf = xlwt.easyxf('font: bold on; align: wrap off, vert centre, horiz center')
852
    heading_xf = xlwt.easyxf('font: bold on; align: wrap off, vert centre, horiz center')