示例#1
0
def add_detail():
    detail = request.form.get('detail')
    config = Configuration.objects().get(name='basic')
    details = config.details
    details.append(detail)
    config.details = details
    config.save()
    return Response(config.to_json(), mimetype="application/json", status=200)
示例#2
0
def add_header():
    header = request.form.get('header')
    config = Configuration.objects().get(name='basic')
    headers = config.headers
    headers.append(header)
    config.headers = headers
    config.save()
    return Response(config.to_json(), mimetype="application/json", status=200)
示例#3
0
def delete_detail():
    detail = request.form.get('detail')
    config = Configuration.objects().get(name='basic')
    details = config.details
    while detail in details:
        details.remove(detail)
    config.details = details
    config.save()
    return Response(config.to_json(), mimetype="application/json", status=200)
示例#4
0
def delete_header():
    header = request.form.get('header')
    config = Configuration.objects().get(name='basic')
    headers = config.headers
    while header in headers:
        headers.remove(header)
    config.headers = headers
    config.save()
    return Response(config.to_json(), mimetype="application/json", status=200)
示例#5
0
    def get(self):
        user_id = get_jwt_identity()

        configurations = Configuration.objects().filter(
            added_by=user_id).to_json()

        response = Response(configurations,
                            mimetype="application/json",
                            status=200)
        response.headers['Access-Control-Allow-Origin'] = '*'
        response.headers['Access-Control-Allow-Headers'] = '*'
        response.headers['Access-Control-Allow-Credentials'] = 'true'
        response.headers[
            'Access-Control-Allow-Methods'] = 'GET, POST, PUT, DELETE, OPTIONS, HEAD'
        response.headers['Access-Control-Max-Age'] = '1209600'
        return response
示例#6
0
    def __init__(self):
        config = Configuration.objects().get(name='basic')
        self.header = config.headers
        self.details_list = config.details
        self.weights_header = [
            'S. No.', 'S. N.', 'S. No.', 'Sr. No.', 'Description', 'duty',
            'rate', 'HSN'
        ]
        self.header_ = [
            'S. No.',
            'S. N.',
            'S. No.',
            'Sr. No.',
            'Product ID',
            'Item Code ',
            'Cust Mat Code',
            'Material Code',  ###List of header attribute
            'Material Description',
            'Part No',
            'ISBN-13',
            'Product Code',
            'SKU',
            'SKU\tSales Order/No/Pos/SeqHSN',  ## make nw additions
            'HSN Code',
            'HSN/SAC',
            'HSN of Goods/ Services',
            'Title',
            'Item Description',
            'Description of Goods',
            'Desc of Goods/Services',
            'Title & Author',
            'Quantity',
            'Quantity',
            'QTY\tNo of packages',
            'SUPPL Qty',
            'Unit Price',
            'Mrp per Unit',
            'Basic Rate',
            'Unit Price\t',
            'Excise Duty',
            'Freight'
            'Discount Percentage',
            'Disc.',
            'Disc. (INR)',
            'Cash Discount (CD / amount * 100)SGST Percentage',
            'SGST/ UTGST',
            'Tax %',
            'Tax Rate',
            'CGST Percentage',
            'CGST Tax %',
            'IGST Percentage',
            'IGST Tax %',
            'Cess Percentage',
            'Discount3',
            'Discount2',
            'Discount1'
        ]
        #  'TCS Percentage', 'Total tax/Total amount * 100', 'Grand Total - Basic Total', 'Total Amount',
        # 'Net Payable','Ord.' 'Total (R/O)', 'Grand Total\t', 'APP%', 'Line Total', 'Total quantity pcs'
        # ]
        self.details_list_ = [
            'Seller State', 'Separate Country from State', 'State',
            'State Name', 'Place of Supply,', 'State Name & CodeSeller ID',
            'CIN No', 'PAN No', 'Seller Name', 'Header Parsing\t',
            'Registered Office Name & Address', 'Regd Office', 'Vendor Name',
            'Billed By', 'Seller Address', 'Vendor Address',
            'Seller GSTN Number', 'GSTN No\t,GSTIN/UIN', 'GSTIN  No.',
            'GST No', 'CIN', 'Vendor GSTIN', 'GST Inv No', 'Our GSTIN',
            'Country of Orgin', 'Along with State:', 'Currency',
            'Invoicing Currency', 'Description', 'Sale Order No',
            "Supplier's Ref", 'Payment Terms', 'Invoice Number', 'Invoice No',
            'Invoice No/Date', 'Invoice No/Series', 'Invoice Date',
            'Invoice Date', 'Date', 'Due Date', 'Due', 'Due Date',
            'DatePayment Due Date', 'Payable On', 'Payable On or before',
            'PO Number', 'Purchase Order No', 'Customer PO No', 'PO Details',
            'Supplier Ref', 'Invoice Items Total Amount', 'Buyer GSTN Number',
            'Contextual Analysis', 'GSTN No\t', 'GSTIN', 'GST Reg No',
            'GSTIN/Unique ID', 'GSTIN ID', 'Ship to Address\t',
            'Ship To\tPlace of Supply\tDelivery Address', 'ship to',
            'Sold to ', 'Name & Address', 'Name of Customer (Billed to)',
            'Buyer', 'Detail of Receiver', 'Consignee Name', 'Bill to Address',
            'Ship To', 'Name of Customer', 'Customer Name', 'delivery terms',
            'invoice time', 'freight', 'delivery terms', 'state',
            'delivery date', 'bill', 'Customer'
        ]

        self.search_details = {
            'no': ['Invoice Number', 'Invoice no', 'Invoice No'],
            'date': ['Invoice Date', 'Invoice Dt', 'Dated', 'Date'],
            'Due': [
                'Due', 'Due Date', 'Mode/Terms Of\n\nPayment',
                'Payment Due\n\nDate', 'payment terms'
            ],
            'gst': [
                'GSTN', 'GSTN No.', 'GSTIN ID', 'GSTIN/Unique ID', 'GSTN',
                'GSTIN/UIN'
            ],
            'po': ['PO No.'],
            'ship': [
                'Delivery Address', 'Bill to Address', 'Ship to',
                'Customer name', 'Buyer', 'Ship', 'Buyers address',
                'Buyer\'s asdress', 'Address', 'Consignee', 'Billed Bygits '
            ]
        }

        self.remove_list = ['id', 'basic', 'total', 'tax', '']
        # self.split_header()
        # print(self.header)
        # sys.exit()
        self.bbox = None
        self.header = [self.clean(head) for head in self.header]
        self.row_string = None
        self.similarity_index = None
        self.header_idx = None
        self.sheet = None
        self.info = None
        self.details = dict()
        self.details_status = []
        self.currency = 'INR'
        self.rows = None
        self.cols = None
        self.outside = None
示例#7
0
def update_num_of_threads(thread):
    config = Configuration.objects().get(name='basic')
    config.num_of_threads = thread
    config.save()
    return Response(config.to_json(), mimetype="application/json", status=200)
示例#8
0
def get_basic_config():
    config = Configuration.objects().get(name='basic').to_json()
    return Response(config, mimetype="application/json", status=200)