Advertisement
Guest User

Product Serial Sales Report (updated)

a guest
Feb 28th, 2020
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 13.35 KB | None | 0 0
  1. // Query
  2. {
  3.     "select": [
  4.         "branch.name as created_for",
  5.         "branch_detail.name as for_location",
  6.         "sales_outbound.transaction_date",
  7.         "sales_outbound.sheet_number",
  8.         "sales_outbound.udf_invoice_no_2018_07_26 as invoice_number",
  9.         "product.name as product_name",
  10.         "product_serial_number.serial_number as product_serial",
  11.         "sales_outbound_detail.price",
  12.         "user.full_name as salesman",
  13.         "payment_surcharge.name as collection_detail_charge_type",
  14.         {
  15.             "column": "system_code.name + ' - ' + bank_account.account_number + ' - ' + bank_account.account_name as collection_detail_bank",
  16.             "type": "raw"
  17.         }
  18.     ],
  19.     "table": "sales_outbound",
  20.     "join": [
  21.         {
  22.             "table": "sales_outbound_detail",
  23.             "conditions": [
  24.                 {
  25.                     "column": "sales_outbound.id",
  26.                     "operator": "=",
  27.                     "value": {
  28.                         "column": "sales_outbound_detail.transaction_id",
  29.                         "type": "raw"
  30.                     }
  31.                 },
  32.                 {
  33.                     "column": "sales_outbound_detail.deleted_at",
  34.                     "operator": "null"
  35.                 }
  36.             ]
  37.         },
  38.         {
  39.             "table": "collection_reference",
  40.             "conditions": [
  41.                 {
  42.                     "column": "sales_outbound.id",
  43.                     "operator": "=",
  44.                     "value": {
  45.                         "column": "collection_reference.reference_id",
  46.                         "type": "raw"
  47.                     }
  48.                 },
  49.                 {
  50.                     "column": "collection_reference.reference_type",
  51.                     "operator": "=",
  52.                     "value": "sales_outbound"
  53.                 },
  54.                 {
  55.                     "column": "collection_reference.deleted_at",
  56.                     "operator": "null"
  57.                 }
  58.             ],
  59.             "type": "left"
  60.         },
  61.         {
  62.             "table": "collection",
  63.             "conditions": [
  64.                 {
  65.                     "column": "collection_reference.transaction_id",
  66.                     "operator": "=",
  67.                     "value": {
  68.                         "column": "collection.id",
  69.                         "type": "raw"
  70.                     }
  71.                 },
  72.                 {
  73.                     "column": "collection.deleted_at",
  74.                     "operator": "null"
  75.                 },
  76.                 {
  77.                     "column": "collection.approval_status",
  78.                     "operator": "=",
  79.                     "value": "3"
  80.                 }
  81.             ],
  82.             "type": "left"
  83.         },
  84.         {
  85.             "table": "collection_detail",
  86.             "conditions": [
  87.                 {
  88.                     "column": "collection.id",
  89.                     "operator": "=",
  90.                     "value": {
  91.                         "column": "collection_detail.transaction_id",
  92.                         "type": "raw"
  93.                     }
  94.                 },
  95.                 {
  96.                     "column": "collection_detail.deleted_at",
  97.                     "operator": "null"
  98.                 }
  99.             ],
  100.             "type": "left"
  101.         },
  102.         {
  103.             "table": "payment_surcharge",
  104.             "conditions": [
  105.                 {
  106.                     "column": "collection_detail.surcharge_id",
  107.                     "operator": "=",
  108.                     "value": {
  109.                         "column": "payment_surcharge.id",
  110.                         "type": "raw"
  111.                     }
  112.                 },
  113.                 {
  114.                     "column": "payment_surcharge.deleted_at",
  115.                     "operator": "null"
  116.                 }
  117.             ],
  118.             "type": "left"
  119.         },
  120.         {
  121.             "table": "bank_account",
  122.             "conditions": [
  123.                 {
  124.                     "column": "collection_detail.bank_account_id",
  125.                     "operator": "=",
  126.                     "value": {
  127.                         "column": "bank_account.id",
  128.                         "type": "raw"
  129.                     }
  130.                 },
  131.                 {
  132.                     "column": "bank_account.deleted_at",
  133.                     "operator": "null"
  134.                 }
  135.             ],
  136.             "type": "left"
  137.         },
  138.         {
  139.             "table": "system_code",
  140.             "conditions": [
  141.                 {
  142.                     "column": "bank_account.bank_id",
  143.                     "operator": "=",
  144.                     "value": {
  145.                         "column": "system_code.id",
  146.                         "type": "raw"
  147.                     }
  148.                 },
  149.                 {
  150.                     "column": "system_code.type_id",
  151.                     "operator": "=",
  152.                     "value": "3"
  153.                 },
  154.                 {
  155.                     "column": "system_code.deleted_at",
  156.                     "operator": "null"
  157.                 }
  158.             ],
  159.             "type": "left"
  160.         },
  161.         {
  162.             "table": "branch",
  163.             "conditions": [
  164.                 {
  165.                     "column": "sales_outbound.created_for",
  166.                     "operator": "=",
  167.                     "value": {
  168.                         "column": "branch.id",
  169.                         "type": "raw"
  170.                     }
  171.                 }
  172.             ]
  173.         },
  174.         {
  175.             "table": "branch_detail",
  176.             "conditions": [
  177.                 {
  178.                     "column": "sales_outbound.for_location",
  179.                     "operator": "=",
  180.                     "value": {
  181.                         "column": "branch_detail.id",
  182.                         "type": "raw"
  183.                     }
  184.                 }
  185.             ]
  186.         },
  187.         {
  188.             "table": "product",
  189.             "conditions": [
  190.                 {
  191.                     "column": "sales_outbound_detail.product_id",
  192.                     "operator": "=",
  193.                     "value": {
  194.                         "column": "product.id",
  195.                         "type": "raw"
  196.                     }
  197.                 }
  198.             ]
  199.         },
  200.         {
  201.             "table": "transaction_serial_number",
  202.             "type": "left",
  203.             "conditions": [
  204.                 {
  205.                     "column": "sales_outbound_detail.id",
  206.                     "operator": "=",
  207.                     "value": {
  208.                         "column": "transaction_serial_number.seriable_id",
  209.                         "type": "raw"
  210.                     }
  211.                 },
  212.                 {
  213.                     "column": "transaction_serial_number.seriable_type",
  214.                     "operator": "=",
  215.                     "value": {
  216.                         "column": "'sales_outbound_detail'",
  217.                         "type": "raw"
  218.                     }
  219.                 }
  220.             ]
  221.         },
  222.         {
  223.             "table": "product_serial_number",
  224.             "type": "left",
  225.             "conditions": [
  226.                 {
  227.                     "column": "transaction_serial_number.serial_id",
  228.                     "operator": "=",
  229.                     "value": {
  230.                         "column": "product_serial_number.id",
  231.                         "type": "raw"
  232.                     }
  233.                 }
  234.             ]
  235.         },
  236.         {
  237.             "table": "system_code as brand",
  238.             "conditions": [
  239.                 {
  240.                     "column": "brand.id",
  241.                     "operator": "=",
  242.                     "value": {
  243.                         "column": "product.brand_id",
  244.                         "type": "raw"
  245.                     }
  246.                 },
  247.                 {
  248.                     "column": "brand.type_id",
  249.                     "operator": "=",
  250.                     "value": 1
  251.                 }
  252.             ]
  253.         },
  254.         {
  255.             "table": "category",
  256.             "conditions": [
  257.                 {
  258.                     "column": "category.id",
  259.                     "operator": "=",
  260.                     "value": {
  261.                         "column": "product.category_id",
  262.                         "type": "raw"
  263.                     }
  264.                 }
  265.             ],
  266.             "type": "inner"
  267.         },
  268.         {
  269.             "table": "user",
  270.             "conditions": [
  271.                 {
  272.                     "column": "sales_outbound.salesman_id",
  273.                     "operator": "=",
  274.                     "value": {
  275.                         "column": "[user].[id]",
  276.                         "type": "raw"
  277.                     }
  278.                 }
  279.             ]
  280.         }
  281.     ],
  282.     "where": [
  283.         {
  284.             "column": "sales_outbound.deleted_at",
  285.             "operator": "null"
  286.         },
  287.         {
  288.             "column": "sales_outbound.approval_status",
  289.             "operator": "=",
  290.             "value": {
  291.                 "column": "3",
  292.                 "type": "raw"
  293.             }
  294.         }
  295.     ],
  296.     "groupBy": [
  297.         "sales_outbound.id",
  298.         "sales_outbound_detail.id",
  299.         "branch.name",
  300.         "branch_detail.name",
  301.         "sales_outbound.transaction_date",
  302.         "sales_outbound.sheet_number",
  303.         "product.name",
  304.         "product_serial_number.serial_number",
  305.         "sales_outbound_detail.price",
  306.         "sales_outbound_detail.qty",
  307.         "sales_outbound_detail.unit_qty",
  308.         "user.full_name",
  309.         "sales_outbound.udf_invoice_no_2018_07_26",
  310.         "payment_surcharge.name",
  311.         "system_code.name",
  312.         "bank_account.account_number",
  313.         "bank_account.account_name"
  314.     ],
  315.     "orderBy": {
  316.         "type": "ASC",
  317.         "columns": [
  318.             "sheet_number"
  319.         ]
  320.     }
  321. }
  322.  
  323.  
  324. // Column Settings
  325. {
  326.     "created_for": {
  327.         "header_name": "label.created_for",
  328.         "width": 240,
  329.         "textAlign": "left",
  330.         "type": "1"
  331.     },
  332.     "for_location": {
  333.         "header_name": "label.for_location",
  334.         "width": 240,
  335.         "textAlign": "left",
  336.         "type": "1"
  337.     },
  338.     "transaction_date": {
  339.         "header_name": "label.transaction_date",
  340.         "width": 240,
  341.         "textAlign": "center",
  342.         "type": "1"
  343.     },
  344.     "sheet_number": {
  345.         "header_name": "label.sheet_number",
  346.         "width": 240,
  347.         "textAlign": "center",
  348.         "type": "1"
  349.     },
  350.     "invoice_number": {
  351.         "header_name": "label.invoice_no",
  352.         "width": 150,
  353.         "textAlign": "center",
  354.         "type": "1"
  355.     },
  356.     "product_name": {
  357.         "header_name": "label.product_name",
  358.         "width": 420,
  359.         "textAlign": "left",
  360.         "type": "1"
  361.     },
  362.     "product_serial": {
  363.         "header_name": "label.serial",
  364.         "width": 240,
  365.         "textAlign": "left",
  366.         "type": "1"
  367.     },
  368.     "price": {
  369.         "header_name": "label.price",
  370.         "width": 120,
  371.         "textAlign": "right",
  372.         "type": "2"
  373.     },
  374.     "salesman": {
  375.         "header_name": "label.salesman",
  376.         "width": 240,
  377.         "textAlign": "left",
  378.         "type": "1"
  379.     },
  380.     "collection_detail_bank": {
  381.         "header_name": "label.collection_detail_bank",
  382.         "width": 240,
  383.         "textAlign": "left",
  384.         "type": "1"
  385.     },
  386.     "collection_detail_charge_type": {
  387.         "header_name": "label.collection_detail_charge_type",
  388.         "width": 240,
  389.         "textAlign": "left",
  390.         "type": "1"
  391.     }
  392. }
  393.  
  394.  
  395. // Filters
  396. [
  397.     {
  398.         "name": "label.created_for",
  399.         "columnName": "sales_outbound.created_for",
  400.         "type": "select",
  401.         "selectOptions": "branch",
  402.         "selected": true,
  403.         "default": "current_branch",
  404.         "format": {
  405.             "id": "id",
  406.             "label": "name"
  407.         },
  408.         "freezing": true
  409.     },
  410.     {
  411.         "name": "label.for_location",
  412.         "columnName": "sales_outbound.for_location",
  413.         "type": "select",
  414.         "selectOptions": "location",
  415.         "format": {
  416.             "id": "id",
  417.             "label": "name"
  418.         }
  419.     },
  420.     {
  421.         "name": "label.transaction_date",
  422.         "columnName": "sales_outbound.transaction_date",
  423.         "type": "dateRange",
  424.         "selected": true
  425.     },
  426.     {
  427.         "name": "label.product",
  428.         "columnName": "product.name",
  429.         "type": "string"
  430.     },
  431.     {
  432.         "name": "label.serial_number",
  433.         "columnName": "product_serial_number.serial_number",
  434.         "type": "string"
  435.     },
  436.     {
  437.         "name": "label.stock_no",
  438.         "columnName": "product.stock_no",
  439.         "type": "string"
  440.     },
  441.     {
  442.         "name": "label.product_brand",
  443.         "columnName": "brand.name",
  444.         "type": "string",
  445.         "optionBool": true,
  446.         "tableOptions": {
  447.             "data": "brand",
  448.             "headers": [
  449.                 "Code",
  450.                 "Name"
  451.             ],
  452.             "columns": [
  453.                 "code",
  454.                 "name"
  455.             ],
  456.             "returncolumn": "name"
  457.         }
  458.     },
  459.     {
  460.         "name": "label.category_tag",
  461.         "columnName": "category.tag_id",
  462.         "type": "categoryTag",
  463.         "optionBool": true,
  464.         "title": "label.category_filter",
  465.         "tableOptions": {
  466.             "data": "category"
  467.         }
  468.     }
  469. ]
  470.  
  471.  
  472. // Footers
  473. []
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement