{"id":5303,"date":"2024-12-10T11:52:02","date_gmt":"2024-12-10T11:52:02","guid":{"rendered":"https:\/\/blog.ezworkapp.com\/index.php\/2024\/12\/10\/tu-tao-cong-thuc-tinh-gia-xuat-kho-theo-phuong-phap-fifo-phan-2\/"},"modified":"2024-12-10T11:52:02","modified_gmt":"2024-12-10T11:52:02","slug":"tu-tao-cong-thuc-tinh-gia-xuat-kho-theo-phuong-phap-fifo-phan-2","status":"publish","type":"post","link":"https:\/\/blog.ezworkapp.com\/index.php\/2024\/12\/10\/tu-tao-cong-thuc-tinh-gia-xuat-kho-theo-phuong-phap-fifo-phan-2\/","title":{"rendered":"T\u1ef1 t\u1ea1o c\u00f4ng th\u1ee9c t\u00ednh gi\u00e1 xu\u1ea5t kho theo ph\u01b0\u01a1ng ph\u00e1p FIFO \u2013 Ph\u1ea7n 2"},"content":{"rendered":"<div class=\"uk-panel uk-margin\" id=\"template-dQf5b79p#1\">\n<p>\u0110\u1ec3 ti\u1ebfp t\u1ee5c b\u00e0i h\u1ecdc n\u00e0y, b\u1ea1n c\u1ea7n n\u1eafm v\u1eefng nguy\u00ean t\u1eafc t\u00ednh gi\u00e1 xu\u1ea5t kho theo ph\u01b0\u01a1ng ph\u00e1p FIFO nh\u01b0\u00a0\u0111\u00e3 tr\u00ecnh b\u00e0y\u00a0\u1edf b\u00e0i tr\u01b0\u1edbc. N\u1ebfu b\u1ea1n c\u00f2n ch\u01b0a r\u00f5, vui l\u00f2ng xem l\u1ea1i t\u1ea1i :\u00a0<a href=\"http:\/\/blog.ezworkapp.com\/tu-tao-cong-thuc-tinh-gia-xuat-kho-theo-phuong-phap-fifo-phan-1.html\">Ph\u1ea7n 1: Nguy\u00ean t\u1eafc c\u1ee7a ph\u01b0\u01a1ng ph\u00e1p FIFO<\/a><\/p>\n<p>B\u1edfi vi\u1ec7c x\u00e2y d\u1ef1ng c\u00e2u l\u1ec7nh VBA t\u1ef1\u00a0\u0111\u1ed9ng t\u00ednh gi\u00e1 xu\u1ea5t kho theo ph\u01b0\u01a1ng ph\u00e1p FIFO\u00a0\u0111\u00f2i h\u1ecfi b\u1ea1n ph\u1ea3i n\u1eafm\u00a0\u0111\u01b0\u1ee3c quy tr\u00ecnh th\u1ef1c hi\u1ec7n m\u1ed9t c\u00e1ch t\u1ed5ng qu\u00e1t,\u00a0\u00e1p d\u1ee5ng\u00a0\u0111\u01b0\u1ee3c trong m\u1ecdi tr\u01b0\u1eddng h\u1ee3p. T\u1eeb quy tr\u00ecnh b\u1eb1ng l\u1eddi ch\u00fang ta s\u1ebd chuy\u1ec3n h\u00f3a th\u00e0nh ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh trong VBA gi\u00fap m\u00e1y t\u00ednh t\u1ef1\u00a0\u0111\u1ed9ng th\u1ef1c hi\u1ec7n trong\u00a0Excel.<\/p>\n<p>N\u1ebfu b\u1ea1n\u00a0\u0111\u00e3 n\u1eafm\u00a0\u0111\u01b0\u1ee3c tinh th\u1ea7n c\u1ee7a b\u00e0i h\u1ecdc n\u00e0y r\u1ed3i th\u00ec ch\u00fang ta s\u1ebd b\u1eaft\u00a0\u0111\u1ea7u ph\u1ea7n 2:<\/p>\n<h2>M\u00f4 t\u1ea3 quy tr\u00ecnh t\u00ednh gi\u00e1 xu\u1ea5t kho theo ph\u01b0\u01a1ng ph\u00e1p FIFO<\/h2>\n<p>Ch\u00fang ta xem l\u1ea1i b\u1ea3ng t\u00ednh th\u1ee7 c\u00f4ng tr\u00ean\u00a0Excel m\u00f4 t\u1ea3 vi\u1ec7c t\u00ednh gi\u00e1 xu\u1ea5t kho theo ph\u01b0\u01a1ng ph\u00e1p FIFO:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-14598\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/heo-fifo-02.png\" width=\"1039\" height=\"376\" title=\"heo-fifo-02\"><\/p>\n<p>\u1ede\u00a0\u0111\u00e2y c\u00f3 2 l\u1ea7n xu\u1ea5t kho. Ch\u00fang ta s\u1ebd bi\u1ec7n lu\u1eadn cho t\u1eebng l\u1ea7n xu\u1ea5t nh\u01b0 sau:<\/p>\n<p><strong>L\u1ea7n 1<\/strong>: S\u1ed1 l\u01b0\u1ee3ng xu\u1ea5t = 20. Ch\u00fang ta g\u1ecdi\u00a0\u0111\u00e2y l\u00e0 <strong>T\u1ed5ng SL Xu\u1ea5t 1<\/strong><\/p>\n<p>+) So <strong>T\u1ed5ng SL Xu\u1ea5t 1<\/strong> v\u1edbi <strong>S\u1ed1 l\u01b0\u1ee3ng nh\u1eadp m\u1ed7i l\u1ea7n<\/strong>, t\u00ednh t\u1eeb l\u1ea7n nh\u1eadp\u00a0\u0111\u1ea7u ti\u00ean (v\u00ec tr\u01b0\u1edbc\u00a0\u0111\u00f3 ch\u01b0a c\u00f3 l\u1ea7n xu\u1ea5t n\u00e0o)<\/p>\n<div class=\"code-block code-block-3\" style=\"margin: 8px 0;clear: both\">\n<div class=\"ad-inserterpro\">\n<p>D\u00f9 \u0111\u00e3 c\u00f3 ph\u1ea7n m\u1ec1m, nh\u01b0ng k\u1ef9 n\u0103ng Excel v\u1eabn c\u1ef1c k\u1ef3 quan tr\u1ecdng v\u1edbi k\u1ebf to\u00e1n, b\u1ea1n \u0111\u00e3 v\u1eefng Excel ch\u01b0a? H\u00e3y \u0111\u1ec3 t\u00f4i gi\u00fap b\u1ea1n, \u0111\u0103ng k\u00fd kho\u00e1 h\u1ecdc Excel:<\/p>\n<p><a href=\"https:\/\/hocexcel.online\/course\/preview\/ex101-excel-tu-co-ban-den-chuyen-gia-danh-cho-nguoi-di-lam\"><br \/>\n<img decoding=\"async\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/ex101_92019-nho-454.gif\" title=\"ex101_92019-nho-454\"><br \/>\n<\/a>\n<\/div>\n<\/div>\n<div class=\"code-block code-block-2\" style=\"margin: 8px 0;clear: both\">\n<div class=\"ad-inserterpro\">\n<a href=\"https:\/\/hocexcel.online\/course\/preview\/vba101-tu-dong-hoa-excel-voi-lap-trinh-vba-cho-nguoi-moi-bat-dau\"><br \/>\n<img decoding=\"async\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/vba101_92019-nho-181.gif\" title=\"vba101_92019-nho-181\"><br \/>\n<\/a>\n<\/div>\n<\/div>\n<div class=\"code-block code-block-1\" style=\"margin: 8px 0;clear: both\">\n<div class=\"ad-inserterpro\">\n<a href=\"https:\/\/hocexcel.online\/course\/preview\/ex101-excel-tu-co-ban-den-chuyen-gia-danh-cho-nguoi-di-lam\"><br \/>\n<img decoding=\"async\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/ex101_92019-nho-454.gif\" title=\"ex101_92019-nho-454\"><br \/>\n<\/a>\n<\/div>\n<\/div>\n<ul>\n<li>N\u1ebfu <strong>S\u1ed1 l\u01b0\u1ee3ng nh\u1eadp l\u1ea7n 1<\/strong> &gt; <strong>T\u1ed5ng SL Xu\u1ea5t 1<\/strong> th\u00ec <strong>T\u1ed5ng SL Xu\u1ea5t 1<\/strong> s\u1ebd n\u1eb1m trong S\u1ed1 l\u01b0\u1ee3ng nh\u1eadp l\u1ea7n 1, \u0111\u01a1n gi\u00e1 xu\u1ea5t b\u1eb1ng v\u1edbi \u0111\u01a1n gi\u00e1 nh\u1eadp l\u1ea7n 1. K\u1ebft th\u00fac c\u00f4ng vi\u1ec7c cho l\u1ea7n xu\u1ea5t th\u1ee9 1.<\/li>\n<li>N\u1ebfu\u00a0<strong>S\u1ed1 l\u01b0\u1ee3ng nh\u1eadp l\u1ea7n 1<\/strong>\u00a0&lt;\u00a0<strong>T\u1ed5ng SL Xu\u1ea5t\u00a01\u00a0<\/strong>th\u00ec t\u00ecm <strong>S\u1ed1 ch\u00eanh l\u1ec7ch c\u1ee7a l\u1ea7n so s\u00e1nh th\u1ee9 1 <\/strong>(g\u1ecdi l\u00e0 CL1-01)<\/li>\n<li>CL1-01 = T\u1ed5ng SL Xu\u1ea5t 1 \u2013 S\u1ed1 l\u01b0\u1ee3ng nh\u1eadp l\u1ea7n 1<\/li>\n<\/ul>\n<p>=&gt; N\u1ebfu CL1-01 &lt;=0 th\u00ec k\u1ebft th\u00fac. N\u1ebfu CL1-01 &gt; 0 th\u00ec x\u00e9t ti\u1ebfp cho l\u1ea7n nh\u1eadp ti\u1ebfp theo<\/p>\n<p>+) So<strong> CL1-01<\/strong> v\u1edbi <strong>s\u1ed1\u00a0l\u01b0\u1ee3ng nh\u1eadp l\u1ea7n ti\u1ebfp theo<\/strong>:<\/p>\n<ul>\n<li>N\u1ebfu <strong>CL1-01 &lt; S\u1ed1 l\u01b0\u1ee3ng nh\u1eadp l\u1ea7n ti\u1ebfp theo<\/strong> th\u00ec s\u1ed1 l\u01b0\u1ee3ng c\u00f2n l\u1ea1i c\u1ea7n xu\u1ea5t l\u00e0 CL01,\u00a0\u0111\u01a1n gi\u00e1 xu\u1ea5t b\u1eb1ng v\u1edbi\u00a0\u0111\u01a1n gi\u00e1 nh\u1eadp l\u1ea7n\u00a0\u0111ang x\u00e9t n\u00e0y. K\u1ebft th\u00fac c\u00f4ng vi\u1ec7c.<\/li>\n<li>N\u1ebfu<strong> CL1-01 &gt; S\u1ed1 l\u01b0\u1ee3ng l\u1ea7n nh\u1eadp ti\u1ebfp theo<\/strong> th\u00ec t\u00ecm <strong>S\u1ed1\u00a0ch\u00eanh l\u1ec7ch c\u1ee7a l\u1ea7n so s\u00e1nh th\u1ee9 2<\/strong> (g\u1ecdi l\u00e0 CL1-02)<\/li>\n<li>CL1-02 = CL1-01 \u2013 S\u1ed1 l\u01b0\u1ee3ng nh\u1eadp l\u1ea7n ti\u1ebfp theo<\/li>\n<\/ul>\n<p>=&gt; N\u1ebfu CL1-02 &lt;=0 th\u00ec k\u1ebft th\u00fac. N\u1ebfu CL1-02 &gt; 0 th\u00ec x\u00e9t ti\u1ebfp c\u00e1c l\u1ea7n nh\u1eadp sau cho t\u1edbi khi t\u00ecm ra CL1-X &lt;=0<\/p>\n<p>S\u1ed1 l\u01b0\u1ee3ng c\u00f2n l\u1ea1i c\u1ee7a l\u1ea7n nh\u1eadp cu\u1ed1i sau khi xu\u1ea5t \u0111\u1ee7 s\u1ed1\u00a0ch\u00eanh l\u00each l\u1ea7n cu\u1ed1i (S\u1ed1 d\u01b0 t\u1ea1i l\u1ea7n nh\u1eadp cu\u1ed1i\u00a0th\u1ecfa m\u00e3n xu\u1ea5t h\u1ebft cho l\u1ea7n 1):<\/p>\n<p><strong>CON01<\/strong> = S\u1ed1 l\u01b0\u1ee3ng nh\u1eadp l\u1ea7n cu\u1ed1i th\u1ecfa m\u00e3n \u2013 CL l\u1ea7n cu\u1ed1i c\u1ee7a l\u1ea7n 1<\/p>\n<p>\u2014\u2014<\/p>\n<p><strong>L\u1ea7n 2<\/strong> (t\u01b0\u01a1ng t\u1ef1 v\u1edbi l\u1ea7n ti\u1ebfp sau) G\u1ecdi\u00a0\u0111\u00e2y l\u00e0 <strong>T\u1ed5ng SL Xu\u1ea5t 2<\/strong><\/p>\n<p>+) X\u00e9t <strong>CL2-01<\/strong>\u00a0=\u00a0<strong>T\u1ed5ng SL Xu\u1ea5t 2<\/strong> \u2013\u00a0<strong>CON01<\/strong>\u00a0, n\u1ebfu CL2-01 &lt; 1 th\u00ec:<\/p>\n<ul>\n<li>T\u00ednh CON02 = CON01-T\u1ed5ng SL Xu\u1ea5t 2 cho c\u00e1c l\u1ea7n xu\u1ea5t ti\u1ebfp theo<\/li>\n<li>T\u1ed5ng SL Xu\u1ea5t 2 n\u1eb1m trong CON01,\u00a0\u0111\u01a1n gi\u00e1 b\u1eb1ng\u00a0\u0111\u01a1n gi\u00e1 t\u1ea1i CON01<\/li>\n<li>K\u1ebft th\u00fac<\/li>\n<li>N\u1ebfu CL2-01 &gt;0 th\u00ec x\u00e9t ti\u1ebfp cho l\u1ea7n nh\u1eadp ti\u1ebfp theo<\/li>\n<\/ul>\n<p>+) X\u00e9t <strong>CL2-02 = CL2-01 \u2013 S\u1ed1 l\u01b0\u1ee3ng l\u1ea7n nh\u1eadp ti\u1ebfp theo<\/strong>.<\/p>\n<ul>\n<li>N\u1ebfu<strong> CL2-02 &gt; 0<\/strong> th\u00ec x\u00e9t ti\u1ebfp l\u1ea7n nh\u1eadp sau, t\u00ednh\u00a0<strong>CL2-03<\/strong><\/li>\n<li>C\u00f2n <strong>CL2-02 &lt;= 0<\/strong> th\u00ec: t\u1ed5ng s\u1ed1 ch\u00eanh l\u1ec7ch l\u1ea7n th\u1ee9 2 c\u1ee7a l\u1ea7n 2 n\u1eb1m trong l\u1ea7n nh\u1eadp n\u00e0y =&gt; T\u00ednh <strong>CON02<\/strong> =&gt; K\u1ebft th\u00fac<\/li>\n<\/ul>\n<p>Ti\u1ebfp t\u1ee5c t\u00ednh\u00a0\u0111\u1ebfn khi k\u1ebft th\u00fac v\u1edbi CL2-xxx &lt;= 0<\/p>\n<p>\u2014-<\/p>\n<p>B\u1ea1n c\u00f3 hi\u1ec3u\u00a0\u0111\u01b0\u1ee3c quy tr\u00ecnh tr\u00ean kh\u00f4ng? T\u00f4i\u00a0\u0111o\u00e1n l\u00e0 n\u00f3 kh\u00e1 kh\u00f3 v\u1edbi b\u1ea1n, nh\u01b0ng t\u00f4i c\u1ea7n b\u1ea1n hi\u1ec3u\u00a0\u0111\u01b0\u1ee3c nh\u1eefng\u00a0\u0111i\u1ec1u\u00a0\u0111\u00e3 tr\u00ecnh b\u00e0y\u00a0\u1edf tr\u00ean\u00a0\u0111\u1ec3 c\u00f3 th\u1ec3 ti\u1ebfp t\u1ee5c t\u00ecm hi\u1ec3u trong c\u00e1c b\u00e0i h\u1ecdc sau. B\u1edfi vi\u1ec7c chuy\u1ec3n quy tr\u00ecnh tr\u00ean ra ng\u00f4n ng\u1eef VBA c\u00f2n khi\u1ebfn b\u1ea1n kh\u00f3 hi\u1ec3u h\u01a1n.<\/p>\n<p>H\u1eb9n g\u1eb7p l\u1ea1i trong b\u00e0i ti\u1ebfp theo: <a href=\"http:\/\/blog.ezworkapp.com\/tu-tao-cong-thuc-tinh-gia-xuat-kho-theo-phuong-phap-fifo-phan-3.html\">Vi\u1ebft Macro t\u00ednh gi\u00e1 xu\u1ea5t kho theo ph\u01b0\u01a1ng ph\u00e1p FIFO<\/a><\/p>\n<\/div>\n<div class=\"uk-panel uk-margin uk-width-xlarge\">\n<p>Click \u0111\u0103ng k\u00fd h\u1ecdc t\u1ea1i:<\/p>\n<p><a href=\"http:\/\/blog.ezworkapp.com\/khoa-hoc\" target=\"_blank\" rel=\"noopener\">T\u1ea5t c\u1ea3 kho\u00e1 h\u1ecdc\u00a0<span>\ud83d\udcd6<\/span><\/a><\/p>\n<p><a href=\"http:\/\/blog.ezworkapp.com\/huong-dan-kich-hoat-khoa-hoc-tai-hoc-excel-online.html\" target=\"_blank\" rel=\"noopener\">H\u01b0\u1edbng d\u1eabn k\u00edch ho\u1ea1t<\/a><\/p>\n<p>HKD H\u1ecdc Excel Online<br \/>S\u1ed1 \u0110K: 17A80048102<\/p>\n<\/div>\n<div class=\"uk-panel uk-text-small uk-margin uk-margin-remove-bottom uk-text-center\">\n<p>\u00a9  document.currentScript.insertAdjacentHTML(&#8216;afterend&#8217;, &#8221; + new Intl.DateTimeFormat(document.documentElement.lang, {year: &#8216;numeric&#8217;}).format() + &#8221;);  H\u1ecdc Excel Online. All rights reserved.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<div class=\"ad-inserterpro\">\n<p>D\u00f9 \u0111\u00e3 c\u00f3 ph\u1ea7n m\u1ec1m, nh\u01b0ng k\u1ef9 n\u0103ng Excel v\u1eabn c\u1ef1c k\u1ef3 quan tr\u1ecdng v\u1edbi k\u1ebf to\u00e1n, b\u1ea1n \u0111\u00e3 v\u1eefng Excel ch\u01b0a? H\u00e3y \u0111\u1ec3 t\u00f4i gi\u00fap b\u1ea1n, \u0111\u0103ng k\u00fd kho\u00e1 h\u1ecdc Excel:<\/p>\n<p><a href=\"https:\/\/hocexcel.online\/course\/preview\/ex101-excel-tu-co-ban-den-chuyen-gia-danh-cho-nguoi-di-lam\"><br \/>\n<img decoding=\"async\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/ex101_92019-nho-454.gif\"><br \/>\n<\/a>\n<\/div>\n","protected":false},"author":1,"featured_media":5304,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-5303","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-excel-nang-cao"],"_links":{"self":[{"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/posts\/5303","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/comments?post=5303"}],"version-history":[{"count":0,"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/posts\/5303\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/media\/5304"}],"wp:attachment":[{"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/media?parent=5303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/categories?post=5303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/tags?post=5303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}