def info(sales_order_id):
    """
    订单详情
    :param sales_order_id:
    :return:
    """
    sales_order_info = get_sales_order_row_by_id(sales_order_id)
    # 检查资源是否存在
    if not sales_order_info:
        abort(404)
    # 检查资源是否删除
    if sales_order_info.status_delete == STATUS_DEL_OK:
        abort(410)

    sales_order_print_date = time_utc_to_local(
        sales_order_info.update_time).strftime('%Y-%m-%d')
    sales_order_code = '%s%s' % (
        g.SALES_ORDER_PREFIX, time_utc_to_local(
            sales_order_info.create_time).strftime('%y%m%d%H%M%S'))

    # 获取渠道公司信息
    customer_info = get_customer_row_by_id(sales_order_info.customer_cid)

    # 获取渠道联系方式
    customer_contact_info = get_customer_contact_row_by_id(
        sales_order_info.customer_contact_id)

    # 获取询价人员信息
    user_info = get_user_row_by_id(sales_order_info.uid)

    sales_order_items = get_sales_order_items_rows(
        sales_order_id=sales_order_id)

    # 文档信息
    document_info = DOCUMENT_INFO.copy()
    document_info['TITLE'] = _('sales order info')

    template_name = 'sales/order/info.html'

    return render_template(template_name,
                           sales_order_id=sales_order_id,
                           sales_order_info=sales_order_info,
                           customer_info=customer_info,
                           customer_contact_info=customer_contact_info,
                           user_info=user_info,
                           sales_order_items=sales_order_items,
                           sales_order_print_date=sales_order_print_date,
                           sales_order_code=sales_order_code,
                           **document_info)
Exemple #2
0
def info(enquiry_id):
    """
    询价详情
    :param enquiry_id:
    :return:
    """
    # 详情数据
    enquiry_info = get_enquiry_row_by_id(enquiry_id)
    # 检查资源是否存在
    if not enquiry_info:
        abort(404)
    # 检查资源是否删除
    if enquiry_info.status_delete == STATUS_DEL_OK:
        abort(410)

    enquiry_print_date = time_utc_to_local(
        enquiry_info.update_time).strftime('%Y-%m-%d')
    enquiry_code = '%s%s' % (
        g.ENQUIRIES_PREFIX, time_utc_to_local(
            enquiry_info.create_time).strftime('%y%m%d%H%M%S'))

    # 获取渠道公司信息
    supplier_info = get_supplier_row_by_id(enquiry_info.supplier_cid)

    # 获取渠道联系方式
    supplier_contact_info = get_supplier_contact_row_by_id(
        enquiry_info.supplier_contact_id)

    # 获取询价人员信息
    user_info = get_user_row_by_id(enquiry_info.uid)

    enquiry_items = get_enquiry_items_rows(enquiry_id=enquiry_id)

    # 文档信息
    document_info = DOCUMENT_INFO.copy()
    document_info['TITLE'] = _('enquiry info')

    template_name = 'enquiry/info.html'

    return render_template(template_name,
                           enquiry_id=enquiry_id,
                           enquiry_info=enquiry_info,
                           supplier_info=supplier_info,
                           supplier_contact_info=supplier_contact_info,
                           user_info=user_info,
                           enquiry_items=enquiry_items,
                           enquiry_print_date=enquiry_print_date,
                           enquiry_code=enquiry_code,
                           **document_info)
Exemple #3
0
def preview(quotation_id):
    """
    打印预览
    :param quotation_id:
    :return:
    """
    quotation_info = get_quotation_row_by_id(quotation_id)
    # 检查资源是否存在
    if not quotation_info:
        abort(404)
    # 检查资源是否删除
    if quotation_info.status_delete == STATUS_DEL_OK:
        abort(410)

    quotation_print_date = time_utc_to_local(
        quotation_info.update_time).strftime('%Y-%m-%d')
    quotation_code = '%s%s' % (
        g.QUOTATION_PREFIX, time_utc_to_local(
            quotation_info.create_time).strftime('%y%m%d%H%M%S'))

    # 获取客户公司信息
    customer_info = get_customer_row_by_id(quotation_info.customer_cid)

    # 获取客户联系方式
    customer_contact_info = get_customer_contact_row_by_id(
        quotation_info.customer_contact_id)

    # 获取报价人员信息
    user_info = get_user_row_by_id(quotation_info.uid)

    quotation_items = get_quotation_items_rows(quotation_id=quotation_id)

    # 文档信息
    document_info = DOCUMENT_INFO.copy()
    document_info['TITLE'] = _('quotation preview')

    template_name = 'quotation/preview.html'

    return render_template(template_name,
                           quotation_id=quotation_id,
                           quotation_info=quotation_info,
                           customer_info=customer_info,
                           customer_contact_info=customer_contact_info,
                           user_info=user_info,
                           quotation_items=quotation_items,
                           quotation_print_date=quotation_print_date,
                           quotation_code=quotation_code,
                           **document_info)
Exemple #4
0
def preview(delivery_id):
    """
    打印预览
    :param delivery_id:
    :return:
    """
    delivery_info = get_delivery_row_by_id(delivery_id)
    # 检查资源是否存在
    if not delivery_info:
        abort(404)
    # 检查资源是否删除
    if delivery_info.status_delete == STATUS_DEL_OK:
        abort(410)

    delivery_print_date = time_utc_to_local(
        delivery_info.update_time).strftime('%Y-%m-%d')
    delivery_code = '%s%s' % (
        g.ENQUIRIES_PREFIX, time_utc_to_local(
            delivery_info.create_time).strftime('%y%m%d%H%M%S'))

    # 获取客户公司信息
    customer_info = get_customer_row_by_id(delivery_info.customer_cid)

    # 获取客户联系方式
    customer_contact_info = get_customer_contact_row_by_id(
        delivery_info.customer_contact_id)

    # 获取出货人员信息
    user_info = get_user_row_by_id(delivery_info.uid)

    delivery_items = get_delivery_items_rows(delivery_id=delivery_id)

    # 文档信息
    document_info = DOCUMENT_INFO.copy()
    document_info['TITLE'] = _('delivery preview')

    template_name = 'delivery/preview.html'

    return render_template(template_name,
                           delivery_id=delivery_id,
                           delivery_info=delivery_info,
                           customer_info=customer_info,
                           customer_contact_info=customer_contact_info,
                           user_info=user_info,
                           delivery_items=delivery_items,
                           delivery_print_date=delivery_print_date,
                           delivery_code=delivery_code,
                           **document_info)
def preview(purchase_id):
    """
    打印预览
    :param purchase_id:
    :return:
    """
    purchase_info = get_purchase_row_by_id(purchase_id)
    # 检查资源是否存在
    if not purchase_info:
        abort(404)
    # 检查资源是否删除
    if purchase_info.status_delete == STATUS_DEL_OK:
        abort(410)

    purchase_print_date = time_utc_to_local(
        purchase_info.update_time).strftime('%Y-%m-%d')
    purchase_code = '%s%s' % (
        g.ENQUIRIES_PREFIX, time_utc_to_local(
            purchase_info.create_time).strftime('%y%m%d%H%M%S'))

    # 获取渠道公司信息
    supplier_info = get_supplier_row_by_id(purchase_info.supplier_cid)

    # 获取渠道联系方式
    supplier_contact_info = get_supplier_contact_row_by_id(
        purchase_info.supplier_contact_id)

    # 获取进货人员信息
    user_info = get_user_row_by_id(purchase_info.uid)

    purchase_items = get_purchase_items_rows(purchase_id=purchase_id)

    # 文档信息
    document_info = DOCUMENT_INFO.copy()
    document_info['TITLE'] = _('purchase preview')

    template_name = 'purchase/preview.html'

    return render_template(template_name,
                           purchase_id=purchase_id,
                           purchase_info=purchase_info,
                           supplier_info=supplier_info,
                           supplier_contact_info=supplier_contact_info,
                           user_info=user_info,
                           purchase_items=purchase_items,
                           purchase_print_date=purchase_print_date,
                           purchase_code=purchase_code,
                           **document_info)