تكامل دورة المبيعات
الأساليب والتدفقات القياسية المدرجة في القائمة البيضاء لدمج نظام إدارة الطلبات الخارجية ودورة المبيعات باستخدام REST API
1. أمر المبيعات
Frappe Framework generates REST API for all the DocTypes out of the box. This approach can be used for creating the very first document of the sales cycle. In case you are starting with the Sales Order you can use the standard REST API POST request for generating the Order. An example is shown below, you can include custom fields and other doctype details in the body accordingly.
POST /api/resource/Sales Order
# Body
{
"doctype": "Sales Order",
"customer": "Test Customer",
"company_address": "Test - Billing",
"customer_address": "Test-Billing-3",
"items": [{
"item_code": "Mobile Display",
"qty": 10,
"rate": 2000,
"delivery_date": "2022-11-06",
"delivery_warehouse": "Stores - GTPL"
}]
}
2. مذكرة التسليم
في حال كنت تبدأ بمذكرة تسليم، استخدم نفس الطريقة الموضحة أعلاه لأمر المبيعات، فما عليك سوى استبدال قيمة مفتاح نوع المستند إلى مذكرة التسليم بدلاً من أمر المبيعات. في حالة رغبتك في تقديم مذكرة تسليم من أمر مبيعات، استخدم نقطة النهاية أدناه. المعلمة source_name هنا هي معرف أمر المبيعات.
POST /api/method/bitex.selling.doctype.sales_order.sales_order.make_delivery_note
# Body
{"source_name": "SO-2022-00001"}
تقوم نقطة النهاية بإرجاع كائن مذكرة التسليم JSON كاستجابة مع كافة العناصر المعلقة بالترتيب المطلوب تسليمها.
3. فاتورة المبيعات
مرة أخرى، إذا كنت تقوم فقط بإعداد فاتورة مبيعات، فإن أفضل طريقة هي استخدام REST API القياسي. ولهذا يرجى الرجوع إلى المثال المذكور في قسم أمر المبيعات.
لإنشاء فاتورة مبيعات من أمر مبيعات، استخدم نقطة النهاية المذكورة أدناه. المعلمة source_name هنا هي معرف أمر المبيعات.
POST /api/method/bitex.selling.doctype.sales_order.sales_order.make_sales_invoice
# Body
{"source_name": "SO-2022-00001"}
لإنشاء فاتورة مبيعات من مذكرة التسليم، استخدم نقطة النهاية المذكورة أدناه. المعلمة source_name هنا هي معرف مذكرة التسليم.
POST /api/method/bitex.stock.doctype.delivery_note.delivery_note.make_sales_invoice
# Body
{"source_name": "SO-2022-00001"}
يقوم كل من enpoints بإرجاع كائن فاتورة المبيعات JSON مع كافة العناصر المعلقة التي سيتم إصدار فاتورة بها.
4. الدفع مقابل الطلب أو الفاتورة
لإنشاء إدخال دفع مقابل أمر مبيعات أو فاتورة، استخدم نقطة النهاية أدناه
POST /api/method/bitex.accounts.doctype.payment_entry.payment_entry.get_payment_entry
# Body
{
"dt": "Sales Invoice",
"dn": "SI-2022-0001",
"party_amount": 2000, # Pass if the document doesn't have an `outstanding_amount` field (optional parameter)
"bank_account": "Bank Name - CAB", # Pass is case want to use other than the default one (optional parameter)
"bank_amount": 2000, # Paid or received amount depending on the type of payment entry (optional parameter)
"party_type": "Customer", # If payment entry is against party type other than Customer or Supplier (optional parameter)
"payment_type": "Pay", # Pay or receive (optional parameter)
}