{
 "id": "livestock-dairy-farm",
 "file": "softwiro-livestock-dairy-farm.xlsx",
 "title": "شيت مزرعة المواشي والألبان: القطيع والحليب والأعلاف والولادات",
 "language": "ar",
 "direction": "rtl",
 "how_it_works": "White cells are typed input; cells whose kind is \"formula\" are calculated and must not be overwritten. Add one record per row under the header row of a record table, keeping the columns in order.",
 "sheets": [
  {
   "name": "ابدأ هنا",
   "formula_cells": 0
  },
  {
   "name": "الإعدادات",
   "formula_cells": 0,
   "record_tables": [
    {
     "header_row": 11,
     "first_record_row": 12,
     "sample_rows_filled": 10,
     "capacity_last_row": 25,
     "columns": [
      {
       "column": "A",
       "header": "النوع",
       "kind": "input",
       "examples": [
        "بقر",
        "جاموس",
        "ضأن"
       ]
      },
      {
       "column": "B",
       "header": "مدة الحمل (يوم)",
       "kind": "input",
       "examples": [
        283,
        310,
        150
       ]
      },
      {
       "column": "C",
       "header": "ملاحظة",
       "kind": "input",
       "examples": [
        "قيمة إرشادية للمثال، عدّلها",
        "قيمة إرشادية للمثال، عدّلها",
        "قيمة إرشادية للمثال، عدّلها"
       ]
      }
     ]
    }
   ],
   "settings": [
    {
     "label": "تاريخ اليوم",
     "cell": "B4",
     "value": "2026-11-15"
    },
    {
     "label": "أول شهر في «الربح الشهري»",
     "cell": "B5",
     "value": "2026-10-01"
    },
    {
     "label": "تنبيه الولادة القريبة خلال (يوم)",
     "cell": "B6",
     "value": 30
    },
    {
     "label": "تنبيه موعد البيطري القريب خلال (يوم)",
     "cell": "B7",
     "value": 14
    },
    {
     "label": "أيام الشهر لتكلفة العلائق",
     "cell": "B8",
     "value": 30
    }
   ]
  },
  {
   "name": "القطيع",
   "formula_cells": 1500,
   "record_tables": [
    {
     "header_row": 5,
     "first_record_row": 6,
     "sample_rows_filled": 21,
     "capacity_last_row": 305,
     "columns": [
      {
       "column": "A",
       "header": "رقم الحيوان",
       "kind": "input",
       "examples": [
        "ب101",
        "ب102",
        "ب103"
       ]
      },
      {
       "column": "B",
       "header": "النوع",
       "kind": "input",
       "examples": [
        "بقر",
        "بقر",
        "بقر"
       ],
       "allowed_values": {
        "from_range": "'الإعدادات'!$A$12:$A$17"
       }
      },
      {
       "column": "C",
       "header": "السلالة",
       "kind": "input",
       "examples": [
        "فريزيان",
        "فريزيان",
        "مخلط"
       ]
      },
      {
       "column": "D",
       "header": "تاريخ الميلاد",
       "kind": "input",
       "examples": [
        "2020-03-12",
        "2019-11-05",
        "2021-02-20"
       ]
      },
      {
       "column": "E",
       "header": "الجنس",
       "kind": "input",
       "examples": [
        "أنثى",
        "أنثى",
        "أنثى"
       ],
       "allowed_values": [
        "أنثى",
        "ذكر"
       ]
      },
      {
       "column": "F",
       "header": "المجموعة",
       "kind": "input",
       "examples": [
        "الحلابة",
        "الحلابة",
        "الحلابة"
       ],
       "allowed_values": {
        "from_range": "'الإعدادات'!$A$21:$A$28"
       }
      },
      {
       "column": "G",
       "header": "الحالة",
       "kind": "input",
       "examples": [
        "حلاب",
        "حلاب",
        "حلاب"
       ],
       "allowed_values": [
        "حلاب",
        "جافة",
        "حامل",
        "تسمين",
        "تربية",
        "مباع",
        "نافق"
       ]
      },
      {
       "column": "H",
       "header": "تاريخ الشراء",
       "kind": "input",
       "examples": [
        "2022-04-10",
        "2021-06-01",
        "2023-01-15"
       ]
      },
      {
       "column": "I",
       "header": "تكلفة الشراء",
       "kind": "input",
       "examples": [
        52000,
        48000,
        45000
       ]
      },
      {
       "column": "J",
       "header": "العمر (شهر)",
       "kind": "formula",
       "formula_row_1": "=IF(OR(A6&\"\"=\"\",NOT(ISNUMBER(D6))),\"\",MAX(0,INT(('الإعدادات'!$B$4-D6)/30.4375)))"
      },
      {
       "column": "K",
       "header": "حليبه المسجل (لتر)",
       "kind": "formula",
       "formula_row_1": "=IF(A6&\"\"=\"\",\"\",SUMIFS('سجل الحليب'!$G$6:$G$3005,'سجل الحليب'!$B$6:$B$3005,A6&\"\"))"
      },
      {
       "column": "L",
       "header": "تكلفة بيطري",
       "kind": "formula",
       "formula_row_1": "=IF(A6&\"\"=\"\",\"\",SUMIFS('البيطري'!$E$6:$E$1005,'البيطري'!$B$6:$B$1005,A6&\"\"))"
      },
      {
       "column": "M",
       "header": "سعر بيعه",
       "kind": "formula",
       "formula_row_1": "=IF(A6&\"\"=\"\",\"\",SUMIFS('مبيعات الحيوانات'!$E$6:$E$505,'مبيعات الحيوانات'!$B$6:$B$505,A6&\"\"))"
      },
      {
       "column": "N",
       "header": "تنبيه",
       "kind": "formula",
       "formula_row_1": "=IF(A6&\"\"=\"\",\"\",IF(COUNTIF($A$6:$A$305,A6&\"\")>1,\"رقم مكرر\",IF(AND(M6>0,G6<>\"مباع\"),\"سُجّل بيعه والحالة ليست مباع\",IF(AND(G6=\"مباع\",M6=0),\"مباع بلا تسجيل بيع\",\"\"))))"
      }
     ]
    }
   ]
  },
  {
   "name": "سجل الحليب",
   "formula_cells": 6000,
   "record_tables": [
    {
     "header_row": 5,
     "first_record_row": 6,
     "sample_rows_filled": 70,
     "capacity_last_row": 3005,
     "columns": [
      {
       "column": "A",
       "header": "التاريخ",
       "kind": "input",
       "examples": [
        "2026-10-01",
        "2026-10-02",
        "2026-10-03"
       ]
      },
      {
       "column": "B",
       "header": "رقم الحيوان",
       "kind": "input",
       "allowed_values": {
        "from_range": "'القطيع'!$A$6:$A$305"
       }
      },
      {
       "column": "C",
       "header": "أو المجموعة",
       "kind": "input",
       "examples": [
        "الحلابة",
        "الحلابة",
        "الحلابة"
       ],
       "allowed_values": {
        "from_range": "'الإعدادات'!$A$21:$A$28"
       }
      },
      {
       "column": "D",
       "header": "الصباح (لتر)",
       "kind": "input",
       "examples": [
        38,
        39,
        40
       ]
      },
      {
       "column": "E",
       "header": "المساء (لتر)",
       "kind": "input",
       "examples": [
        33,
        34,
        35
       ]
      },
      {
       "column": "F",
       "header": "ملاحظة",
       "kind": "input"
      },
      {
       "column": "G",
       "header": "الإجمالي (لتر)",
       "kind": "formula",
       "formula_row_1": "=IF(AND(D6&\"\"=\"\",E6&\"\"=\"\"),\"\",N(D6)+N(E6))"
      },
      {
       "column": "H",
       "header": "تنبيه",
       "kind": "formula",
       "formula_row_1": "=IF(AND(D6&\"\"=\"\",E6&\"\"=\"\"),\"\",IF(AND(B6&\"\"=\"\",C6&\"\"=\"\"),\"حدد الحيوان أو المجموعة\",IF(AND(B6&\"\"<>\"\",COUNTIF('القطيع'!$A$6:$A$305,B6&\"\")=0),\"رقم غير موجود\",IF(AND(B6&\"\"=\"\",COUNTIF('الإعدادات'!$A$21:$A$28,C6&\"\")=0),\"مجموعة غير معرّفة\",\"\"))))"
      }
     ]
    }
   ]
  },
  {
   "name": "مبيعات الحليب",
   "formula_cells": 3000,
   "record_tables": [
    {
     "header_row": 5,
     "first_record_row": 6,
     "sample_rows_filled": 15,
     "capacity_last_row": 1005,
     "columns": [
      {
       "column": "A",
       "header": "التاريخ",
       "kind": "input",
       "examples": [
        "2026-10-03",
        "2026-10-06",
        "2026-10-09"
       ]
      },
      {
       "column": "B",
       "header": "مركز التجميع",
       "kind": "input",
       "examples": [
        "مركز تجميع الشروق",
        "مركز تجميع الشروق",
        "مركز تجميع الشروق"
       ]
      },
      {
       "column": "C",
       "header": "الكمية (لتر)",
       "kind": "input",
       "examples": [
        208,
        209,
        209
       ]
      },
      {
       "column": "D",
       "header": "سعر اللتر",
       "kind": "input",
       "examples": [
        22,
        22,
        22
       ]
      },
      {
       "column": "E",
       "header": "نسبة الدهن %",
       "kind": "input",
       "examples": [
        3.6,
        3.8,
        3.7
       ]
      },
      {
       "column": "F",
       "header": "المدفوع",
       "kind": "input",
       "examples": [
        4576,
        4598,
        4598
       ]
      },
      {
       "column": "G",
       "header": "ملاحظة",
       "kind": "input"
      },
      {
       "column": "H",
       "header": "المبلغ",
       "kind": "formula",
       "formula_row_1": "=IF(OR(C6&\"\"=\"\",D6&\"\"=\"\"),\"\",ROUND(C6*D6,2))"
      },
      {
       "column": "I",
       "header": "المتبقي",
       "kind": "formula",
       "formula_row_1": "=IF(H6=\"\",\"\",ROUND(H6-N(F6),2))"
      },
      {
       "column": "J",
       "header": "تنبيه",
       "kind": "formula",
       "formula_row_1": "=IF(H6=\"\",\"\",IF(N(F6)>H6,\"المدفوع أكبر من المبلغ\",\"\"))"
      }
     ]
    }
   ]
  },
  {
   "name": "أصناف الأعلاف",
   "formula_cells": 80,
   "record_tables": [
    {
     "header_row": 5,
     "first_record_row": 6,
     "sample_rows_filled": 8,
     "capacity_last_row": 45,
     "columns": [
      {
       "column": "A",
       "header": "الصنف",
       "kind": "input",
       "examples": [
        "برسيم أخضر",
        "تبن",
        "سيلاج ذرة"
       ]
      },
      {
       "column": "B",
       "header": "الوحدة",
       "kind": "input",
       "examples": [
        "كجم",
        "كجم",
        "كجم"
       ]
      },
      {
       "column": "C",
       "header": "السعر للوحدة",
       "kind": "input",
       "examples": [
        2.2,
        5,
        3.5
       ]
      },
      {
       "column": "D",
       "header": "ملاحظة",
       "kind": "input"
      },
      {
       "column": "E",
       "header": "الكمية المشتراة",
       "kind": "formula",
       "formula_row_1": "=IF(A6&\"\"=\"\",\"\",SUMIFS('مشتريات الأعلاف'!$C$6:$C$1005,'مشتريات الأعلاف'!$B$6:$B$1005,A6&\"\"))"
      },
      {
       "column": "F",
       "header": "قيمة المشتريات",
       "kind": "formula",
       "formula_row_1": "=IF(A6&\"\"=\"\",\"\",SUMIFS('مشتريات الأعلاف'!$F$6:$F$1005,'مشتريات الأعلاف'!$B$6:$B$1005,A6&\"\"))"
      }
     ]
    }
   ]
  },
  {
   "name": "العلائق",
   "formula_cells": 480,
   "record_tables": [
    {
     "header_row": 5,
     "first_record_row": 6,
     "sample_rows_filled": 16,
     "capacity_last_row": 85,
     "columns": [
      {
       "column": "A",
       "header": "المجموعة",
       "kind": "input",
       "examples": [
        "الحلابة",
        "الحلابة",
        "الحلابة"
       ],
       "allowed_values": {
        "from_range": "'الإعدادات'!$A$21:$A$28"
       }
      },
      {
       "column": "B",
       "header": "الصنف",
       "kind": "input",
       "examples": [
        "برسيم أخضر",
        "تبن",
        "علف مركز للحلابة"
       ],
       "allowed_values": {
        "from_range": "'أصناف الأعلاف'!$A$6:$A$45"
       }
      },
      {
       "column": "C",
       "header": "كجم للرأس في اليوم",
       "kind": "input",
       "examples": [
        25,
        3,
        6
       ]
      },
      {
       "column": "D",
       "header": "سعر الكيلو",
       "kind": "formula",
       "formula_row_1": "=IF(B6&\"\"=\"\",\"\",IFERROR(INDEX('أصناف الأعلاف'!$C$6:$C$45,MATCH(B6&\"\",'أصناف الأعلاف'!$A$6:$A$45,0)),\"\"))"
      },
      {
       "column": "E",
       "header": "تكلفة الرأس يوميًا",
       "kind": "formula",
       "formula_row_1": "=IF(OR(C6&\"\"=\"\",D6=\"\"),\"\",ROUND(C6*D6,2))"
      },
      {
       "column": "F",
       "header": "عدد الرؤوس",
       "kind": "formula",
       "formula_row_1": "=IF(A6&\"\"=\"\",\"\",COUNTIFS('القطيع'!$F$6:$F$305,A6&\"\")-COUNTIFS('القطيع'!$F$6:$F$305,A6&\"\",'القطيع'!$G$6:$G$305,\"مباع\")-COUNTIFS('القطيع'!$F$6:$F$305,A6&\"\",'القطيع'!$G$6:$G$305,\"نافق\"))"
      },
      {
       "column": "G",
       "header": "تكلفة المجموعة يوميًا",
       "kind": "formula",
       "formula_row_1": "=IF(OR(E6=\"\",F6=\"\"),\"\",ROUND(E6*F6,2))"
      },
      {
       "column": "H",
       "header": "تكلفة الشهر",
       "kind": "formula",
       "formula_row_1": "=IF(G6=\"\",\"\",ROUND(G6*'الإعدادات'!$B$8,2))"
      },
      {
       "column": "I",
       "header": "تنبيه",
       "kind": "formula",
       "formula_row_1": "=IF(B6&\"\"=\"\",\"\",IF(D6=\"\",\"صنف غير موجود في الأصناف\",\"\"))"
      }
     ]
    }
   ]
  },
  {
   "name": "مشتريات الأعلاف",
   "formula_cells": 2000,
   "record_tables": [
    {
     "header_row": 5,
     "first_record_row": 6,
     "sample_rows_filled": 12,
     "capacity_last_row": 1005,
     "columns": [
      {
       "column": "A",
       "header": "التاريخ",
       "kind": "input",
       "examples": [
        "2026-10-02",
        "2026-10-04",
        "2026-10-09"
       ]
      },
      {
       "column": "B",
       "header": "الصنف",
       "kind": "input",
       "examples": [
        "علف مركز للحلابة",
        "علف تسمين",
        "تبن"
       ],
       "allowed_values": {
        "from_range": "'أصناف الأعلاف'!$A$6:$A$45"
       }
      },
      {
       "column": "C",
       "header": "الكمية",
       "kind": "input",
       "examples": [
        1400,
        500,
        1000
       ]
      },
      {
       "column": "D",
       "header": "سعر الوحدة",
       "kind": "input",
       "examples": [
        14,
        13,
        5
       ]
      },
      {
       "column": "E",
       "header": "الغرض",
       "kind": "input",
       "examples": [
        "الحلابة",
        "التسمين",
        "الحلابة"
       ],
       "allowed_values": [
        "الحلابة",
        "التسمين",
        "أخرى"
       ]
      },
      {
       "column": "F",
       "header": "التكلفة",
       "kind": "formula",
       "formula_row_1": "=IF(OR(C6&\"\"=\"\",D6&\"\"=\"\"),\"\",ROUND(C6*D6,2))"
      },
      {
       "column": "G",
       "header": "تنبيه",
       "kind": "formula",
       "formula_row_1": "=IF(B6&\"\"=\"\",\"\",IF(COUNTIF('أصناف الأعلاف'!$A$6:$A$45,B6&\"\")=0,\"صنف غير موجود\",\"\"))"
      }
     ]
    }
   ]
  },
  {
   "name": "التلقيح",
   "formula_cells": 2500,
   "record_tables": [
    {
     "header_row": 5,
     "first_record_row": 6,
     "sample_rows_filled": 9,
     "capacity_last_row": 505,
     "columns": [
      {
       "column": "A",
       "header": "تاريخ التلقيح",
       "kind": "input",
       "examples": [
        "2025-12-28",
        "2026-01-05",
        "2026-02-10"
       ]
      },
      {
       "column": "B",
       "header": "رقم الحيوان",
       "kind": "input",
       "examples": [
        "ب102",
        "ج201",
        "ب104"
       ],
       "allowed_values": {
        "from_range": "'القطيع'!$A$6:$A$305"
       }
      },
      {
       "column": "C",
       "header": "الطريقة",
       "kind": "input",
       "examples": [
        "تلقيح صناعي",
        "تلقيح صناعي",
        "تلقيح صناعي"
       ],
       "allowed_values": [
        "تلقيح صناعي",
        "تلقيح طبيعي"
       ]
      },
      {
       "column": "D",
       "header": "الذكر / القش",
       "kind": "input",
       "examples": [
        "قش منوي أ",
        "قش منوي ب",
        "قش منوي أ"
       ]
      },
      {
       "column": "E",
       "header": "النتيجة",
       "kind": "input",
       "examples": [
        "حامل",
        "حامل",
        "حامل"
       ],
       "allowed_values": [
        "حامل",
        "غير حامل",
        "لم يُفحص"
       ]
      },
      {
       "column": "F",
       "header": "التكلفة",
       "kind": "input",
       "examples": [
        450,
        450,
        450
       ]
      },
      {
       "column": "G",
       "header": "النوع",
       "kind": "formula",
       "formula_row_1": "=IF(B6&\"\"=\"\",\"\",IFERROR(INDEX('القطيع'!$B$6:$B$305,MATCH(B6&\"\",'القطيع'!$A$6:$A$305,0)),\"\"))"
      },
      {
       "column": "H",
       "header": "مدة الحمل",
       "kind": "formula",
       "formula_row_1": "=IF(G6=\"\",\"\",IFERROR(INDEX('الإعدادات'!$B$12:$B$17,MATCH(G6,'الإعدادات'!$A$12:$A$17,0)),\"\"))"
      },
      {
       "column": "I",
       "header": "الولادة المتوقعة",
       "kind": "formula",
       "formula_row_1": "=IF(OR(H6=\"\",NOT(ISNUMBER(A6))),\"\",A6+H6)"
      },
      {
       "column": "J",
       "header": "متبقي (يوم)",
       "kind": "formula",
       "formula_row_1": "=IF(I6=\"\",\"\",I6-'الإعدادات'!$B$4)"
      },
      {
       "column": "K",
       "header": "الحالة",
       "kind": "formula",
       "formula_row_1": "=IF(B6&\"\"=\"\",\"\",IF(E6=\"غير حامل\",\"غير حامل\",IF(COUNTIFS('الولادات'!$B$6:$B$505,B6&\"\",'الولادات'!$A$6:$A$505,\">=\"&A6)>0,\"ولدت\",IF(E6=\"لم يُفحص\",\"بانتظار الفحص\",IF(I6=\"\",\"راجع النوع\",IF(J6<0,\"متأخرة\",IF(J6<='الإعدادات'!$B$6,\"قريبة\",\"حامل\")))))))"
      }
     ]
    }
   ]
  },
  {
   "name": "الولادات",
   "formula_cells": 1000,
   "record_tables": [
    {
     "header_row": 5,
     "first_record_row": 6,
     "sample_rows_filled": 3,
     "capacity_last_row": 505,
     "columns": [
      {
       "column": "A",
       "header": "تاريخ الولادة",
       "kind": "input",
       "examples": [
        "2026-10-05",
        "2026-10-14",
        "2026-11-02"
       ]
      },
      {
       "column": "B",
       "header": "رقم الأم",
       "kind": "input",
       "examples": [
        "ب102",
        "م601",
        "ج201"
       ],
       "allowed_values": {
        "from_range": "'القطيع'!$A$6:$A$305"
       }
      },
      {
       "column": "C",
       "header": "رقم المولود",
       "kind": "input",
       "examples": [
        "ب109",
        "م602",
        "ج204"
       ]
      },
      {
       "column": "D",
       "header": "الجنس",
       "kind": "input",
       "examples": [
        "أنثى",
        "ذكر",
        "ذكر"
       ],
       "allowed_values": [
        "أنثى",
        "ذكر"
       ]
      },
      {
       "column": "E",
       "header": "وزن الميلاد (كجم)",
       "kind": "input",
       "examples": [
        36,
        3.2,
        40
       ]
      },
      {
       "column": "F",
       "header": "الحالة",
       "kind": "input",
       "examples": [
        "حي",
        "حي",
        "حي"
       ],
       "allowed_values": [
        "حي",
        "نافق"
       ]
      },
      {
       "column": "G",
       "header": "ملاحظة",
       "kind": "input"
      },
      {
       "column": "H",
       "header": "نوع الأم",
       "kind": "formula",
       "formula_row_1": "=IF(B6&\"\"=\"\",\"\",IFERROR(INDEX('القطيع'!$B$6:$B$305,MATCH(B6&\"\",'القطيع'!$A$6:$A$305,0)),\"\"))"
      },
      {
       "column": "I",
       "header": "تنبيه",
       "kind": "formula",
       "formula_row_1": "=IF(B6&\"\"=\"\",\"\",IF(COUNTIF('القطيع'!$A$6:$A$305,B6&\"\")=0,\"رقم الأم غير موجود\",IF(AND(C6&\"\"<>\"\",COUNTIF('القطيع'!$A$6:$A$305,C6&\"\")=0),\"سجّل المولود في القطيع\",IF(AND(F6=\"حي\",C6&\"\"=\"\"),\"اكتب رقم المولود\",\"\"))))"
      }
     ]
    }
   ]
  },
  {
   "name": "البيطري",
   "formula_cells": 2000,
   "record_tables": [
    {
     "header_row": 5,
     "first_record_row": 6,
     "sample_rows_filled": 8,
     "capacity_last_row": 1005,
     "columns": [
      {
       "column": "A",
       "header": "التاريخ",
       "kind": "input",
       "examples": [
        "2026-10-03",
        "2026-10-10",
        "2026-10-12"
       ]
      },
      {
       "column": "B",
       "header": "رقم الحيوان أو «القطيع»",
       "kind": "input",
       "examples": [
        "القطيع",
        "ت401",
        "ب103"
       ],
       "allowed_values": {
        "from_range": "'القطيع'!$A$6:$A$305"
       }
      },
      {
       "column": "C",
       "header": "النوع",
       "kind": "input",
       "examples": [
        "تحصين",
        "تحصين",
        "علاج"
       ],
       "allowed_values": [
        "تحصين",
        "فحص",
        "علاج",
        "تقليم وعناية",
        "أخرى"
       ]
      },
      {
       "column": "D",
       "header": "البيان",
       "kind": "input",
       "examples": [
        "تحصين دوري حسب برنامج الطبيب البيطري",
        "تحصين حسب برنامج الطبيب",
        "علاج حسب وصفة الطبيب البيطري"
       ]
      },
      {
       "column": "E",
       "header": "التكلفة",
       "kind": "input",
       "examples": [
        3200,
        450,
        650
       ]
      },
      {
       "column": "F",
       "header": "الموعد القادم",
       "kind": "input",
       "examples": [
        "2027-04-03",
        "2026-11-10",
        "2026-11-25"
       ]
      },
      {
       "column": "G",
       "header": "نوع الحيوان",
       "kind": "formula",
       "formula_row_1": "=IF(OR(B6&\"\"=\"\",B6=\"القطيع\"),\"\",IFERROR(INDEX('القطيع'!$B$6:$B$305,MATCH(B6&\"\",'القطيع'!$A$6:$A$305,0)),\"\"))"
      },
      {
       "column": "H",
       "header": "تنبيه الموعد",
       "kind": "formula",
       "formula_row_1": "=IF(B6&\"\"=\"\",\"\",IF(AND(B6<>\"القطيع\",COUNTIF('القطيع'!$A$6:$A$305,B6&\"\")=0),\"رقم غير موجود\",IF(NOT(ISNUMBER(F6)),\"\",IF(COUNTIFS('البيطري'!$B$6:$B$1005,B6&\"\",'البيطري'!$C$6:$C$1005,C6&\"\",'البيطري'!$A$6:$A$1005,\">\"&A6)>0,\"\",IF(F6<'الإعدادات'!$B$4,\"متأخر\",IF(F6<='الإعدادات'!$B$4+'الإعدادات'!$B$7,\"قريب\",\"\"))))))"
      }
     ]
    }
   ]
  },
  {
   "name": "الأوزان",
   "formula_cells": 3000,
   "record_tables": [
    {
     "header_row": 5,
     "first_record_row": 6,
     "sample_rows_filled": 13,
     "capacity_last_row": 1005,
     "columns": [
      {
       "column": "A",
       "header": "التاريخ",
       "kind": "input",
       "examples": [
        "2026-10-01",
        "2026-10-01",
        "2026-10-01"
       ]
      },
      {
       "column": "B",
       "header": "رقم الحيوان",
       "kind": "input",
       "examples": [
        "ت401",
        "ت402",
        "ت403"
       ],
       "allowed_values": {
        "from_range": "'القطيع'!$A$6:$A$305"
       }
      },
      {
       "column": "C",
       "header": "الوزن (كجم)",
       "kind": "input",
       "examples": [
        205,
        196,
        171
       ]
      },
      {
       "column": "D",
       "header": "ملاحظة",
       "kind": "input"
      },
      {
       "column": "E",
       "header": "أول وزن؟",
       "kind": "formula",
       "formula_row_1": "=IF(OR(B6&\"\"=\"\",NOT(ISNUMBER(A6))),\"\",IF(COUNTIFS($B$6:$B$1005,B6&\"\",$A$6:$A$1005,\"<\"&A6)=0,1,0))"
      },
      {
       "column": "F",
       "header": "آخر وزن؟",
       "kind": "formula",
       "formula_row_1": "=IF(OR(B6&\"\"=\"\",NOT(ISNUMBER(A6))),\"\",IF(COUNTIFS($B$6:$B$1005,B6&\"\",$A$6:$A$1005,\">\"&A6)=0,1,0))"
      },
      {
       "column": "G",
       "header": "تنبيه",
       "kind": "formula",
       "formula_row_1": "=IF(B6&\"\"=\"\",\"\",IF(COUNTIF('القطيع'!$A$6:$A$305,B6&\"\")=0,\"رقم غير موجود\",\"\"))"
      }
     ]
    }
   ]
  },
  {
   "name": "التسمين",
   "formula_cells": 720,
   "record_tables": [
    {
     "header_row": 5,
     "first_record_row": 6,
     "sample_rows_filled": 5,
     "capacity_last_row": 65,
     "columns": [
      {
       "column": "A",
       "header": "رقم الحيوان",
       "kind": "input",
       "examples": [
        "ت401",
        "ت402",
        "ت403"
       ],
       "allowed_values": {
        "from_range": "'القطيع'!$A$6:$A$305"
       }
      },
      {
       "column": "B",
       "header": "المجموعة",
       "kind": "formula",
       "formula_row_1": "=IF(A6&\"\"=\"\",\"\",IFERROR(INDEX('القطيع'!$F$6:$F$305,MATCH(A6&\"\",'القطيع'!$A$6:$A$305,0)),\"\"))"
      },
      {
       "column": "C",
       "header": "تكلفة علف الرأس يوميًا",
       "kind": "formula",
       "formula_row_1": "=IF(OR(A6&\"\"=\"\",B6=\"\"),\"\",SUMIFS('العلائق'!$E$6:$E$85,'العلائق'!$A$6:$A$85,B6))"
      },
      {
       "column": "D",
       "header": "تاريخ أول وزن",
       "kind": "formula",
       "formula_row_1": "=IF(OR(A6&\"\"=\"\",COUNTIFS('الأوزان'!$B$6:$B$1005,A6&\"\")=0),\"\",SUMIFS('الأوزان'!$A$6:$A$1005,'الأوزان'!$B$6:$B$1005,A6&\"\",'الأوزان'!$E$6:$E$1005,1))"
      },
      {
       "column": "E",
       "header": "أول وزن",
       "kind": "formula",
       "formula_row_1": "=IF(OR(A6&\"\"=\"\",COUNTIFS('الأوزان'!$B$6:$B$1005,A6&\"\")=0),\"\",SUMIFS('الأوزان'!$C$6:$C$1005,'الأوزان'!$B$6:$B$1005,A6&\"\",'الأوزان'!$E$6:$E$1005,1))"
      },
      {
       "column": "F",
       "header": "تاريخ آخر وزن",
       "kind": "formula",
       "formula_row_1": "=IF(OR(A6&\"\"=\"\",COUNTIFS('الأوزان'!$B$6:$B$1005,A6&\"\")=0),\"\",SUMIFS('الأوزان'!$A$6:$A$1005,'الأوزان'!$B$6:$B$1005,A6&\"\",'الأوزان'!$F$6:$F$1005,1))"
      },
      {
       "column": "G",
       "header": "آخر وزن",
       "kind": "formula",
       "formula_row_1": "=IF(OR(A6&\"\"=\"\",COUNTIFS('الأوزان'!$B$6:$B$1005,A6&\"\")=0),\"\",SUMIFS('الأوزان'!$C$6:$C$1005,'الأوزان'!$B$6:$B$1005,A6&\"\",'الأوزان'!$F$6:$F$1005,1))"
      },
      {
       "column": "H",
       "header": "الأيام",
       "kind": "formula",
       "formula_row_1": "=IF(D6=\"\",\"\",F6-D6)"
      },
      {
       "column": "I",
       "header": "الزيادة (كجم)",
       "kind": "formula",
       "formula_row_1": "=IF(D6=\"\",\"\",ROUND(G6-E6,1))"
      },
      {
       "column": "J",
       "header": "الزيادة اليومية",
       "kind": "formula",
       "formula_row_1": "=IF(OR(D6=\"\",N(H6)<=0),\"\",ROUND(I6/H6,3))"
      },
      {
       "column": "K",
       "header": "علف الفترة",
       "kind": "formula",
       "formula_row_1": "=IF(OR(D6=\"\",C6=\"\"),\"\",ROUND(H6*C6,2))"
      },
      {
       "column": "L",
       "header": "تكلفة الشراء",
       "kind": "formula",
       "formula_row_1": "=IF(A6&\"\"=\"\",\"\",IFERROR(INDEX('القطيع'!$I$6:$I$305,MATCH(A6&\"\",'القطيع'!$A$6:$A$305,0)),\"\"))"
      },
      {
       "column": "M",
       "header": "تكلفة كيلو الزيادة",
       "kind": "formula",
       "formula_row_1": "=IF(OR(K6=\"\",N(I6)<=0),\"\",ROUND(K6/I6,2))"
      }
     ]
    }
   ]
  },
  {
   "name": "مبيعات الحيوانات",
   "formula_cells": 3000,
   "record_tables": [
    {
     "header_row": 5,
     "first_record_row": 6,
     "sample_rows_filled": 2,
     "capacity_last_row": 505,
     "columns": [
      {
       "column": "A",
       "header": "التاريخ",
       "kind": "input",
       "examples": [
        "2026-10-18",
        "2026-11-08"
       ]
      },
      {
       "column": "B",
       "header": "رقم الحيوان",
       "kind": "input",
       "examples": [
        "ب107",
        "ت404"
       ],
       "allowed_values": {
        "from_range": "'القطيع'!$A$6:$A$305"
       }
      },
      {
       "column": "C",
       "header": "المشتري",
       "kind": "input",
       "examples": [
        "تاجر الماشية الحاج سعيد",
        "مزرعة الأمل للتسمين"
       ]
      },
      {
       "column": "D",
       "header": "الوزن الحي (كجم)",
       "kind": "input",
       "examples": [
        428,
        395
       ]
      },
      {
       "column": "E",
       "header": "السعر الكلي",
       "kind": "input",
       "examples": [
        52000,
        41800
       ]
      },
      {
       "column": "F",
       "header": "المدفوع",
       "kind": "input",
       "examples": [
        52000,
        20000
       ]
      },
      {
       "column": "G",
       "header": "ملاحظة",
       "kind": "input"
      },
      {
       "column": "H",
       "header": "النوع",
       "kind": "formula",
       "formula_row_1": "=IF(B6&\"\"=\"\",\"\",IFERROR(INDEX('القطيع'!$B$6:$B$305,MATCH(B6&\"\",'القطيع'!$A$6:$A$305,0)),\"\"))"
      },
      {
       "column": "I",
       "header": "تكلفة شرائه",
       "kind": "formula",
       "formula_row_1": "=IF(H6=\"\",\"\",IFERROR(INDEX('القطيع'!$I$6:$I$305,MATCH(B6&\"\",'القطيع'!$A$6:$A$305,0)),0))"
      },
      {
       "column": "J",
       "header": "الربح",
       "kind": "formula",
       "formula_row_1": "=IF(OR(H6=\"\",E6&\"\"=\"\"),\"\",ROUND(E6-I6,2))"
      },
      {
       "column": "K",
       "header": "سعر الكيلو",
       "kind": "formula",
       "formula_row_1": "=IF(OR(N(D6)<=0,E6&\"\"=\"\"),\"\",ROUND(E6/D6,2))"
      },
      {
       "column": "L",
       "header": "المتبقي",
       "kind": "formula",
       "formula_row_1": "=IF(E6&\"\"=\"\",\"\",ROUND(E6-N(F6),2))"
      },
      {
       "column": "M",
       "header": "تنبيه",
       "kind": "formula",
       "formula_row_1": "=IF(B6&\"\"=\"\",\"\",IF(COUNTIF('القطيع'!$A$6:$A$305,B6&\"\")=0,\"رقم غير موجود\",IF(COUNTIF($B$6:$B$505,B6&\"\")>1,\"بيع أكثر من مرة\",\"\")))"
      }
     ]
    }
   ]
  },
  {
   "name": "المصروفات",
   "formula_cells": 0,
   "record_tables": [
    {
     "header_row": 5,
     "first_record_row": 6,
     "sample_rows_filled": 7,
     "capacity_last_row": 12,
     "columns": [
      {
       "column": "A",
       "header": "التاريخ",
       "kind": "input",
       "examples": [
        "2026-10-05",
        "2026-10-22",
        "2026-10-31"
       ]
      },
      {
       "column": "B",
       "header": "البند",
       "kind": "input",
       "examples": [
        "كهرباء ومياه",
        "نقل",
        "عمالة"
       ],
       "allowed_values": [
        "عمالة",
        "كهرباء ومياه",
        "إيجار",
        "نقل",
        "صيانة",
        "أخرى"
       ]
      },
      {
       "column": "C",
       "header": "المبلغ",
       "kind": "input",
       "examples": [
        850,
        600,
        6000
       ]
      },
      {
       "column": "D",
       "header": "ملاحظة",
       "kind": "input",
       "examples": [
        "نقل أعلاف",
        "عامل الحلب",
        "نقل أعلاف"
       ]
      }
     ]
    }
   ]
  },
  {
   "name": "الربح الشهري",
   "formula_cells": 230,
   "record_tables": [
    {
     "header_row": 5,
     "first_record_row": 6,
     "sample_rows_filled": 0,
     "capacity_last_row": 18,
     "columns": [
      {
       "column": "A",
       "header": "بداية الشهر",
       "kind": "formula",
       "formula_row_1": "='الإعدادات'!$B$5"
      },
      {
       "column": "B",
       "header": "الشهر",
       "kind": "formula",
       "formula_row_1": "=CHOOSE(MONTH(A6),\"يناير\",\"فبراير\",\"مارس\",\"أبريل\",\"مايو\",\"يونيو\",\"يوليو\",\"أغسطس\",\"سبتمبر\",\"أكتوبر\",\"نوفمبر\",\"ديسمبر\")&\" \"&YEAR(A6)"
      },
      {
       "column": "C",
       "header": "بداية التالي",
       "kind": "formula",
       "formula_row_1": "=DATE(YEAR(A6),MONTH(A6)+1,1)"
      },
      {
       "column": "D",
       "header": "إنتاج الحليب (لتر)",
       "kind": "formula",
       "formula_row_1": "=IF($A6>'الإعدادات'!$B$4,\"\",SUMIFS('سجل الحليب'!$G$6:$G$3005,'سجل الحليب'!$A$6:$A$3005,\">=\"&$A6,'سجل الحليب'!$A$6:$A$3005,\"<\"&$C6))"
      },
      {
       "column": "E",
       "header": "حليب مباع (لتر)",
       "kind": "formula",
       "formula_row_1": "=IF($A6>'الإعدادات'!$B$4,\"\",SUMIFS('مبيعات الحليب'!$C$6:$C$1005,'مبيعات الحليب'!$A$6:$A$1005,\">=\"&$A6,'مبيعات الحليب'!$A$6:$A$1005,\"<\"&$C6))"
      },
      {
       "column": "F",
       "header": "إيراد الحليب",
       "kind": "formula",
       "formula_row_1": "=IF($A6>'الإعدادات'!$B$4,\"\",SUMIFS('مبيعات الحليب'!$H$6:$H$1005,'مبيعات الحليب'!$A$6:$A$1005,\">=\"&$A6,'مبيعات الحليب'!$A$6:$A$1005,\"<\"&$C6))"
      },
      {
       "column": "G",
       "header": "مبيعات الحيوانات",
       "kind": "formula",
       "formula_row_1": "=IF($A6>'الإعدادات'!$B$4,\"\",SUMIFS('مبيعات الحيوانات'!$E$6:$E$505,'مبيعات الحيوانات'!$A$6:$A$505,\">=\"&$A6,'مبيعات الحيوانات'!$A$6:$A$505,\"<\"&$C6))"
      },
      {
       "column": "H",
       "header": "إجمالي الدخل",
       "kind": "formula",
       "formula_row_1": "=IF($A6>'الإعدادات'!$B$4,\"\",ROUND(F6+G6,2))"
      },
      {
       "column": "I",
       "header": "تكلفة الحيوانات المباعة",
       "kind": "formula",
       "formula_row_1": "=IF($A6>'الإعدادات'!$B$4,\"\",SUMIFS('مبيعات الحيوانات'!$I$6:$I$505,'مبيعات الحيوانات'!$A$6:$A$505,\">=\"&$A6,'مبيعات الحيوانات'!$A$6:$A$505,\"<\"&$C6))"
      },
      {
       "column": "J",
       "header": "مشتريات الأعلاف",
       "kind": "formula",
       "formula_row_1": "=IF($A6>'الإعدادات'!$B$4,\"\",SUMIFS('مشتريات الأعلاف'!$F$6:$F$1005,'مشتريات الأعلاف'!$A$6:$A$1005,\">=\"&$A6,'مشتريات الأعلاف'!$A$6:$A$1005,\"<\"&$C6))"
      },
      {
       "column": "K",
       "header": "بيطري وتلقيح",
       "kind": "formula",
       "formula_row_1": "=IF($A6>'الإعدادات'!$B$4,\"\",SUMIFS('البيطري'!$E$6:$E$1005,'البيطري'!$A$6:$A$1005,\">=\"&$A6,'البيطري'!$A$6:$A$1005,\"<\"&$C6)+SUMIFS('التلقيح'!$F$6:$F$505,'التلقيح'!$A$6:$A$505,\">=\"&$A6,'التلقيح'!$A$6:$A$505,\"<\"&$C6))"
      },
      {
       "column": "L",
       "header": "مصروفات أخرى",
       "kind": "formula",
       "formula_row_1": "=IF($A6>'الإعدادات'!$B$4,\"\",SUMIFS('المصروفات'!$C$6:$C$1005,'المصروفات'!$A$6:$A$1005,\">=\"&$A6,'المصروفات'!$A$6:$A$1005,\"<\"&$C6))"
      },
      {
       "column": "M",
       "header": "إجمالي التكاليف",
       "kind": "formula",
       "formula_row_1": "=IF($A6>'الإعدادات'!$B$4,\"\",ROUND(I6+J6+K6+L6,2))"
      },
      {
       "column": "N",
       "header": "الربح",
       "kind": "formula",
       "formula_row_1": "=IF($A6>'الإعدادات'!$B$4,\"\",ROUND(H6-M6,2))"
      },
      {
       "column": "O",
       "header": "الربح التراكمي",
       "kind": "formula",
       "formula_row_1": "=IF($A6>'الإعدادات'!$B$4,\"\",ROUND(SUM(N$6:N6),2))"
      },
      {
       "column": "P",
       "header": "علف الحلابة",
       "kind": "formula",
       "formula_row_1": "=IF($A6>'الإعدادات'!$B$4,\"\",SUMIFS('مشتريات الأعلاف'!$F$6:$F$1005,'مشتريات الأعلاف'!$A$6:$A$1005,\">=\"&$A6,'مشتريات الأعلاف'!$A$6:$A$1005,\"<\"&$C6,'مشتريات الأعلاف'!$E$6:$E$1005,\"الحلابة\"))"
      },
      {
       "column": "Q",
       "header": "تكلفة اللتر",
       "kind": "formula",
       "formula_row_1": "=IF($A6>'الإعدادات'!$B$4,\"\",IF(N(D6)=0,\"\",ROUND((P6+K6+L6)/D6,2)))"
      },
      {
       "column": "R",
       "header": "متوسط سعر اللتر",
       "kind": "formula",
       "formula_row_1": "=IF($A6>'الإعدادات'!$B$4,\"\",IF(N(E6)=0,\"\",ROUND(F6/E6,2)))"
      }
     ]
    }
   ]
  },
  {
   "name": "الملخص",
   "formula_cells": 69,
   "record_tables": [
    {
     "header_row": 44,
     "first_record_row": 45,
     "sample_rows_filled": 0,
     "capacity_last_row": 60,
     "columns": [
      {
       "column": "A",
       "header": "المجموعة",
       "kind": "formula",
       "formula_row_1": "=IF('الإعدادات'!A21=\"\",\"\",'الإعدادات'!A21)"
      },
      {
       "column": "B",
       "header": "عدد الرؤوس",
       "kind": "formula",
       "formula_row_1": "=IF(A45=\"\",\"\",COUNTIFS('القطيع'!$F$6:$F$305,A45)-COUNTIFS('القطيع'!$F$6:$F$305,A45,'القطيع'!$G$6:$G$305,\"مباع\")-COUNTIFS('القطيع'!$F$6:$F$305,A45,'القطيع'!$G$6:$G$305,\"نافق\"))"
      },
      {
       "column": "C",
       "header": "تكلفة اليوم",
       "kind": "formula",
       "formula_row_1": "=IF(A45=\"\",\"\",SUMIFS('العلائق'!$G$6:$G$85,'العلائق'!$A$6:$A$85,A45))"
      },
      {
       "column": "D",
       "header": "تكلفة الشهر",
       "kind": "formula",
       "formula_row_1": "=IF(A45=\"\",\"\",ROUND(C45*'الإعدادات'!$B$8,2))"
      }
     ]
    }
   ],
   "settings": [
    {
     "label": "الحالة",
     "cell": "B8",
     "value": "العدد"
    },
    {
     "label": "النوع (الموجود فعلًا)",
     "cell": "B17",
     "value": "العدد"
    }
   ],
   "results": [
    {
     "label": "إجمالي المسجل",
     "cell": "B5",
     "formula": "=COUNTIF('القطيع'!$A$6:$A$305,\"?*\")"
    },
    {
     "label": "الموجود فعلًا (دون المباع والنافق)",
     "cell": "B6",
     "formula": "=B5-COUNTIF('القطيع'!$G$6:$G$305,\"مباع\")-COUNTIF('القطيع'!$G$6:$G$305,\"نافق\")"
    },
    {
     "label": "حلاب",
     "cell": "B9",
     "formula": "=COUNTIF('القطيع'!$G$6:$G$305,A9)"
    },
    {
     "label": "جافة",
     "cell": "B10",
     "formula": "=COUNTIF('القطيع'!$G$6:$G$305,A10)"
    },
    {
     "label": "حامل",
     "cell": "B11",
     "formula": "=COUNTIF('القطيع'!$G$6:$G$305,A11)"
    },
    {
     "label": "تسمين",
     "cell": "B12",
     "formula": "=COUNTIF('القطيع'!$G$6:$G$305,A12)"
    },
    {
     "label": "تربية",
     "cell": "B13",
     "formula": "=COUNTIF('القطيع'!$G$6:$G$305,A13)"
    },
    {
     "label": "مباع",
     "cell": "B14",
     "formula": "=COUNTIF('القطيع'!$G$6:$G$305,A14)"
    },
    {
     "label": "نافق",
     "cell": "B15",
     "formula": "=COUNTIF('القطيع'!$G$6:$G$305,A15)"
    },
    {
     "label": "إنتاج الحليب (لتر)",
     "cell": "B24",
     "formula": "='الربح الشهري'!D18"
    },
    {
     "label": "الحليب المباع (لتر)",
     "cell": "B25",
     "formula": "='الربح الشهري'!E18"
    },
    {
     "label": "الفرق: للعجول والبيت أو فاقد (لتر)",
     "cell": "B26",
     "formula": "=ROUND(B24-B25,1)"
    },
    {
     "label": "إيراد الحليب",
     "cell": "B27",
     "formula": "='الربح الشهري'!F18"
    },
    {
     "label": "متوسط سعر اللتر",
     "cell": "B28",
     "formula": "=IF(B25=0,\"\",ROUND(B27/B25,2))"
    },
    {
     "label": "مستحق على مركز التجميع (كل ما سُجّل)",
     "cell": "B29",
     "formula": "=SUM('مبيعات الحليب'!$I$6:$I$1005)"
    },
    {
     "label": "مشتريات الأعلاف",
     "cell": "B32",
     "formula": "='الربح الشهري'!J18"
    },
    {
     "label": "البيطري والتلقيح",
     "cell": "B33",
     "formula": "='الربح الشهري'!K18"
    },
    {
     "label": "المصروفات الأخرى",
     "cell": "B34",
     "formula": "='الربح الشهري'!L18"
    },
    {
     "label": "مبيعات الحيوانات",
     "cell": "B35",
     "formula": "='الربح الشهري'!G18"
    },
    {
     "label": "تكلفة شراء الحيوانات المباعة",
     "cell": "B36",
     "formula": "='الربح الشهري'!I18"
    },
    {
     "label": "الربح الإجمالي",
     "cell": "B37",
     "formula": "='الربح الشهري'!N18"
    },
    {
     "label": "تكلفة اللتر",
     "cell": "B38",
     "formula": "='الربح الشهري'!Q18"
    },
    {
     "label": "تكلفة العلائق الشهرية لكل المجموعات",
     "cell": "B39",
     "formula": "=SUM(D45:D52)"
    }
   ]
  },
  {
   "name": "لماذا ما زلت على إكسل؟",
   "formula_cells": 0
  }
 ]
}