Skip to content

Instantly share code, notes, and snippets.

View itsyosefali's full-sized avatar
🥱
Focusing

Yosef Ali itsyosefali

🥱
Focusing
View GitHub Profile
@itsyosefali
itsyosefali / script.py
Created January 1, 2023 09:03
Sql Report
sql_date_cond = ""
if filters.get("date_from") and filters.get("date_to"):
date_from = frappe.db.escape(filters.get("date_from"))
date_to = frappe.db.escape(filters.get("date_to"))
sql_date_cond = f"""and posting_date between {date_from} and {date_to} """
elif filters.get("date_from"):
date_from = frappe.db.escape(filters.get("date_from"))
sql_date_cond = f"""and posting_date >= {date_from}"""
cd Desktop
#create file for the git.
mkdir <file name>
cd <file name>
# start git in the file
git init
@itsyosefali
itsyosefali / scriptreport.py
Last active January 8, 2023 12:09
تقرير لل سبونج شايب لي شركة الربيع
sql_item_code_cond_filter = ""
if filters.get("item_code"):
escaped_input = frappe.db.escape(filters.get("item_code"))
sql_item_code_cond_filter = f"AND `tabStock Ledger Entry`.item_code = {escaped_input}"
sql_sponge_shape=""
if filters.get("sponge_shape"):
escaped_input = frappe.db.escape(filters.get("sponge_shape"))
sql_item_code_cond_filter = f"AND `tabStock Ledger Entry`.sponge_shape = {escaped_input}"
@itsyosefali
itsyosefali / Daily Sales Summry.py
Last active January 8, 2023 12:08
تقرير المبيعات اليومي
branch=""
if filters.get("branch"):
escaped_input = frappe.db.escape(filters.get("branch"))
branch = f" Where `tabSales Invoice`.branch = {escaped_input}"
mode_of_payment=""
if filters.get("mode_of_payment"):
escaped_input = frappe.db.escape(filters.get("mode_of_payment"))
mode_of_payment = f" AND `tabPayment Entry`.mode_of_payment = {escaped_input}"
@itsyosefali
itsyosefali / Time.py
Last active January 8, 2023 12:08
فلتر حسب الوقت
sql_date_cond = ""
if filters.get("date_from") and filters.get("date_to"):
date_from = frappe.db.escape(filters.get("date_from"))
date_to = frappe.db.escape(filters.get("date_to"))
sql_date_cond = f"""and posting_date between {date_from} and {date_to} """
elif filters.get("date_from"):
date_from = frappe.db.escape(filters.get("date_from"))
@itsyosefali
itsyosefali / GlEntry.py
Last active January 8, 2023 11:58
تقرير حركة الخزينة
sql_account_filter = ""
if filters.get("account"):
escaped_input = frappe.db.escape(filters.get("account"))
sql_account_filter = f"AND `tabGL Entry`.account = {escaped_input}"
sql_date_cond = ""
if filters.get("date_from") and filters.get("date_to"):
date_from = frappe.db.escape(filters.get("date_from"))
date_to = frappe.db.escape(filters.get("date_to"))
frappe.query_reports["Gl Entry Report"] = {
"filters": [
{
"fieldname":"account",
"label": __("Account"),
"fieldtype": "Link",
"options": "Account",
"reqd": 1,
"width": "80",
get_query: function() {
@itsyosefali
itsyosefali / ItemGroup.sql
Last active January 8, 2023 12:06
تقرير تثبيت ال item group بناء على حركة المبيعات وفقا للcost center
select
`tabSales Invoice`.branch,
sum(case when `tabItem`.item_group = 'موكيت' then `tabSales Invoice Item`.qty else 0 end) AS موكيت,
sum(case when `tabItem`.item_group = 'ممرات' then `tabSales Invoice Item`.qty else 0 end) as 'ممرات',
sum(case when `tabItem`.item_group = 'كولا' then `tabSales Invoice Item`.qty else 0 end) as كولا,
sum(case when `tabItem`.item_group = 'سجاد' then `tabSales Invoice Item`.qty else 0 end) as 'سجاد',
sum(case when `tabItem`.item_group = 'دواسات' then `tabSales Invoice Item`.qty else 0 end) as دواسات
from `tabSales Invoice Item`
INNER JOIN `tabSales Invoice`
on `tabSales Invoice`.name = `tabSales Invoice Item`.parent
parent_warehouse=""
if filters.get("parent_warehouse"):
escaped_input = frappe.db.escape(filters.get("parent_warehouse"))
parent_warehouse = f" WHERE `tabWarehouse`.parent_warehouse = {escaped_input}"
item_code=""
if filters.get("item_code"):
escaped_input = frappe.db.escape(filters.get("item_code"))
item_code = f" AND `tabBin`.item_code = {escaped_input}"
@itsyosefali
itsyosefali / Test-For-Coustomer.py
Last active January 10, 2023 12:59
الديون
party=""
if filters.get("party"):
escaped_input = frappe.db.escape(filters.get("party"))
party = f" AND `tabGL Entry`.party = {escaped_input}"
default_sales_partner=""
if filters.get("default_sales_partner"):
escaped_input = frappe.db.escape(filters.get("default_sales_partner"))
default_sales_partner = f" AND `tabCustomer`.default_sales_partner = {escaped_input}"
res = frappe.db.sql(f"""SELECT