Subversion Repositories SmartDukaan

Rev

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

Rev 17024 Rev 17033
Line 429... Line 429...
429
                        <th  style="text-align:center">Sale</th>
429
                        <th  style="text-align:center">Sale</th>
430
                        <th  style="text-align:center">Approved</th>
430
                        <th  style="text-align:center">Approved</th>
431
                        <th  style="text-align:center">Approved %</th>
431
                        <th  style="text-align:center">Approved %</th>
432
                        <th  style="text-align:center">Rejected</th>
432
                        <th  style="text-align:center">Rejected</th>
433
                        <th  style="text-align:center">Rejected %</th>
433
                        <th  style="text-align:center">Rejected %</th>
-
 
434
                        <th  style="text-align:center">Missing %</th>
-
 
435
                        <th  style="text-align:center">Approved % against Sale</th>
434
                    </tr>
436
                    </tr>
435
                </thead>
437
                </thead>
436
                <tbody>
438
                <tbody>
437
                    {0}
439
                    {0}
438
                </tbody>
440
                </tbody>
439
            </table>
441
            </table>
440
            </body>
442
            </body>
441
        </html>
443
        </html>
442
    """
444
    """
443
    tbody=[]
445
    tbody=[]
444
    rowtemplate="<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td></tr>"
446
    rowtemplate="<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6}</td><td>{7}</td></tr>"
445
    for offer in db.flSaleSnapshot.find().limit(61).sort("_id",-1):
447
    for offer in db.flSaleSnapshot.find().limit(61).sort("_id",-1):
446
        approved = offer.get("approvedAmount")
448
        approved = offer.get("approvedAmount")
447
        rejected = offer.get("rejectedAmount")
449
        rejected = offer.get("rejectedAmount")
-
 
450
        sale = offer.get("paidAmount")
448
        total = approved + rejected
451
        total = approved + rejected
449
        if total ==0:
452
        if total ==0:
450
            continue
453
            continue
451
        tbody.append(rowtemplate.format(offer.get("_id"), offer.get("paidAmount"), approved, int((approved*100/total)), rejected, int((rejected*100/total))))
454
        tbody.append(rowtemplate.format(offer.get("_id"), sale, approved, int((approved*100/total)), rejected, int((rejected*100/total)), int((sale-approved-rejected)*100/sale),int((approved)*100/sale)))
452
    message = mailBodyTemplate.format("".join(tbody))
455
    message = mailBodyTemplate.format("".join(tbody))
453
    workbook.save(XLS_FILENAME)
456
    workbook.save(XLS_FILENAME)
454
    return message
457
    return message
455
    
458
    
456
def generateHomeShopReco():
459
def generateHomeShopReco():